| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Environment
Details
I am trying to use pythonnet package in a VSIX Visual Studio extension.
try
{
Runtime.PythonDLL = pythonFile.FullName;
PythonEngine.PythonHome = pythonFile.DirectoryName!;
OutputWindowHelper.LogInfo("PythonEngine", "Initializing Python engine.");
PythonEngine.Initialize(); // crash here
PythonEngine.BeginAllowThreads();
}
catch (Exception ex)
{
OutputWindowHelper.LogError(ex);
}
[INFO] - PythonEngine: Initializing Python engine. [ERROR]: Object reference not set to an instance of an object. [TRACE]: at Python.Runtime.ClassManager.GetClassInfo(Type type, ClassBase impl) at Python.Runtime.ClassManager.InitClassBase(Type type, ClassBase impl, ReflectedClrType pyType) at Python.Runtime.ReflectedClrType.GetOrCreate(Type type) at Python.Runtime.ModuleObject.GetAttribute(String name, Boolean guess) at Python.Runtime.ModuleObject.LoadNames() at Python.Runtime.ImportHook.UpdateCLRModuleDict() at Python.Runtime.PythonEngine.Initialize(IEnumerable`1 args, Boolean setSysArgv, Boolean initSigs) at Python.Runtime.PythonEngine.Initialize() at cpGames.VSA.ToolAPI.<InitializePythonEngineAsync>d__2.MoveNext() in ToolAPI.cs:line 69 // PythonEngine.Initialize(); call |
|
Why you close my issue? Here's your fix: internal static bool ShouldBindEvent(EventInfo ei)
{
var mb = ei.GetAddMethod(true);
if (mb == null)
{
return false;
}
return ShouldBindMethod(mb);
}
Check your nulls, thank me later. |
|
Hello , I have the same issue, I am trying to use pythonnet package in a VSIX Visual Studio extension. I am going to apply this fix above made by @cpgames and see if the problem persists. Do you intend to release this fix in a future version of pythonnet ? Regards, |
| Back | FazBrowse Home | New Git URL |
Why you close my issue?
Here's your fix:
internal static bool ShouldBindEvent(EventInfo ei) { var mb = ei.GetAddMethod(true); if (mb == null) { return false; } return ShouldBindMethod(mb); }Check your nulls, thank me later.