-
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
Invalid type for MakeGenericMethod is crashing the runtime #71339
Comments
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis Issue DetailsOne of the types from the test below is crashing the mono runtime in #71324 (most likely Specific commit affected Relevant code: [Theory]
[InlineData(typeof(void))]
[InlineData(typeof(Dictionary<,>))]
[InlineData(typeof(List<>))]
[InlineData(typeof(Nullable<>))]
[InlineData(typeof(int*))]
[InlineData(typeof(RefStruct))]
public static void CreateJsonTypeInfoWithInappropriateTypeThrows(Type type)
{
Assert.Throws<ArgumentException>(() => JsonTypeInfo.CreateJsonTypeInfo(type, new JsonSerializerOptions()));
}
// JsonTypeInfo.CreateJsonTypeInfo:
if (IsInvalidForSerialization(type)) // it seems it passed the check in the repro
{
ThrowHelper.ThrowArgumentException_CannotSerializeInvalidType(nameof(type), type, null, null);
}
s_createJsonTypeInfo ??= typeof(JsonTypeInfo).GetMethod(nameof(CreateJsonTypeInfo), new Type[] { typeof(JsonSerializerOptions) })!;
return (JsonTypeInfo)s_createJsonTypeInfo.MakeGenericMethod(type)
.Invoke(null, new object[] { options })!;
|
Here is the full log
|
) * Argument tests for CreateJsonTypeInfo and CreateJsonPropertyInfo * add check for typeof(void) - possibly workaround #71339
It seems like it might be possible to isolate this in a standalone reproduction that doesn't use json components? |
Tagging subscribers to this area: @dotnet/area-system-reflection Issue DetailsOne of the types from the test below is crashing the mono runtime in #71324 (most likely Specific commit affected Relevant code: [Theory]
[InlineData(typeof(void))]
[InlineData(typeof(Dictionary<,>))]
[InlineData(typeof(List<>))]
[InlineData(typeof(Nullable<>))]
[InlineData(typeof(int*))]
[InlineData(typeof(RefStruct))]
public static void CreateJsonTypeInfoWithInappropriateTypeThrows(Type type)
{
Assert.Throws<ArgumentException>(() => JsonTypeInfo.CreateJsonTypeInfo(type, new JsonSerializerOptions()));
}
// JsonTypeInfo.CreateJsonTypeInfo:
if (IsInvalidForSerialization(type)) // it seems it passed the check in the repro
{
ThrowHelper.ThrowArgumentException_CannotSerializeInvalidType(nameof(type), type, null, null);
}
s_createJsonTypeInfo ??= typeof(JsonTypeInfo).GetMethod(nameof(CreateJsonTypeInfo), new Type[] { typeof(JsonSerializerOptions) })!;
return (JsonTypeInfo)s_createJsonTypeInfo.MakeGenericMethod(type)
.Invoke(null, new object[] { options })!;
|
|
One of the types from the test below is crashing the mono runtime in #71324 (most likely
typeof(void)
)Specific commit affected
39b0578
Relevant code:
cc: @steveisok @fanyang-mono
The text was updated successfully, but these errors were encountered: