We are experiencing problems with the accepted solution.
Our software (32 bit .NET Framework) ships System.Buffers (.NET 4.6.1) with it and we haven't had any problems resolving it that way.
We think this is actually a proper solution to the issue, but of course requires distributing/installing the software again.
However, we now experience crashes with our software on machines were System.Buffers.dll (netstandard1.1) is located in GAC. Since GAC is preferred (here) and the GAC dll is loaded instead of the one we ship, we then later get a problem resolving System.Threading.dll and System.Runtime.dll (both in GAC installed by .NET Framework).
Removing the dll from GAC solves our problem, but obvious might break whoever placed the dll in GAC.
Examining the Fusion log we see that System.Runtime.dll was not found (despite being in GAC) and it was needed by System.Buffers.dll.
loading System.Runtime.dll
To our surprise we saw that System.Buffers.dll is loaded from GAC, even if we ship it in the installation.
loading System.Buffers.dll
We were also able to reproduce the issue by placing the .NETStandard 1.1 version of System.Buffers in GAC:
System.Buffers.dll
Workarounds/solutions:
- Always ship System.Buffers.dll, don't install to GAC
- In the Fusion log for System.Runtime.dll we see that the application has an assembly redirect. Removing this allowed our application to start. We don't recommend this as a permanent solution for a number of reasons.
- Our software would be running with a different version of System.Buffers than we intend
- The assembly redirects are generated by the paket dependency system, which we would effectively have to modify somehow.
System.Buffer nuget package v4.5.1
in CMD(run as administrator
.run cd xxxx(xxxx\packages\System.Buffers.4.5.0\lib\netstandard2.0)
and then type :gacutil /i System.Buffers.dll
. You can refer to this similar issue. Then when you finish it, please runupdate-package -reinstall
under package manager console to reinstall the package. Besides, you could try to changeVersion=4.0.2.0
toVersion=4.0.3.0
in csproj file. – Franzen