As per the subject, I find that the rename to Rhino 7.app apparently breaks something with the csharp compiler, and with it my plugin, which compiles various types at runtime. Here’s a test command:
public class TestCsharpCompiler : Rhino.Commands.Command
{
public override string EnglishName => typeof(TestCsharpCompiler).Name;
protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
try
{
var code = @"
using System;
class TestClass
{
static void Main(string[] args)
{
Console.WriteLine(args.Length);
}
}";
var cp = new CompilerParameters();
cp.GenerateInMemory = true;
cp.GenerateExecutable = false;
var cscp = new CSharpCodeProvider();
var res = cscp.CompileAssemblyFromSource(cp, code);
if (res.CompiledAssembly == null)
throw new Exception("Compiler succeeded but compiled assembly is null.");
RhinoApp.WriteLine("C# compiler test OK.");
return Result.Success;
}
catch(Exception ex)
{
RhinoApp.WriteLine("C# compiler test failed: {0}", ex.Message);
return Result.Success;
}
}
}
If you run this in Rhino 7.app you should find that it prints this:
Command: TestCsharpCompiler
C# compiler test failed: Compiler failed to produce the assembly. Output: '/Applications/Rhino 7.app/Contents/Frameworks/RhCore.framework/Versions/Current/Frameworks/Mono64Rhino.framework/Versions/6.10.0/Resources/bin/mcs /target:library /debug- /optimize+ /out:"/var/folders/0x/7rmxmrc95hb5v8cxk25mq1p80000gn/T/s5qd0gml.dll" /noconfig -- "/var/folders/0x/7rmxmrc95hb5v8cxk25mq1p80000gn/T/s5qd0gml.0.cs"
/Applications/Rhino 7.app/Contents/Frameworks/RhCore.framework/Versions/Current/Frameworks/Mono64Rhino.framework/Versions/6.10.0/Resources/bin/mcs: line 3: /Applications/Rhino: No such file or directory
/Applications/Rhino 7.app/Contents/Frameworks/RhCore.framework/Versions/Current/Frameworks/Mono64Rhino.framework/Versions/6.10.0/Resources/bin/mcs: line 3: exec: /Applications/Rhino: cannot execute: No such file or directory
And if you then re-run it after renaming Rhino to Rhino7.app (i.e. removing the space), you should get this output:
Command: TestCsharpCompiler
C# compiler test OK.
In looking into this I found something interesting, when I cd into the mcs directory and execute “mcs” I get the compiler complaining about no input files, but if I execute it as “./mcs” I reproduce the same two errors complaining about file not found. So I guess that makes it seem unlikely there’s any way around it from within plugin code, or I guess, even from within Rhino code.