You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Test assemblies do not compile on Unity 6000.5.8f1 and 6000.7: HotReloadUnsafeFixture uses a pointer type argument outside an unsafe context (CS0214) #3646
On Unity 6000.5.8f1 and the latest 6000.7 beta, the EditMode test run aborts before any test runs ("Scripts have compiler errors"). The only compile error is in a test fixture added by #3564:
Assets/Tests/Editor/HotReloadUnsafeFixture/HotReloadUnsafeFixture.cs(361,35): error CS0214: Pointers and fixed size buffers may only be used in an unsafe context
Line 361 is List<int*[]> values = new List<int*[]>(); in UnsafeFixturePointerTypeArgumentHost.Read(), a method without the unsafe modifier. The fixture's asmdef has allowUnsafeCode: true, but that only permits unsafe contexts; it does not make a method one. The compilers bundled with Unity 2022.3 and 6000.3 accept the line, and the newer one in 6000.5.8f1 / 6000.7 rejects it.
PR checks do not catch it: Compile Check (6000.5.4f1) passes, and the PR workflow does not compile the test assemblies on 6000.5.8f1 or 6000.7.
Expected
The test assemblies compile on every Unity version in the scheduled matrix, and the fixture still covers what #3564 intended: an edited member whose code needs unsafe code is skipped instead of failing the whole file.
Notes
Check what this fixture case is meant to cover before changing it (for example whether the test relies on the method not being marked unsafe), and check the worker's unsafe-code detection against the newer compiler's rule too: if the worker treats a pointer type argument in a non-unsafe method as compilable, a user on 6000.5.8f1 gets a shim that fails to compile.
Unity 6000.5.8f1 and 6000.7.0b2 can be used locally to reproduce.
Activity