-
Notifications
You must be signed in to change notification settings - Fork 748
Python.Runtime fails on .NET 4.5 and up #3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I just got the ok from the original maintainers that this github repo is now the new official home for this project. That means we are taking fixes etc. Mostly we need help, though. I started this push to github because I need a working version of this project, but I am myself not very familiar with the codebase. So, any help from your side would be greatly appreciated! |
Great news! I'm in similar position. I need working version of this project for https://github.com/fsprojects/FSharp.Interop.PythonProvider. And I'm not familiar with code base at all. I will try to help us much as I can. I'm little swamped with my open source work. |
…mments-2 Soft shutdown review comments 2
Currently library fails on .NET 4.5. I know that 4.5 is not technically supported but the issue very painful because .NET 4.5 is update in place which overrides CLR. So, having it installed I don't really have an option to run it on ver 4.
When I try to run an application that uses Python for .NET i get exception
System.ArgumentNullException was unhandled
HResult=-2147467261
Message=Value cannot be null.
Parameter name: key
Source=mscorlib
ParamName=key
StackTrace:
at System.Collections.Generic.Dictionary
2.FindEntry(TKey key) at System.Collections.Generic.Dictionary
2.TryGetValue(TKey key, TValue& value)at Python.Runtime.GenericUtil.Register(Type t) in D:\Users\Barton\Documents\Visual Studio 2010\Projects\PySharp\trunk\pythonnet\src\runtime\genericutil.cs:line 41
at Python.Runtime.AssemblyManager.ScanAssembly(Assembly assembly) in D:\Users\Barton\Documents\Visual Studio 2010\Projects\PySharp\trunk\pythonnet\src\runtime\assemblymanager.cs:line 266
at Python.Runtime.AssemblyManager.Initialize() in D:\Users\Barton\Documents\Visual Studio 2010\Projects\PySharp\trunk\pythonnet\src\runtime\assemblymanager.cs:line 60
at Python.Runtime.Runtime.Initialize() in D:\Users\Barton\Documents\Visual Studio 2010\Projects\PySharp\trunk\pythonnet\src\runtime\runtime.cs:line 166
at Python.Runtime.PythonEngine.Initialize() in D:\Users\Barton\Documents\Visual Studio 2010\Projects\PySharp\trunk\pythonnet\src\runtime\pythonengine.cs:line 118
at Program.Program.main(String[] _arg1) in C:\Users\mitekm\Documents\Visual Studio 2013\Projects\TryPythonForNet\TryPythonForNet\Program.fs:line 54
InnerException:
I did some extra investigation. What happens is that this line of code fails
https://github.com/pythonnet/pythonnet/blob/develop/pythonnet/src/runtime/genericutil.cs#L41
because Namespace property is null on generic type EmptyArray`1 introduced in .NET 4.5. This type located in root namespace therefore Namespace property value is null.
I made quick fix on
https://github.com/pythonnet/pythonnet/blob/develop/pythonnet/src/runtime/assemblymanager.cs#L286
to replace
if (t.IsGenericTypeDefinition) {
GenericUtil.Register(t);
}
with
if (t.IsGenericTypeDefinition && t.IsPublic) {
GenericUtil.Register(t);
}
Honestly, I don't understand why the Python.Runtime process non-public type.
It worked on .NET 4 because this type EmptyArray'1 didn't exist there. As a matter of fact there were no generic types in root namespace.
Do you plan to start taking pull requests soon?
Thanks, Dmitry
The text was updated successfully, but these errors were encountered: