Steps to reproduce:
1. Open the attached user's project "3652148x.zip"
2. Switch the Scripting Backend to IL2CPP (Edit > Project Settings > Player > Other Settings)
3. Build the Assets/Repro.unity scene for Windows
4. Launch the built Player
5. If the Player does not show "REPRODUCED", close it and launch it again
Actual result: Attribute.IsDefined throws "ArgumentException: Type passed in must be derived from System.Attribute or System.Attribute itself." for a type that derives from System.Attribute
Expected result: Attribute.IsDefined returns normally without throwing an exception
Reproducible with: 6000.0.0f1, 6000.0.86f1, 6000.3.29f1, 6000.6.9f1, 6000.7.0b10, 7000.0.0a20
Reproducible on: Windows 11
Notes:
-On 7000.0.0a20 the exception message also ends with the type name (e.g. "... System.Attribute itself. RaceGen.A10877"), so the repro script counts it under "UNEXPECTED: other exception(s)" instead of "REPRODUCED". It is the same issue
-Only reproduces in IL2CPP Player builds, does not reproduce in the Editor
-Intermittent: usually reproduces within a few launches. Each launch tests 20,000 new attribute types, and the result is written to Player.log as [RACEX_RESULT]
-Per the user, IL2CPP makes a type's list of parent types (klass>typeHierarchy, in SetupTypeHierarchyLocked, libil2cpp/vm/Class.cpp) visible before it is filled in, so a thread reading it in that gap thinks the type has no parents
-In the user's own project it happens with StackTraceHiddenAttribute