You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to use the Roslyn compiler but if I use any anonymous objects (eg: "var t = new { test = ""test"" }") I get the below error. Is there a work around for this? This script compiles with Mono but I have other issues with Mono and would prefer not to have to switch compilers based on script all over the place.
Error:
Cannot create an instance of <>f__AnonymousType0#1`1[j__TPar] because Type.ContainsGenericParameters is true.
StackTrace:
at System.RuntimeType.CreateInstanceCheckThis()
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Reflection.Assembly.CreateInstance(String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at CSScriptLibraryExtensionMethods.CreateInstance(Assembly assembly, String typeName, Object[] args)
at CSScriptLibrary.AsmBrowser.createInstance(Assembly asm, String typeName, Object[] args)
at CSScriptLibrary.AsmBrowser.CreateInstance(String typeName, Object[] args)
at CSScriptLibraryExtensionMethods.CreateObject(Assembly obj, String typeName, Object[] args)
at CSScriptLibrary.RoslynEvaluator.LoadCode(String scriptText, Object[] args)
The text was updated successfully, but these errors were encountered:
This is a compiler (e.g. Roslyn) specific issue that is unfortunately impossible to address by scripting infrastructure (CS-Script).
This is not that surprising considering that quite a few normal syntax concepts are illegal in Roslyn scripting implementation. IE "error CS7021: Cannot declare namespace in script code"
Wow ok darn I was hoping there might be some parameter being passed into the compiler that caused this. So Roslyn can't do anonymous types, interesting. Thank you!
I am trying to use the Roslyn compiler but if I use any anonymous objects (eg: "var t = new { test = ""test"" }") I get the below error. Is there a work around for this? This script compiles with Mono but I have other issues with Mono and would prefer not to have to switch compilers based on script all over the place.
Error:
Cannot create an instance of <>f__AnonymousType0#1`1[j__TPar] because Type.ContainsGenericParameters is true.
StackTrace:
at System.RuntimeType.CreateInstanceCheckThis()
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Reflection.Assembly.CreateInstance(String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at CSScriptLibraryExtensionMethods.CreateInstance(Assembly assembly, String typeName, Object[] args)
at CSScriptLibrary.AsmBrowser.createInstance(Assembly asm, String typeName, Object[] args)
at CSScriptLibrary.AsmBrowser.CreateInstance(String typeName, Object[] args)
at CSScriptLibraryExtensionMethods.CreateObject(Assembly obj, String typeName, Object[] args)
at CSScriptLibrary.RoslynEvaluator.LoadCode(String scriptText, Object[] args)
The text was updated successfully, but these errors were encountered: