-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
.NET 4.7.1 app experiences unexpected "Could not load file or assembly 'System.Runtime, Version=4.1.2.0" #27600
Comments
@joperezr does it ring a bell? |
My advice was "remove the assembly binding redirects from the project" I repeated this two times: I have reported this bug a long time ago but it got ignored: |
If it is duplicate, let's resolve one of them as dupe of the other. |
I just wanted to highlight that it's not a problem with the .NET Framework, it's a problem with Visual Studio. Rider is an example of IDE which doesn't have this problem, so it's definitely an IDE issue. |
The problem here I believe is with the VS tooling when you add the nuget package reference. It shouldn't be adding that extra binding redirect. If you instead migrate your project to use @sandersaares can you try the exact same repro but instead of adding Benchmarkdotnet package via VS, simple add this to your project:
|
@joperezr I confirm that using the steps you describe results in a successful execution of the app. |
Closing as resolved. Thanks for confirmation @sandersaares! |
Hang on a minute. That is a workaround, not a resolution to the defect in question. I would consider this resolved if the scenario in the original post works without errors. You can't expect Visual Studio users to go digging in files that VS generates them and changing settings based on some obscure GitHub issue. That is not any sensible level of user experience. "Make framework-provided assemblies actually work" is something that I expect out of the box with default settings on all fronts. |
I agree @sandersaares, that said, I don’t believe this is the right repo to log an issue with the vs nuget tooling, as the fix for this would most certainly not go in here. The issues on this repo are regarding bugs/problems with the framework itself. I would probably move this issue to either dotnet/sdk or nuget which are probably still not the right places but they might know how to re-route it better. |
Yeah, I did spend a few minutes considering where to file this. It is not obvious to me as a user what exactly is the cause of the issue, all I see is that my .NET app development is blocked. Here is an attempt at a differently targeted repost: https://developercommunity.visualstudio.com/content/problem/360253/net-471-app-experiences-unexpected-could-not-load.html Hrm, looks like that site doesn't do code blocks... |
Yeah, I totally agree that as a user when you don’t know what is going on this is a good place to post it so that we can have an initial diagnosis. Now that we know the cause of this is the nuget package manager adding wrong redirects its a good time to move it where the fix would go 😄 I think that choosing vs feedback was the right choice :) |
Microsoft has now been made aware of multiple severe bugs of this kind. Please reroute these issues internally to the right places. It is not for customers to run after Microsoft to find a place that would accept these bug reports. |
Expected result: app executes and does some no-op benchmarks.
Actual result:
Packages.config contains this:
App.config contains this:
Inspecting what is happening with a debugger indicates that the exception occurs in the cctor of the Builder class:
binlog.zip
I attach a solution that contains both a repro app (ConsoleApp1) and the BenchmarkDotNet package source, to allow easy inspection of a debug build:
BenchmarkDotNet.zip
Previous discussion with BenchmarkDotNet maintainers at: dotnet/BenchmarkDotNet#896. Their advice was to migrate from Visual Studio to Rider if I want to use their library in this situation but I would perfer to continue using Visual Studio if possible.
The text was updated successfully, but these errors were encountered: