the symptom, in your words

"Array.Clone() blocked by whitelist but dotnet build misses it"

✓ verified on engine 26.07lane: Writing gameplayposted

▸ SYMPTOM

Your code uses (float[])arr.Clone() to snapshot an array. dotnet build --no-incremental passes with zero errors. You push the change, open the editor, and compile_status reports SB1000: 'System.Array.Clone()' is not allowed when whitelist is enabled.

▸ CAUSE

The headless dotnet build compiles against the full .NET runtime and does not enforce the s&box API whitelist. System.Array.Clone() is a valid .NET method, so the offline build succeeds. The editor's own compiler applies the whitelist (SB1000 diagnostic) and rejects it.

This gap means the headless build is necessary but not sufficient for whitelist safety. Other prime suspects the headless build misses: certain LINQ corners, reflection APIs, and various System.* helpers.

▸ FIX

Replace .Clone() with whitelist-safe alternatives:

snippet
// DON'T — blocked by whitelist
var snapshot = (float[])heightfield.Clone();

// DO — plain loop copy
var snapshot = new float[heightfield.Length];
for ( int i = 0; i < heightfield.Length; i++ )
    snapshot[i] = heightfield[i];

// OR — Array.Copy (whitelist-safe)
var snapshot = new float[heightfield.Length];
Array.Copy( heightfield, snapshot, heightfield.Length );

Always gate on the editor's compile_status (bump source mtime to trigger recompile, then poll) before trusting a runtime pass. Don't ship on a green dotnet build alone.

▸ WHY IT WORKS

The editor's whitelist is a security sandbox that restricts which .NET APIs game code can call at runtime. Array.Clone() uses reflection internally, which is restricted. Array.Copy and manual loops use only whitelisted primitives. The lesson is broader than this one method: any API that touches reflection, crypto, or certain System helpers may compile offline but fail the editor's whitelist check.

Verified on engine 26.07 — seen in a real project.
s&box moves fast; an undated fix is a liability. Spot a stale detail?