-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
Description
We're trying to upgrade our project from NET Framework to NET8. First, we've upgraded it to NET6 where it is mostly working, then we are trying to update to NET8. After upgrading, we are getting an exception:
System.TypeLoadException: 'Could not load type 'System.Reflection.Emit.PEFileKinds' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.'
After some investigation, it looks like NET8 version of the mscorlib is missing [assembly: TypeForwardedTo(typeof(PEFileKinds))] along with some other types:
[assembly: TypeForwardedTo(typeof(AssemblyRegistrationFlags))]
[assembly: TypeForwardedTo(typeof(ExporterEventKind))]
[assembly: TypeForwardedTo(typeof(IDispatchImplAttribute))]
[assembly: TypeForwardedTo(typeof(IDispatchImplType))]
[assembly: TypeForwardedTo(typeof(PEFileKinds))]
[assembly: TypeForwardedTo(typeof(RegistrationClassContext))]
[assembly: TypeForwardedTo(typeof(RegistrationConnectionType))]
[assembly: TypeForwardedTo(typeof(SetWin32ContextInIDispatchAttribute))]
The type it's looking for still exists in System.Private.CoreLib, it's just the type forwarding missing.
Reproduction Steps
- Open mscorlib in NET6 using ILSpy
- See the [assembly: TypeForwardedTo(typeof(PEFileKinds))] attribute
- Open mscorlib in NET8 using ILSpy
- [assembly: TypeForwardedTo(typeof(PEFileKinds))] (+ all the other types mentioned) is missing
Expected behavior
Application should not break after upgrading from NET6 to NET8.
Actual behavior
Application starts crashing after being upgraded to NET8.
Regression?
This was working in NET6.
Known Workarounds
No response
Configuration
Windows 11 22H2, x64, NET8 preview 7
Other information
No response