Here's the situation.
I have 2 simple dll compiled in .NET standard 2.0 (for compatibility reasons). The first one (let's call it A) has no external references except for NETStandard.Library (2.0.3). The second one (let's call it B) references Microsoft.Extensions.Loggin.Abstractions (5.0.0), Newtonsoft.Json (13.0.1) and of course NETStandard.Library (2.0.3). Both compile & run (local unit tests) without errors.
Since I need them to be shared through several projects I'm using a private GitHub package repository; I'm able to get them from the NuGet Package Manager in Visual Studio. The NuGets creation & deploy is done thanks to a GitHub action.
Both dlls are currently used without any issue in a .NET Core 3.1 REST project.
The problems started when I tried to use them in a .NET Core 2.2 REST project: while everything was fine locally (debug), after the publish and the deploy I figured out that the dll B was breaking the whole app somehow.
The app starts but every request to the REST services never receives any response (I think that it never reaches the endpoint, to tell the truth). No logs/errors from the app or IIS in text files and Event Viewer.
I figured out that's not related to the code beacuse referencing the dll B without using anyone of its methods is enought to break the whole thing.
No problems at all with the A dll.
Here's what I've tried (not exactly in this order):
So, even the NuGet reference to the empty dll breaks the app(s), while as local assembly doesn't. It's not a framework/environment problem since the new .NET Core 2.2 project and the other .NET Core 3.1 project work well (on the same machines). It's not a .NET Standard compilation problem because the A dll follows exactly the same deploy method and it works everywhere. No errors thrown. Everything is fine while debugging.
I'm desperate. Any advice?
Thanks
I finally figured it out, even if some things are still not clear.
My project in .NETCore2.2 uses AspNetCore.All with a specific version (2.2, according to the framework) and includes some Microsoft.Extensions.Logging dlls.
My B dll references Microsoft.Extensions.Logging.Abstractions 5.0: downloading B as NuGet makes the package manager resolve the references, so basically I was going on with a v5.0 in my app while the app was looking for a v2.2 in the framework (probably in the GAC, this could explain why a brand new app with the same references was working well).
So I solved by using
AppDomain.CurrentDomain.FirstChanceException += (sender, eventArgs) =>
{
//Log everything here
}
and I discovered that it was throwing an error about a class that i was not using at all; the class was present in Logging.Abstractions 5.0 but not in 2.2.
Since I don't need any feature of the 5.0, I downgraded it to 2.0 and now it works like a charm.
Still don't know why no exception was logged in the event viewer.