Hey, got an exception on execute_code when the compiler resolves to codedom. Looks like a Windows command-line length limit issue
Env
Windows 10/11
Unity 2022.3.62f2
MCP for Unity 9.6.9-beta.8 (embedded under Packages/)
Project has a lot of asmdefs (~100+ assemblies)
Microsoft.CodeAnalysis not installed, so compiler:"auto" falls back to codedom
execute_code(action="execute", code="return 1+1;", compiler="codedom")
[ExecuteCode] Execution failed: System.SystemException: Error running C:\Program Files\Unity\Hub\Editor\2022.3.62f2\Editor\Data\MonoBleedingEdge\bin\mono.exe: The filename or extension is too long.
at MCPForUnity.Editor.Tools.ExecuteCode.HandleExecute (Newtonsoft.Json.Linq.JObject) (ExecuteCode.cs:115)
CodeDomCompile in Editor/Tools/ExecuteCode.cs builds CompilerParameters with every entry from GetAssemblyPaths() shoved into ReferencedAssemblies.
CSharpCodeProvider.CompileAssemblyFromSource then shells out to mono.exe csc and turns each reference into a /r:<absolute_path> argument inline.
On Windows that hits the CreateProcess 32,767-character limit pretty quickly once you cross ~100 referenced assemblies with long absolute paths
Hey, got an exception on execute_code when the compiler resolves to codedom. Looks like a Windows command-line length limit issue
Env
Windows 10/11
Unity 2022.3.62f2
MCP for Unity 9.6.9-beta.8 (embedded under Packages/)
Project has a lot of asmdefs (~100+ assemblies)
Microsoft.CodeAnalysis not installed, so compiler:"auto" falls back to codedom
execute_code(action="execute", code="return 1+1;", compiler="codedom")
[ExecuteCode] Execution failed: System.SystemException: Error running C:\Program Files\Unity\Hub\Editor\2022.3.62f2\Editor\Data\MonoBleedingEdge\bin\mono.exe: The filename or extension is too long.
at MCPForUnity.Editor.Tools.ExecuteCode.HandleExecute (Newtonsoft.Json.Linq.JObject) (ExecuteCode.cs:115)
CodeDomCompile in Editor/Tools/ExecuteCode.cs builds CompilerParameters with every entry from GetAssemblyPaths() shoved into ReferencedAssemblies.
CSharpCodeProvider.CompileAssemblyFromSource then shells out to mono.exe csc and turns each reference into a /r:<absolute_path> argument inline.
On Windows that hits the CreateProcess 32,767-character limit pretty quickly once you cross ~100 referenced assemblies with long absolute paths