-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Frozen collection tests fail on NativeAOT #78046
Comments
@stephentoub - should the tests be disabled on NativeAOT or this is supposed to work? |
I assume it's xunit itself. We can disable the tests for now until we can come up with an AOT-friendlier pattern that doesn't significantly increase the test complexity (if you have suggestions, happy to hear them). The tests are implemented in a generic base class, e.g. runtime/src/libraries/System.Collections.Immutable/tests/Frozen/FrozenSetTests.cs Line 12 in 6c5a440
which is then derived from to run those tests with specific types/configurations, e.g. runtime/src/libraries/System.Collections.Immutable/tests/Frozen/FrozenSetTests.cs Lines 166 to 186 in 6c5a440
and this particular test is using a MemberData to a specific enumerable method: runtime/src/libraries/System.Collections.Immutable/tests/Frozen/FrozenSetTests.cs Lines 131 to 133 in 6c5a440
|
I think we should disable for now - since it blocks clean CI for NativeAOT libraries tests. |
Yes, we have hit this xunit problem several times. The workaround is to add the dynamically created generic instantiations to .rd.xml. For example: https://github.com/dotnet/runtime/blob/main/src/libraries/System.Drawing.Common/tests/default.rd.xml |
So what are the dynamically instantiated types here? I see: FrozenSet_Generic_Tests<string>
FrozenSet_Generic_Tests<ulong>
FrozenSet_Generic_Tests<int>
FrozenSet_Generic_Tests<SimpleClass> is that all? |
it actually complains about
How that should look in rd.xml format? |
I am trying: <Assembly Name="xunit.core">
<Type Name="Xunit.Sdk.AssertEqualityComparer`1[[System.Collections.Generic.KeyValuePair`2[[System.String, System.Private.CoreLib], [System.String, System.Private.CoreLib]], System.Private.CoreLib]]">
<Method Name="CompareTypedSets" Dynamic="Required All">
<GenericArgument Name="System.Collections.Generic.KeyValuePair`2[[System.String, System.Private.CoreLib], [System.String, System.Private.CoreLib]], System.Private.CoreLib" />
</Method>
</Type>
</Assembly> That gives me an error at compile time: Unhandled exception. Internal.TypeSystem.TypeSystemException+TypeLoadException: Failed to load type ' ' from assembly 'xunit.core, Version=2.4.2.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c' |
This is because of a space after comma (not sure if the one between generic arguments or the assembly name qualifier, but I hit this bug). Delete all spaces after commas. RD.XML is (mis)using the SerString format parser that we have in the compiler. It's not a particularly good parser because it was supposed to be temporary (just like RD.XML), but AFAIK S.R.Metadata didn't deliver a parser that we're waiting for here: runtime/src/coreclr/tools/Common/TypeSystem/Common/Utilities/CustomAttributeTypeNameParser.cs Lines 13 to 15 in fdec920
|
That helped!! It looks like there are some more methods that need rd directives, but now I think, I will just keep adding them until tests start passing. |
Hmm, but the runtime errors do not go away. <Assembly Name="xunit.core">
<Type Name="Xunit.Sdk.AssertEqualityComparer`1[[System.Collections.Generic.HashSet`1[[System.Collections.Generic.KeyValuePair`2[[System.UInt64, System.Private.CoreLib],[System.UInt64, System.Private.CoreLib]],System.Private.CoreLib]],System.Private.CoreLib]]" Dynamic="Required All">
<Method Name="CompareTypedSets" Dynamic="Required All">
<GenericArgument Name="System.Collections.Generic.KeyValuePair`2[[System.UInt64,System.Private.CoreLib],[System.UInt64,System.Private.CoreLib]],System.Private.CoreLib" />
</Method>
</Type>
</Assembly> and that is accepted at compile time, but I still get the following at run time.
|
It looks correct. Did I miss a space or a comma somewhere? What does it want? |
It's possible it's I looked at the stack trace myself and the stack is:
This is my favorite part of xunit where it will just go and to figure out some crazy way to compare the things passed to it. I always wonder if that's the notion of equality the test was really intending. |
Yes the assembly should be |
Failures in #77934
Either the tests should be made compatible with NativeAOT (preferrable, if possible), or disabled in the NativeAOT test runs.
The typical failure looks like:
Something is using
MethodInfo.MakeGenericMethod()
and it is not an AOT-friendly pattern.Report
Summary
The text was updated successfully, but these errors were encountered: