-
Notifications
You must be signed in to change notification settings - Fork 154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build 5.01 on .net 4.8 breaks because of ref to Microsoft.BCL.AsyncInterfaces v 1.0.0 #825
Comments
Hi Michael, A NuGet package should always use the lowest possible version of a dependency, which is why Simple Injector referwnces 1.0 of AsyncInterdaces. This generally means that binding redirects need to be used (under .NET) and NuGet typically managescthat for you. I say typically, because NuGet tends to fuck up from time to time. But the solution is to manually add the binding redirect in case NuGet fails to do so. |
One other thing, the release notes that you should always first upgrade to the latest v4.x (i.e. 4.10) version before upgrading to v5. You shouldn't take this advice lightly. |
You can add the following binding redirect to fix the problem. |
Hopefully, the next version of .NET (4.9?) will include the Another option is to migrate to .NET Core. With .NET Core everything will work OOTB. |
Hi @michaelkhalsa, I pushed an 5.2.0-alpha2 version of the Simple Injector core library and the ASP.NET Core integration packages to NuGet. These set of packages tend to solve the problems regarding Cheers |
App: Win Forms using .Net Framework 4.8
Installer: Microsoft VS Desktop Installer build .98
VS : 2019 Latest (not preview)
Simple Injector Build 5.01 (upgraded from build 4.1) broke my application (this took several days to find what was going on, as did not suspect simple injector). And adding a ref to nuget for this assembly does not work (I did not try an assembly redirect, and i believe i turned off this option).
It looks like Simple Injector contains a reference to 1.0.0 for Microsoft.Bcl.AsyncInterfaces
It will build fine and run within VS, however when installed, it crashes on startup with an error: Reference assemblies should only be loaded for execution, They can only be loaded in the Reflection-only-loader context.
I believe the solution is to use version 1.1.0 or 1.1.1 via nuget within your library, as quite a few libraries do (such as csv helper, reactive, etc) , instead of including a gac assembly in your library.
Downgrading back to simple injector 4.1 fixed the problem
This took several days of work to figure out.
Once i narrowed it down to Simple Injector as the culprit, I looked in the project assets.json file in the obj folder for the main project in the solution, to go through all of the assemblies using the Bcl.AsyncInterfaces, and found that build Simple Injector 5.01 was indeed referencing 1.0.0 assembly. When i downgraded, the ref to 4.1, any BCL assembly was gone from Simple Injector in the assets.json file created in the obj folder by visual studio.
Several other libraries which are using version 1.1.0 work fine.
The text was updated successfully, but these errors were encountered: