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

Assembly.Load with null Version #4467

Closed
mellinoe opened this issue Sep 2, 2015 · 6 comments
Closed

Assembly.Load with null Version #4467

mellinoe opened this issue Sep 2, 2015 · 6 comments
Assignees
Labels

Comments

@mellinoe
Copy link
Contributor

mellinoe commented Sep 2, 2015

I'm curious about the behavior of Assembly.Load(AssemblyName) when the given AssemblyName has a null Version property. It seems that, when trying to load an unsigned assembly (no public key), you must assign something to the Version property; even 0.0.0.0 works. For example, the following doesn't work:

Assembly.Load(new AssemblyName("unsigned-assembly"))
>> FileLoadException, "Assembly's manifest definition doesn't match assembly reference"

but the following does. The second one works because the assembly is signed.

Assembly.Load(new AssemblyName("unsigned-assembly") { Version  = new Version(0, 0, 0, 0) });
Assembly.Load(new AssemblyName("signed-assembly"));

Do we have documentation regarding this behavior? It seems a little counter-intuitive to me.

This came up because the latest beta version of xUnit attempts to load assemblies by calling Assembly.Load(new AssemblyName() { Name = ..., Version = null }). Actually it's slightly different than that, but that's the gist of it: https://github.com/xunit/xunit/blob/master/src/common/SerializationHelper.cs#L166.

cc: @jkotas , @nguerrera , @weshaggard

@jkotas
Copy link
Member

jkotas commented Sep 4, 2015

It looks like a bug to me that we should fix.

@jkotas jkotas changed the title Behavior of Assembly.Load with null Version Assembly.Load with null Version Sep 4, 2015
@tmat
Copy link
Member

tmat commented Sep 4, 2015

We need this to be fixed before we can start running Roslyn tests on CoreCLR.

@sergiy-k
Copy link
Contributor

sergiy-k commented Sep 4, 2015

@kouvel, could you please take a look?

@sergiy-k sergiy-k assigned sergiy-k and kouvel and unassigned sergiy-k Sep 4, 2015
@kouvel
Copy link
Member

kouvel commented Sep 4, 2015

Sure, I'll take a look

@jkotas
Copy link
Member

jkotas commented Sep 4, 2015

cc @gkhanna79

@mellinoe
Copy link
Contributor Author

mellinoe commented Sep 4, 2015

There was some discussion over email regarding this that wasn't captured here. A main point was that assemblies on the TPA list (everything residing next to CoreRun) must have a version specified in order to be loaded. That seems to be the relevant part of the logic involved here.

dsplaisted referenced this issue in dsplaisted/msbuild Sep 9, 2015
….execution.dotnet.dll to work around dotnet/coreclr#1477
@msftgits msftgits transferred this issue from dotnet/coreclr Jan 30, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jan 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants