Could not load file or assembly 'System.Numerics.Vectors

Viewed 43

I have built a c# solution with visual studio 2022. It is: https://github.com/guided-hacking/GH-Entity-List-Finder. It builds fine but when I run the build exe it gives the error below. I have tried to reinstall my dotnet runtimes but to no avail. Is this because of my sdk or visual studio? Or is this a problem in my code?

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.FileNotFoundException: Could not load file or assembly 'System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
File name: 'System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at Squalr.Engine.OS.Vectors.get_VectorSize()
   at Squalr.Engine.Scanning.Snapshots.ReadGroup..ctor(UInt64 baseAddress, Int32 regionSize, DataType dataType, Int32 alignment)
   at Squalr.Engine.Scanning.Snapshots.SnapshotManager.CreateSnapshotFromSettings(DataType dataType)
   at Squalr.Engine.Scanning.Snapshots.SnapshotManager.GetSnapshot(SnapshotRetrievalMode snapshotCreationMode, DataType dataType)
   at Squalr.Source.Prefilters.Prefilter.GetPrefilteredSnapshot(DataType dataType)
   at Squalr.Engine.Scanning.Snapshots.SnapshotManager.GetActiveSnapshotCreateIfNone(DataType dataType)
   at Squalr.Engine.Scanning.Snapshots.SnapshotManager.GetSnapshot(SnapshotRetrievalMode snapshotCreationMode, DataType dataType)
   at EntityListFinder.EntityListFinder.StartScan(Int32 index, Int64 searchAddress, Boolean validatingProcess) in C:\Users\Ali-Akber\Source\Repos\GH-Entity-List-Finder\EntityListFinder.cs:line 86
   at EntityListFinder.EntityListFinder.SearchButton() in C:\Users\Ali-Akber\Source\Repos\GH-Entity-List-Finder\EntityListFinder.cs:line 74
   at EntityListFinder.MainForm.SearchButton_Click(Object sender, EventArgs e) in C:\Users\Ali-Akber\Source\Repos\GH-Entity-List-Finder\MainForm.cs:line 168
   at System.Windows.Forms.Control.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnClick(EventArgs e)
   at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ButtonBase.WndProc(Message& m)
   at System.Windows.Forms.Button.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].



************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4515.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
GH Entity List Finder
    Assembly Version: 1.0.0.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Ali-Akber/Source/Repos/GH-Entity-List-Finder/builds/x64/Debug/GH%20Entity%20List%20Finder.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4515.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4488.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4395.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4341.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4515.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.ServiceProcess
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.ServiceProcess/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.ServiceProcess.dll
----------------------------------------
Squalr.Engine
    Assembly Version: 2.3.1.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Ali-Akber/Source/Repos/GH-Entity-List-Finder/builds/x64/Debug/GH%20Entity%20List%20Finder.exe
----------------------------------------
netstandard
    Assembly Version: 2.0.0.0
    Win32 Version: 4.8.4161.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/netstandard/v4.0_2.0.0.0__cc7b13ffcd2ddd51/netstandard.dll
----------------------------------------
System.Drawing.Common
    Assembly Version: 4.0.0.1
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Ali-Akber/Source/Repos/GH-Entity-List-Finder/builds/x64/Debug/GH%20Entity%20List%20Finder.exe
----------------------------------------
Squalr.Engine.Scanning
    Assembly Version: 2.3.1.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Ali-Akber/Source/Repos/GH-Entity-List-Finder/builds/x64/Debug/GH%20Entity%20List%20Finder.exe
----------------------------------------
System.Configuration.ConfigurationManager
    Assembly Version: 4.0.2.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Ali-Akber/Source/Repos/GH-Entity-List-Finder/builds/x64/Debug/GH%20Entity%20List%20Finder.exe
----------------------------------------
Squalr.Engine.Memory
    Assembly Version: 2.3.1.0
    Win32 Version: 1.0.0.0
    CodeBase: file:///C:/Users/Ali-Akber/Source/Repos/GH-Entity-List-Finder/builds/x64/Debug/GH%20Entity%20List%20Finder.exe
----------------------------------------
Microsoft.CSharp
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/Microsoft.CSharp/v4.0_4.0.0.0__b03f5f7f11d50a3a/Microsoft.CSharp.dll
----------------------------------------
System.Dynamic
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4161.0
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Dynamic/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Dynamic.dll
----------------------------------------
Anonymously Hosted DynamicMethods Assembly
    Assembly Version: 0.0.0.0
    Win32 Version: 4.8.4515.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/mscorlib/v4.0_4.0.0.0__b77a5c561934e089/mscorlib.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
1 Answers

Long story short, you're using dependencies wrong. You're directly referencing assemblies without taking care of their dependencies (in this case, System.Numerics.Vectors). Since only that library uses it, of course your code will compile and will break at run-time.

You should be making a NuGet package out of that library that references all it needs to run, and then simply reference the package to get everything you need.

Unrelated to your question, but you're also scanning processes wrong (check the returns instead of trying to use them and getting exceptions) and in general everything you do freezes your app -- use tasks and multiple threads.

I fixed the first two issues for you in https://github.com/guided-hacking/GH-Entity-List-Finder/pull/3, but you should really reconsider your design. So many problems in a program that does essentially nothing but proxy its calls to a library you don't own is a serious red flag.

Related