1

I have a strange error. I created for testing purposes a normal Console Application and run my own Tracer which is written with the help of Mono.Cecil on this application. I embedd a Stopwatch at the entry and exit of every method.

After I embedd it (the IL doesn't have any errors or warnings in it, when I inspect it with ILSpy) and try to run the Console Application it throws:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'System.Runtime .Extensions, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its depende ncies. The system cannot find the file specified.

Which is really strange, because Version = 4.2.2.0 doesn't even exists? Does anybody have a idea how this could be solved?

So when I try to give that Application any other Version of System.Runtime.Extensions this is thrown:

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.Ext ensions, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencie s. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

I'm stuck and would be thankful for every help or idea to resolve this problem.

3
  • this looks very similar - stackoverflow.com/questions/10878602/…
    – R4444
    Commented Jun 8, 2021 at 4:11
  • Is your problem with the non-existing version or the reference itself? System.Diagnostics.StopWatch resides in System.Runtime.Extensions for .net core so I guess it makes sense that the app tries to load it. Commented Jun 8, 2021 at 18:37
  • The main problem is the version it asks, because version=4.2.2.0 doesn't even exists. I have no idea why it would ask me for this kind of version. I could solve it a little bit with Mono.Cecil, by loading System.Runtime.Extensions and change the Version to '4.2.2.0'. But I think it is not a good idea to do it this way. Commented Jun 8, 2021 at 18:58

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.