IronLanguages / ironpython2

Implementation of the Python programming language for .NET Framework; built on top of the Dynamic Language Runtime (DLR).

Home Page:http://ironpython.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Invalid" error while loading DLL (0x80131047)

Raijinili opened this issue · comments

I upgraded to IronPython 2.7.11 (x64, .msi installer) from 2.7.8 (x86, .zip), and the following two lines now throw an exception.

>>> import clr
>>> clr.AddReference(r'C:\absolute\path\to\PatcherLib.dll')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: System.IO.FileLoadException: The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047)
   at System.Reflection.AssemblyName.nInit(RuntimeAssembly& assembly, Boolean forIntrospection, Boolean raiseResolveEvent)
   at System.Reflection.AssemblyName..ctor(String assemblyName)
   at System.Reflection.Assembly.LoadWithPartialName(String partialName)
   at IronPython.Runtime.ClrModule.LoadAssemblyByPartialName(String name)
   at IronPython.Runtime.ClrModule.AddReference(CodeContext context, String name)
   at IronPython.Runtime.ClrModule.AddReference(CodeContext context, Object[] references)
   at Microsoft.Scripting.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
   at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)
   at Microsoft.Scripting.Interpreter.FuncCallInstruction`6.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3)
   at IronPython.Compiler.Ast.CallExpression.Invoke1Instruction.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
   at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
   at IronPython.Hosting.PythonCommandLine.<>c__DisplayClass27_0.<RunOneInteraction>b__0()

DLL file: PatcherLib.zip

Full suite, if more of the files are necessary: https://github.com/Glain/FFTPatcher/releases/download/v0.491/FFTPatcher_491.rar

PatcherLib.dll is x86 so you can't load it in 64-bit. Try using ipy32.exe instead.

I suspected that had something to do with it, but didn't realize there was an ipy32.

Can I turn this into a request to change the error message, instead?

Unfortunately I don't think there's much I can do about the error message since it comes from the .NET runtime. In your case it happened to be an x86/x64 issue, but I think the runtime may throw that same error for other reasons.