Skip to content

Commit

Permalink
[mono] Pass the pending exception correctly from interp_runtime_invok…
Browse files Browse the repository at this point in the history
…e ().

Fixes dotnet#71838.
  • Loading branch information
vargaz committed Jul 13, 2022
1 parent a5f3676 commit 66ce574
Show file tree
Hide file tree
Showing 11 changed files with 7 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,6 @@ private class TrailingAngleBracketPolicy : JsonNamingPolicy
[Theory]
[InlineData(typeof(KeyNameNullPolicy), "Key")]
[InlineData(typeof(ValueNameNullPolicy), "Value")]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task InvalidPropertyNameFail(Type policyType, string offendingProperty)
{
var options = new JsonSerializerOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ public async Task PublicParameterlessCtor_MultiplePublicParameterizedCtors_WithA

#if !BUILDING_SOURCE_GENERATOR_TESTS // These are compile-time warnings from the source generator.
[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task MultipleAttributes_NotSupported()
{
async Task RunTestAsync<T>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ public async Task CaseInsensitiveFails()
#if BUILDING_SOURCE_GENERATOR_TESTS
[ActiveIssue("Multi-dim arrays not supported.")]
#endif
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task ClassWithUnsupportedCollectionTypes()
{
Exception e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,6 @@ public class ClassWithTwoExtensionProperties
#if BUILDING_SOURCE_GENERATOR_TESTS
[ActiveIssue("https://github.com/dotnet/runtime/issues/58945")]
#endif
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task InvalidExtensionPropertyFail()
{
// Baseline
Expand Down Expand Up @@ -799,7 +798,7 @@ public async Task DeserializeIntoJsonObjectProperty()
#if BUILDING_SOURCE_GENERATOR_TESTS
[ActiveIssue("https://github.com/dotnet/runtime/issues/58945")]
#endif
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]

public async Task DeserializeIntoSystemObjectProperty()
{
string json = @"{""MyDict"":{""Property1"":1}}";
Expand Down Expand Up @@ -1089,7 +1088,6 @@ public class ClassWithInvalidExtensionPropertyStringJsonNode
#if BUILDING_SOURCE_GENERATOR_TESTS
[ActiveIssue("https://github.com/dotnet/runtime/issues/58945")]
#endif
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task ExtensionProperty_InvalidDictionary()
{
var obj1 = new ClassWithInvalidExtensionPropertyStringString();
Expand Down Expand Up @@ -1149,7 +1147,6 @@ public class ClassWithMultipleDictionaries
#if BUILDING_SOURCE_GENERATOR_TESTS
[ActiveIssue("https://github.com/dotnet/runtime/issues/58945")]
#endif
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task DeserializeIntoImmutableDictionaryProperty()
{
// baseline
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ public async Task CustomNamePolicy()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task NullNamePolicy()
{
var options = new JsonSerializerOptions();
Expand Down Expand Up @@ -128,7 +127,6 @@ public async Task JsonPropertyNameAttribute()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task JsonNameAttributeDuplicateDesignTimeFail()
{
{
Expand All @@ -143,7 +141,6 @@ public async Task JsonNameAttributeDuplicateDesignTimeFail()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task JsonNameConflictOnCamelCasingFail()
{
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ public class ClassWithMixedPropertyAccessors_PropertyAttributes
[InlineData(typeof(ClassWithPrivate_InitOnlyProperty_WithJsonIncludeProperty))]
[InlineData(typeof(ClassWithInternal_InitOnlyProperty_WithJsonIncludeProperty))]
[InlineData(typeof(ClassWithProtected_InitOnlyProperty_WithJsonIncludeProperty))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public virtual async Task NonPublicProperty_WithJsonInclude_Invalid(Type type)
{
InvalidOperationException ex = await Assert.ThrowsAsync<InvalidOperationException>(async () => await Serializer.DeserializeWrapper("{}", type));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,6 @@ public async Task Ignore_PublicProperty_ConflictWithPublicDuePolicy()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task Throw_PublicProperty_ConflictDueAttributes()
{
// Serialize
Expand All @@ -354,7 +353,6 @@ await Assert.ThrowsAsync<InvalidOperationException>(
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task Throw_PublicPropertyAndField_ConflictDueAttributes()
{
// Serialize
Expand All @@ -369,7 +367,6 @@ await Assert.ThrowsAsync<InvalidOperationException>(
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task Throw_PublicProperty_ConflictDueAttributes_SingleInheritance()
{
// Serialize
Expand All @@ -393,7 +390,6 @@ await Assert.ThrowsAsync<InvalidOperationException>(
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task Throw_PublicPropertyAndField_ConflictDueAttributes_SingleInheritance()
{
// Serialize
Expand All @@ -417,7 +413,6 @@ await Assert.ThrowsAsync<InvalidOperationException>(
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task Throw_PublicProperty_ConflictDueAttributes_DoubleInheritance()
{
// Serialize
Expand All @@ -442,7 +437,6 @@ await Assert.ThrowsAsync<InvalidOperationException>(
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task Throw_PublicPropertyAndField_ConflictDueAttributes_DoubleInheritance()
{
// Serialize
Expand All @@ -467,7 +461,6 @@ await Assert.ThrowsAsync<InvalidOperationException>(
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task Throw_PublicProperty_ConflictDuePolicy()
{
var options = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
Expand All @@ -484,7 +477,6 @@ await Assert.ThrowsAsync<InvalidOperationException>(
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task Throw_PublicPropertyAndField_ConflictDuePolicy()
{
var options = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
Expand All @@ -501,7 +493,6 @@ await Assert.ThrowsAsync<InvalidOperationException>(
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task Throw_PublicProperty_ConflictDuePolicy_SingleInheritance()
{
var options = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
Expand All @@ -528,7 +519,6 @@ await Assert.ThrowsAsync<InvalidOperationException>(
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task Throw_PublicPropertyAndField_ConflictDuePolicy_SingleInheritance()
{
var options = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
Expand All @@ -555,7 +545,6 @@ await Assert.ThrowsAsync<InvalidOperationException>(
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task Throw_PublicProperty_ConflictDuePolicy_DobuleInheritance()
{
var options = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
Expand Down Expand Up @@ -583,7 +572,6 @@ await Assert.ThrowsAsync<InvalidOperationException>(
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task Throw_PublicPropertyAndField_ConflictDuePolicy_DobuleInheritance()
{
var options = new JsonSerializerOptions { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
Expand Down Expand Up @@ -1150,7 +1138,6 @@ public async Task JsonIgnoreAttribute()
// Needs support for more collections.
[ActiveIssue("https://github.com/dotnet/runtime/issues/53393")]
#endif
[ActiveIssue("https://github.com/dotnet/runtime/issues/71981")]
public async Task JsonIgnoreAttribute_UnsupportedCollection()
{
string json =
Expand Down Expand Up @@ -2426,7 +2413,6 @@ public class ClassWithThingsToIgnore_PerProperty
[Theory]
[InlineData(typeof(ClassWithBadIgnoreAttribute))]
[InlineData(typeof(StructWithBadIgnoreAttribute))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public virtual async Task JsonIgnoreCondition_WhenWritingNull_OnValueType_Fail(Type type)
{
InvalidOperationException ex = await Assert.ThrowsAsync<InvalidOperationException>(async () => await Serializer.DeserializeWrapper("{}", type));
Expand All @@ -2447,7 +2433,6 @@ public virtual async Task JsonIgnoreCondition_WhenWritingNull_OnValueType_Fail(T
[Theory]
[InlineData(typeof(ClassWithBadIgnoreAttribute))]
[InlineData(typeof(StructWithBadIgnoreAttribute))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public virtual async Task JsonIgnoreCondition_WhenWritingNull_OnValueType_Fail_EmptyJson(Type type)
{
InvalidOperationException ex = await Assert.ThrowsAsync<InvalidOperationException>(async () => await Serializer.DeserializeWrapper("", type));
Expand Down Expand Up @@ -2760,7 +2745,6 @@ public async Task JsonIgnoreCondition_Polymorphic()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task SerializationMetadataNotComputedWhenMemberIgnored()
{
string janePayload = @"{""Name"":""Jane Doe""}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,6 @@ public PropertyVisibilityTests_Default()
[InlineData(typeof(ClassWithPrivate_InitOnlyProperty_WithJsonIncludeProperty))]
[InlineData(typeof(ClassWithInternal_InitOnlyProperty_WithJsonIncludeProperty))]
[InlineData(typeof(ClassWithProtected_InitOnlyProperty_WithJsonIncludeProperty))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public override async Task NonPublicProperty_WithJsonInclude_Invalid(Type type)
{
// Exception messages direct users to use JsonSourceGenerationMode.Metadata to see a more detailed error.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ public void DeserializeInvalidType(Type type)

[Theory]
[MemberData(nameof(TypesWithInvalidMembers_WithMembers))]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task TypeWithInvalidMember(Type classType, Type invalidMemberType, string invalidMemberName)
{
static void ValidateException(InvalidOperationException ex, Type classType, Type invalidMemberType, string invalidMemberName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public async Task JsonNullNameAttribute()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/runtime/issues/71838", typeof(PlatformDetection), nameof(PlatformDetection.IsBrowser), nameof(PlatformDetection.IsMonoAOT))]
public async Task JsonNameConflictOnCaseInsensitiveFail()
{
string json = @"{""myInt"":1,""MyInt"":2}";
Expand Down
6 changes: 6 additions & 0 deletions src/mono/mono/mini/interp/interp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2126,6 +2126,12 @@ interp_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject
* This can happen on wasm where native frames cannot be skipped during EH.
* EH processing will continue when control returns to the interpreter.
*/
g_assert (context->exc_gchandle);
MonoObject *ex_obj = mono_gchandle_get_target_internal (context->exc_gchandle);
if (exc)
*exc = ex_obj;
else
mono_error_set_exception_instance (error, (MonoException*)ex_obj);
return NULL;
}
// The return value is at the bottom of the stack
Expand Down

0 comments on commit 66ce574

Please sign in to comment.