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?

  • Possible duplicate of [The located assembly's manifest definition does not match the assembly reference](https://stackoverflow.com/questions/215026/the-located-assemblys-manifest-definition-does-not-match-the-assembly-reference) – habib Sep 25 '18 at 12:23
  • Exception message requests version `4.5.0.3` you mentioned reinstalling version `4.5.3`. Typo? – nilsK Sep 25 '18 at 12:26
  • I can not install 4.5.0.3. There is nothing listed between 4.5.0 and 4.5.1. Also trying to install either of these raises an error and cancels the NuGet installationg. – Josip Kelava Sep 25 '18 at 12:27
  • This is not duplicate of the .NET Framework error. This is a UWP specific error message that is caused by the version hell of UWP. Sometimes the UWP team builds the actual runtime version with a different build of certain system packages that have different PublicKeyToken than the versions in the NuGet package. So when we update the actual dependency the two package publicKeyTokens won't match. A binding redirect might help. – Daniel Leiszen Jan 05 '20 at 01:07
  • I've long gone past the project. Not sure if I should be deleting the question. – Josip Kelava May 29 '21 at 14:59

2 Answers2

1

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.

Palle Due
  • 5,929
  • 4
  • 17
  • 32
MelloPs
  • 135
  • 11
1

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

Arif
  • 11
  • 2