"FileSystem is ambiguous in editor assemblies — CS0104 between Editor.FileSystem and Sandbox.FileSystem"
▸ SYMPTOM
Code like FileSystem.Data.FileExists(path) compiles fine in the game Code assembly but fails in the editor (.editor.csproj) assembly with:
CS0104: 'FileSystem' is an ambiguous reference between 'Editor.FileSystem' and 'Sandbox.FileSystem'▸ CAUSE
The game assembly only sees Sandbox.FileSystem (via global using Sandbox). The editor assembly additionally imports the Editor namespace globally, which ships its own FileSystem type. The unqualified name matches both, producing the ambiguity.
Same clash class as Editor.Project vs Sandbox.Project and other types that exist in both namespaces.
▸ FIX
Fully-qualify Sandbox.FileSystem in editor code:
// In editor assembly — won't compile without the qualifier
Sandbox.FileSystem.Data.FileExists(path);
Sandbox.FileSystem.Data.ReadAllText(path);This is caught at compile time by both dotnet build Editor/<proj>.editor.csproj and the in-editor compiler — not a runtime trap.
▸ WHY IT WORKS
The explicit namespace removes the ambiguity. The global using directives that import both Sandbox and Editor namespaces are part of the s&box project convention — they can't be removed without breaking other things. Qualifying the specific type is the standard C# resolution for CS0104.