Closed tbarela closed 6 years ago
Can you come up with a simple repro case for this?
If I go into booish
and say:
import Boo.Lang.Compiler
x = BooCompiler()
y = BooCompiler()
it doesn't raise any errors, so that means there's more complexity involved.
Hi Mason,
Thanks for the quick reply, but I couldn't find time to dig into this much deeper until now. I'm not sure the cause, really. I've been building this within an existing plugin system for a game server. In this particular context, CompilerParameters.LoadDefaultReferences() will only work a single time. Any further calls result in the above mentioned error. Outside of this project, I have no such issues...
In case this does help someone seeing similar, I've been able to work around it by creating my own CompilerParameters instance, and passing it in to the matching BooCompiler constructor overload. And making sure not to call LoadDefaultReferences().
Simple enough in retrospect, but wasn't obvious at the time.
Hi,
Not 100% sure this is a bug, and not some obscure thing I'm missing. But I've run into this multiple times now. Right now its reared its ugly head again.
This is a fairly recent version of boo(7d2eca2e0ad8fc0869c7a4b4c58e6128c9ed93b1) . Made some hacky changes to get it to build on my system, but otherwise did not change anything.,
If I create a BooCompiler instance, and then later create another one, the second one will fail with System.ApplicationException: Cannot find assembly: 'System'
Stack trace: at Boo.Lang.Compiler.CompilerParameters.LoadAssemblyFromLibPaths(String assembly, Boolean throwOnError) at Boo.Lang.Compiler.CompilerParameters.ForName(String assembly, Boolean throwOnError) at Boo.Lang.Compiler.CompilerParameters.LoadAssembly(String assemblyName, Boolean throwOnError) at Boo.Lang.Compiler.CompilerParameters.LoadDefaultReferences() at Boo.Lang.Compiler.CompilerParameters..ctor(IReflectionTypeSystemProvider reflectionProvider, Boolean loadDefaultReferences) at Boo.Lang.Compiler.CompilerParameters..ctor(Boolean loadDefaultReferences) at Boo.Lang.Compiler.CompilerParameters..ctor() at Boo.Lang.Compiler.BooCompiler..ctor() at CustomNpcs.BooScriptCompiler..ctor() at CustomNpcs.BooScriptCompiler..cctor()
Before it gets asked, the reason I am creating multiple compilers here is because they both serve fairly different purposes within the project. One for user defined scripts, and the other should process a tiny DSL for loading data.
I suppose I can cache a single compiler, and reconfigure it for each use( which will be ugly ), but wondering if there is something I'm missing here. Shouldn't this just work?