Skip to content
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

Running MusicStore sample on NET461 fails with an exception #21328

Closed
kichalla opened this issue Apr 24, 2017 · 13 comments
Closed

Running MusicStore sample on NET461 fails with an exception #21328

kichalla opened this issue Apr 24, 2017 · 13 comments
Assignees
Milestone

Comments

@kichalla
Copy link

Repro:

Expected:
Application starts successfully and you can make a request successfully to http://localhost:5000/ to see the home page.

Actual:
Application fails to start with an exception

Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'System.Runtime.Loader, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.<RunAsync>d__5.MoveNext()
   at System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.RunAsync(IWebHost host)
   at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
   at MusicStore.Program.Main(String[] args)

A pull request where discussion about this has been going on:
aspnet/MusicStore#775

cc @Eilon @pranavkm

@mellinoe
Copy link
Contributor

I haven't looked at the repro very closely, but the fact that System.Runtime.Loader is trying to load jumps out at me. That is a .NET Core-only assembly; it cannot work on .NET Framework. The way MusicStore is being built might be broken in some way if it's producing a .NET Framework application that depends on System.Runtime.Loader.

@danmoseley
Copy link
Member

@weshaggard please find the right home thx.

@weshaggard
Copy link
Member

@kichalla System.Runtime.Loader is not supported on desktop so if there is code that uses it that needs to be changed to not consume when on desktop.

@kichalla
Copy link
Author

Thanks @weshaggard

cc @Tratcher @davidfowl

@pranavkm
Copy link
Contributor

pranavkm commented May 2, 2017

@weshaggard - the API is available in netstandard1.5. The calling code doesn't know it's running on desktop: https://github.com/aspnet/Hosting/blob/dev/src/Microsoft.AspNetCore.Hosting/WebHostExtensions.cs#L96. If this isn't meant to work in desktop, shouldn't the API be moved to netcoreappx.y?

@pranavkm pranavkm reopened this May 2, 2017
@pranavkm
Copy link
Contributor

pranavkm commented May 2, 2017

I suspect this is another manifestation of https://github.com/dotnet/corefx/issues/19058.

@weshaggard
Copy link
Member

See https://github.com/dotnet/corefx/issues/11023 where this was discussed in the past. This is a case where we had a netstandard set of APIs but not all platforms supported an implementation for it.

For this library we are no longer shipping it as an individual nuget package any longer and it will only ship in Microsoft.NETCore.App going forward so folks won't be able to consume it for a desktop application.

@davidfowl davidfowl reopened this May 2, 2017
@davidfowl
Copy link
Member

davidfowl commented May 2, 2017

@weshaggard you realize that everyone that uses System.Runtime.Loader is broken right? For some reason, it was originally made to support .NET Standard 1.5 instead of netcoreapp1.0 (which is what it should have been the whole time). Can we update that package or is it pretty much dead at this point?

@weshaggard
Copy link
Member

That package is essentially dead once we ship 2.0. We could consider shipping an update of it to force the breaking change but I think our guidance will be to stop using it as opposed to updating it.

@ReubenBond
Copy link
Member

@weshaggard why is System.Runtime.Loader essentially dead in 2.0, does something replace it?

@davidfowl
Copy link
Member

It's not dead, or at least it shouldn't be. It should just be .NET Core specific.

does something replace it?

The older Assembly.Load* APIs are back in netstandard 2.0. AssemblyLoadContext gives way more control over what context assemblies get loaded into. You can avoid some of the extremely bizzare behavior by using it directly. The downside is that you're coupled to .NET Core.

@ReubenBond
Copy link
Member

Ok, good, thanks for clearing that up

@weshaggard
Copy link
Member

What @davidfowl said. The library isn't dead it is just .NET Core specific, what is dead is the individual library nuget package for it because it ships in the .NET Core 2.0 platform.

@msftgits msftgits transferred this issue from dotnet/corefx Jan 31, 2020
@msftgits msftgits added this to the 2.0.0 milestone Jan 31, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants