Importing of types across .NET versions is allowed #78

Closed
opened 2011-10-03 12:10:37 -05:00 by punitganshani · 3 comments
punitganshani commented 2011-10-03 12:10:37 -05:00 (Migrated from github.com)

If a type (in an assembly built on .NET 2.0) is imported in MainModule (assembly built on .NET 3.5), then it imports successfully.

This should not be case. While importing the Type it should check if the .NET runtime/CLR version match else it will result in "bad image format"

If a type (in an assembly built on .NET 2.0) is imported in MainModule (assembly built on .NET 3.5), then it imports successfully. This should not be case. While importing the Type it should check if the .NET runtime/CLR version match else it will result in "bad image format"
jbevain commented 2011-10-03 12:51:04 -05:00 (Migrated from github.com)

No it doesn't. That's a valid use case, and you can often find assemblies which reference different versions of .net assemblies.

No it doesn't. That's a valid use case, and you can often find assemblies which reference different versions of .net assemblies.
punitganshani commented 2011-10-03 13:20:03 -05:00 (Migrated from github.com)

That's correct only if the CLR version is same. Importing higher version of CLR into an assembly with lower version of CLR will not work.

Example, .NET 4.0 type imported in .NET 3.5 will not work. However, Mono allows that and creates a Bad Image assembly.

That's correct only if the CLR version is same. Importing higher version of CLR into an assembly with lower version of CLR will not work. Example, .NET 4.0 type imported in .NET 3.5 will not work. However, Mono allows that and creates a Bad Image assembly.
jbevain commented 2011-10-03 13:43:49 -05:00 (Migrated from github.com)

A .net 2.0 type will work perfectly in a .net 4.0 assembly. Cecil doesn't verify the validness of the metadata anyway, you might very well emit this kind of code for a test scenario.

A .net 2.0 type will work perfectly in a .net 4.0 assembly. Cecil doesn't verify the validness of the metadata anyway, you might very well emit this kind of code for a test scenario.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-jbevain/cecil#78
No description provided.