System.IO.FileLoadException on System.ServiceModel.Primitives

1

I am currently working on a Xamarin project, and I required something that Xamarin on it's own doesn't support, so I looked for solutions. After messing around with some NuGets, my project ended up with a bunch of weird and unexplainable compile errors, popping up and disappearing randomly. Eventually I realized that I removed a NuGet from the shared project, but not the UWP one. After removing it from UWP, the program compiles and runs. But seems that there is some more damage done...

However, when I try to call a method of a class defined in a different file, it throws a System.IO.FileLoadException, which it previously wasn't doing. The complete Exception message is:

System.IO.FileLoadException: 'Could not load file or assembly 'System.ServiceModel.Primitives, Version=4.5.0.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)'

After a bit of digging, it concluded that it is probably caused by a missing nugget, which I must've deleted by a mistake. So I installed a 4.5.3 version. Didn't help. Restarted Visual Studio, no effect.

I can't install any earlier versions, as it is considered being a downgrade by something. Any clues how to deal with this?

c#
fileloadexception
asked on Stack Overflow Sep 25, 2018 by Josip Kelava • edited Sep 25, 2018 by Josip Kelava

2 Answers

0

I had the same problem in my UWP project.

My solution was to remove checking if the exception is a FaultException. It seems like FaultException is not supported. After removing the check my method works fine, I could step in etc. Hopefully this helps you too and solves your problem.

answered on Stack Overflow Mar 7, 2019 by MelloPs • edited Aug 20, 2019 by Palle Due
0

My case it solved by update the System.ServiceModel.Primitives for .NET Standard to 4.4.4. version as mentioned below,

https://github.com/dotnet/wcf/issues/3088#issuecomment-411603736

answered on Stack Overflow Feb 25, 2020 by Arif

User contributions licensed under CC BY-SA 3.0