-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
MetadataLoadContext: IsValueType: NotSupportedException: Modified types do not support this member #83679
Comments
Tagging subscribers to this area: @dotnet/area-system-reflection Issue DetailsDescriptionI just updated some things to net8.0 preview 2 with System.Reflection.MetadataLoadContext preview 2. I'm using S.R.MDLC to load all the reference assemblies and process them. There are several places now where I am now seeing the following exception:
The exception is thrown when I try to retrieve nullability info for a parameter, but it can also be triggered by simply using IsValueType. One place it happens is on the I'm just coming up to speed on the new "modified types" stuff, and I see that they don't support equality, and that's what the exception is saying. What I cannot figure out is why a modified type is in play here. Or how I might detect that situation and use the APIs differently to avoid the problem. Reproduction StepsRun this console app with the path of the targeting pack as its first argument. For example:
Expected behaviorIsValueType on the parameter type should not throw. Actual behaviorSystem.NotSupportedException: Modified types do not support this member. Regression?Yes, I think this is a regression of sorts. The crash does NOT occur with System.Reflection.MetadataLoadContext 8.0.0-preview.1.23110.8 The crash DOES occur with System.Reflection.MetadataLoadContext 8.0.0-preview.2.23128.3 Known WorkaroundsNo response Configuration.NET 8 Preview 2 macOS arm64 I haven't tried this on Windows or Linux yet. Other informationNo response
|
@ericsink thanks for the wonderful repro. |
Description
I just updated some things to net8.0 preview 2 with System.Reflection.MetadataLoadContext preview 2. I'm using S.R.MDLC to load all the reference assemblies and process them.
There are several places now where I am now seeing the following exception:
The exception is thrown when I try to retrieve nullability info for a parameter, but it can also be triggered by simply using IsValueType.
One place it happens is on the
value
parameter ofSystem.Runtime.InteropServices.SequenceMarshal.TryRead
. There are several others. The repro project will dump out a list of them.I'm just coming up to speed on the new "modified types" stuff, and I see that they don't support equality, and that's what the exception is saying. What I cannot figure out is why a modified type is in play here. Or how I might detect that situation and use the APIs differently to avoid the problem.
Reproduction Steps
repro.zip
Run this console app with the path of the targeting pack as its first argument. For example:
Expected behavior
IsValueType on the parameter type should not throw.
Actual behavior
System.NotSupportedException: Modified types do not support this member.
Regression?
Yes, I think this is a regression of sorts.
The crash does NOT occur with System.Reflection.MetadataLoadContext 8.0.0-preview.1.23110.8
The crash DOES occur with System.Reflection.MetadataLoadContext 8.0.0-preview.2.23128.3
Known Workarounds
No response
Configuration
.NET 8 Preview 2
macOS arm64
I haven't tried this on Windows or Linux yet.
Other information
No response
The text was updated successfully, but these errors were encountered: