Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,13 @@ public async Task Number_AsCollectionElement_RoundTrip()
await RunAsCollectionElementTest(JsonNumberTestData.NullableDoubles);
await RunAsCollectionElementTest(JsonNumberTestData.NullableDecimals);
#if NET
await RunAsCollectionElementTest(JsonNumberTestData.NullableInt128s);
await RunAsCollectionElementTest(JsonNumberTestData.NullableUInt128s);
await RunAsCollectionElementTest(JsonNumberTestData.NullableHalfs);
// https://github.com/dotnet/runtime/issues/119143
if (!PlatformDetection.IsBrowser)
{
await RunAsCollectionElementTest(JsonNumberTestData.NullableInt128s);
await RunAsCollectionElementTest(JsonNumberTestData.NullableUInt128s);
await RunAsCollectionElementTest(JsonNumberTestData.NullableHalfs);
}
#endif
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
<assembly fullname="System.Private.CoreLib" />
<assembly fullname="System.Reflection" />
<assembly fullname="System.Collections" />
<assembly fullname="System.Collections.Immutable" />
<assembly fullname="System.Collections.NonGeneric" />
<assembly fullname="System.Runtime.Serialization" />
<assembly fullname="System.Runtime.Serialization.Json" />
<assembly fullname="System.Text.Json" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

<PropertyGroup Condition="'$(TargetOS)' == 'browser'">
<WasmXHarnessMaxParallelThreads>1</WasmXHarnessMaxParallelThreads>
<XunitShowProgress>true</XunitShowProgress>
</PropertyGroup>

<ItemGroup Condition="'$(ContinuousIntegrationBuild)' == 'true'">
Expand Down
17 changes: 17 additions & 0 deletions src/mono/mono/metadata/class-accessors.c
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,23 @@ mono_class_set_failure (MonoClass *klass, MonoErrorBoxed *boxed_error)
return TRUE;
}

/**
* mono_class_set_skip_generic_constraints:
* \param klass class that should not validate generic constraints
*
* LOCKING: Acquires the loader lock.
*/
void
mono_class_set_skip_generic_constraints (MonoClass *klass)
{
if (klass->skip_generic_constraints)
return;

mono_loader_lock ();
klass->skip_generic_constraints = 1;
mono_loader_unlock ();
}

/**
* mono_class_set_deferred_failure:
* \param klass class in which the failure was detected
Expand Down
12 changes: 7 additions & 5 deletions src/mono/mono/metadata/class-init.c
Original file line number Diff line number Diff line change
Expand Up @@ -2613,10 +2613,12 @@ mono_class_layout_fields (MonoClass *klass, int base_instance_size, int packing_
case MONO_TYPE_TYPEDBYREF:
case MONO_TYPE_VALUETYPE:
case MONO_TYPE_GENERICINST:
field_class = mono_class_from_mono_type_internal (field->type);
if (mono_class_is_ginst (field_class) && !mono_verifier_class_is_valid_generic_instantiation (field_class)) {
mono_class_set_type_load_failure (klass, "Field '%s' is an invalid generic instantiation of type %s", field->name, mono_type_get_full_name (field_class));
return;
if (!klass->skip_generic_constraints) {
field_class = mono_class_from_mono_type_internal (field->type);
if (mono_class_is_ginst (field_class) && !mono_verifier_class_is_valid_generic_instantiation (field_class)) {
mono_class_set_type_load_failure (klass, "Field '%s' is an invalid generic instantiation of type %s", field->name, mono_type_get_full_name (field_class));
return;
}
}
break;
default:
Expand Down Expand Up @@ -3202,7 +3204,7 @@ mono_class_init_internal (MonoClass *klass)

mono_class_setup_interface_offsets_internal (klass, first_iface_slot, MONO_SETUP_ITF_OFFSETS_OVERWRITE);

if (mono_class_is_ginst (klass) && !mono_verifier_class_is_valid_generic_instantiation (klass))
if (!klass->skip_generic_constraints && mono_class_is_ginst (klass) && !mono_verifier_class_is_valid_generic_instantiation (klass))
mono_class_set_type_load_failure (klass, "Invalid generic instantiation");

goto leave;
Expand Down
3 changes: 3 additions & 0 deletions src/mono/mono/metadata/class-internals.h
Original file line number Diff line number Diff line change
Expand Up @@ -1418,6 +1418,9 @@ mono_class_find_enum_basetype (MonoClass *klass, MonoError *error);
gboolean
mono_class_set_failure (MonoClass *klass, MonoErrorBoxed *boxed_error);

void
mono_class_set_skip_generic_constraints (MonoClass *klass);

void
mono_class_set_deferred_failure (MonoClass *klass);

Expand Down
1 change: 1 addition & 0 deletions src/mono/mono/metadata/class-private-definition.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ struct _MonoClass {
/* next byte*/
guint is_exception_class : 1; /* is System.Exception or derived from it */
guint variant_search_table_inited : 1;
guint skip_generic_constraints : 1; /* type created for AOT wrapper methods, which don't need to comply with generic constraints */

MonoClass *parent;
MonoClass *nested_in;
Expand Down
4 changes: 3 additions & 1 deletion src/mono/mono/mini/mini-generic-sharing.c
Original file line number Diff line number Diff line change
Expand Up @@ -1321,7 +1321,7 @@ get_wrapper_shared_vtype (MonoType *t)
}

/*
* get_wrapper_shared_type:
* get_wrapper_shared_type_full:
*
* Return a type which is handled identically wrt to calling conventions as T.
*/
Expand Down Expand Up @@ -1415,6 +1415,8 @@ get_wrapper_shared_type_full (MonoType *t, gboolean is_field)
mono_error_assert_ok (error); /* FIXME don't swallow the error */
g_assert (klass);

mono_class_set_skip_generic_constraints (klass);

t = m_class_get_byval_arg (klass);
MonoType *shared_type = get_wrapper_shared_vtype (t);
if (shared_type)
Expand Down
Loading