Join GitHub today
A package referencing just NETStandard causes invalid binding redirects on .NET 4.7.2 in a web application #941
There seems to be an issue that adds bad binding redirects to web.config and it also leads to System.Net.Http being erroneously installed. I'm not sure with my diagnosis here but there seems to be some issue. This issue uses the UAParser NuGet package but UAParser is not at fault. It merely references NETStandard so I'm using this package to demonstrate the issue. This is on .NET 4.7.2, VS 15.8.7, Windows 7.
The core of the repro is this:
The app crashes like this:
In the web.config file there are binding redirects like this one:
If this one and a few others are commented out the app runs. The redirects appear inappropriate because they do not specify the version number that is installed on the machine (220.127.116.11 I believe).
I also note that System.Net.Http was installed. According to this comment this should not be done. So I manually uninstalled it, deleted bin/obj, commented in the binding redirects and tested. This did not change anything.
I'm not sure what exactly is broken here but I do not believe that UAParser does anything wrong here. It only references NETStandard which can't be wrong according to my understanding.
We are experiencing this issue in a production application. This forces us to manually undo the faulty binding redirects after NuGet operations.
referenced this issue
Oct 25, 2018
I'm tracking related issues and information in a list. They are related to System.Net.Http, System.Runtime, System.IO, System.ValueTuple, System.Buffers and others.
All of these have the same very few underlying issues.
.NET 4.7.2 helps with some but not all of these. You can look at my comments on some of these issues for some ideas on how to work around those problems. I also have a central list of ideas to try.
I'm pretty sure that this is the same issue that you logged here #887. It might be caused by referencing a different package, but the same issue is happening underneath. That is that NuGet package manager will add wrong binding redirects into your App.config. As suggested in the other issue, a workaround for this is to instead use PackageReference instead of using the default NuGet package manager.