[V2] Could not load file or assembly System.Numerics.Vectors

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
AlexCereus
Posts: 7
Joined: Fri Feb 15, 2019 2:03 pm

[V2] Could not load file or assembly System.Numerics.Vectors

Post by AlexCereus »

Hello.

I try to use BepuPhysics with Photon Server. When I run my app, it logs error:

ERROR Photon.SocketServer.ApplicationBase [(null)] - System.BadImageFormatException: Could not load file or assembly 'System.Numerics.Vectors, Version=4.1.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. (Exception from HRESULT: 0x80131058)

Please help.
KakCAT
Posts: 32
Joined: Mon Apr 14, 2014 2:08 pm

Re: [V2] Could not load file or assembly System.Numerics.Vectors

Post by KakCAT »

Hi Alex,

I don't know if this is the case, but BadImageFormatException is very often a problem when mixing 32 bits and 64 bits:

https://stackoverflow.com/questions/159 ... on-c-sharp
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: [V2] Could not load file or assembly System.Numerics.Vectors

Post by Norbo »

In .NET standard projects, nuget sometimes pulls down 'dummy' dependencies. They provide the same API as the full implementation and provide all the same reflection features but don't contain any implementation details. When a .NET Standard project is consumed by an application, the application project pulls down non-dummy dependencies specific to the application's framework.

In this case, it looks like the dummy dependencies are being directly referenced and the runtime is unhappy about it. You'll need to find a compatible version of the dependency to use. VS's package manager will automatically resolve this sort of thing, but if you're working outside the package manager you'll have to do it manually.
Post Reply