Last week I upgraded my .NET Core Web API from 2.2 to 3.0.
I had a lot of issues with packages and still struggling.
Case 1: What I have right now is that all of my tests are failing: unit tests, integrations tests, etc.
When I start debugging my tests I get the following error message:
System.IO.FileNotFoundException HResult=0x80070002 Message=Could not load file or assembly 'Microsoft.IntelliTrace.Core, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. Source=System.Private.CoreLib.
The error occurred in the
RuntimeAssembly file (part of system.private.corelib), method
When I continue I get this:
System.Reflection.ReflectionTypeLoadException: 'Unable to load one or more of the requested types. Could not load file or assembly 'Microsoft.IntelliTrace.Core, Version=22.214.171.124, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.'
Case 2: When I'm not debugging my tests but just run my application en startup swagger, I can use every call but my output window is filled with thousands of Exceptions like thrown:
'System.InvalidCastException' in Swashbuckle.AspNetCore.SwaggerGen.dll
This happens when the Linq class
Where.SpeedOpt.cs is used and the
List.cs class of generic, also in
Are case 1 and case 2 related to each other?
Anyone have a workaround or solution?
Case 2 (swagger error) is solved. Seems there was a bug in the swagger 5.0.0 packages That bug is solved in the 5.0.0-rc4 version
Case 1 is still open. I tried to reproduce with different coding and see what the results are.
When i instantiate a new httpclient, there is no error. Nevertheless, i can not call my api because it's secured and i get the "unathorized" error (normal behaviour)
When i instantiate a new httpclient with my webapplicationfactory, there is the error. Is there something that is not initialized from startup when i run my tests instead of running the core api thru normal startup and calling swagger? Maybe a problem in startup that is only an issue in unit and integrationtests?
Case 1 also fixed:
When using .Net Core 3.0 and automapper you should add automapper with additional parameter
In .Net core 2.2 i just had
He fails on this during unit and integrationtesting not on normal startup
User contributions licensed under CC BY-SA 3.0