Hi
Was there ever a solution to this problem? I'm getting the same thing,
though not with NUnit. To port my IP interface from 1.1 to 2.0 (beta 1),
I created a separate test application, which worked fine. However I'm
merging the code into my "real" application, but I'm not able to create
a ScriptEngine.
_runtime = ScriptRuntime.Create();
string[] languages = _runtime.GetRegisteredLanguageIdentifiers(); //
finds 18 languages, including "py"
_engine = _runtime.GetEngine("py"); // <--- throws an exception
Microsoft.Scripting.Runtime.InvalidImplementationException was unhandled
Message="Type 'IronPython.Runtime.PythonContext' doesn't provide a
suitable public constructor or its implementation is faulty."
Source="Microsoft.Scripting"
StackTrace:
at
Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type
actualType, Object[] args)
at
Microsoft.Scripting.Runtime.ScriptDomainManager.LanguageRegistration.LoadLanguageContext(ScriptDomainManager
manager)
at
Microsoft.Scripting.Runtime.ScriptDomainManager.TryGetLanguageContext(String
languageId, LanguageContext& languageContext)
at Microsoft.Scripting.Hosting.ScriptRuntime.TryGetEngine(String
languageId, ScriptEngine& engine)
at Microsoft.Scripting.Hosting.ScriptRuntime.GetEngine(String
languageId)
at Utilities.OSEPython..ctor(FileStream log) in
C:\Projects\Utils\PythonEngine.cs:line 121
at Utilities.PythonFactory.Create(Boolean log) in
C:\Projects\Utils\PythonEngine.cs:line 70
...
Not sure if it's important, but the application uses a few assemblies,
and the IP wrapper classes are in a separate assembly to where they are
used.
Thanks, Paul
Fernando Correia wrote:
2008/3/12, Dino Viehland <[EMAIL PROTECTED]>:
There's an inner exception here (probably from Importer.cs in MakeImportSite)
but there isn't much info on it. Could you run it under a debugger and get
that original stack trace? It's not clear to me why we would blow up there.
Thanks for your help.
Sorry for some text in Portuguese below. I hope it doesn't get in the way.
The exception occurs within class ReflectionUtils, method CreateInstance<T>.
Line 127 is:
return (T)Activator.CreateInstance(actualType, args);
This in turns ends up calling the constructor public
PythonContext(ScriptDomainManager/*!*/ manager) in class
PythonContext.
Line 120 is:
_importer = new Importer(this);
A step into this line will cause the exception.
The stack trace of the innermost exception
([System.InvalidProgramException] = {"Common Language Runtime detectou
um programa inválido."}) is:
em
Microsoft.Scripting.RuntimeHelpers.CreateSimpleCallSite[T0,T1,T2,T3,T4,R]()
em IronPython.Runtime.Importer.MakeImportSite() na
C:\Temp\IronPython v2.0 Alpha
8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\IronPython\Runtime\Importer.cs:linha
74
em IronPython.Runtime.Importer..cctor() na C:\Temp\IronPython v2.0
Alpha
8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\IronPython\Runtime\Importer.cs:linha
49
The stack trace of the outermost exception (base
{System.ApplicationException} = {"Uma exceção foi acionada pelo
destino de uma chamada."}) is:
em System.RuntimeMethodHandle._InvokeConstructor(Object[] args,
SignatureStruct& signature, IntPtr declaringType)
em System.RuntimeMethodHandle.InvokeConstructor(Object[] args,
SignatureStruct signature, RuntimeTypeHandle declaringType)
em System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags
invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
em System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr,
Binder binder, Object[] args, CultureInfo culture, Object[]
activationAttributes)
em System.Activator.CreateInstance(Type type, BindingFlags
bindingAttr, Binder binder, Object[] args, CultureInfo culture,
Object[] activationAttributes)
em System.Activator.CreateInstance(Type type, Object[] args)
em Microsoft.Scripting.Utils.ReflectionUtils.CreateInstance[T](Type
actualType, Object[] args) na C:\Temp\IronPython v2.0 Alpha
8\IronPython-2.0A8-Src\IronPython-2.0A8\Src\Microsoft.Scripting\Utils\ReflectionUtils.cs:linha
127
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com