runtime\src\tests\tracing\common\TraceConfiguration.cs tries to call
a constructor of using type System.Diagnostics.Tracing.EventPipeSerializationFormat
with a different (but compatbile) enum type using reflection. Both enums
are of underlying type, Int32, but the call fails on Mono since it fails
to recognize that the two enums are compatible in CheckValue.
Fix will make sure call to IsConvertibleToPrimitiveType uses underlying
type as target type when checking if current value is convertible to a
compatible value.
Type? type = Enum.GetUnderlyingType(this);
if (type == value.GetType())
return value;
- object? res = IsConvertibleToPrimitiveType(value, this);
+ object? res = IsConvertibleToPrimitiveType(value, type);
if (res != null)
return res;
}