`NullReferenceException` with 3.0.0rc4
See original GitHub issueEnvironment
- Pythonnet version: 3.0.0rc4
- Python version: 3.9.13
- Operating System: Windows 11
- .NET Runtime: 4.8 (?)
Details
I am importing the DLL’s for PLEXOS, a power system application compiled with .NET, to perform analysis on the simulation outputs, and I have built a wrapper around the .NET methods (see here for examples from the developers) to streamline the interaction. My use case is to use the API to extract data from a PLEXOS Solution File (a .zip with a bunch of binary files).
I’ve been trying to keep up with pythonnet updates and spend some time earlier in the year using alpha-2 which I was able to get working with minor updates. While I typically try to avoid alphas the latest PLEXOS versions are being compiled with .NET 6 and I wasn’t having luck with 2.5.2
; however, for compatibility they have also been providing the DLLs compiled with .NET 4.8 which is what I’m using here. (NOTE: I have since figured out that we’re running into https://github.com/pythonnet/clr-loader/issues/20 with the .NET 6 DLLs).
I’ve had a few spare cycles this week so I’ve been making updates to different tools including the wrapper mentioned above. One of these changes is updating from a2 to rc4, with the goal of bumping to the release when it is available. Unfortunately, I am running into some issues when trying to call the .NET methods and have been able to isolate that the code works with a2 and does not work with rc4.
With rc4 I am getting the following error:
Exception has occurred: NullReferenceException
Object reference not set to an instance of an object.
at PLEXOS_NET.Core.Solution.QueryToCSV(String strCSVFile, Boolean bAppendToFile, SimulationPhaseEnum SimulationPhaseId, CollectionEnum CollectionId, String ParentName, String ChildName, PeriodEnum PeriodTypeId, SeriesTypeEnum SeriesTypeId, String PropertyList, Object DateFrom, Object DateTo, String TimesliceList, String SampleList, String ModelName, AggregationEnum AggregationType, String Category, String Separator)
I suspect the issue is with the enumerations. However, I know data of the right types is being passed to the function since if I change any of the input arguments (e.g. SimulationPhaseId
as a string) I will get a TypeError
and a message that “No method matches given argument.”
Looking for some direction on what to debug next and appreciate any insights!
Issue Analytics
- State:
- Created a year ago
- Comments:6 (4 by maintainers)
Top GitHub Comments
I’ll close this one for now, as there is nothing “actionable” from our side. I would suggest that you open a bug report on the vendor’s Github and just reference me in it. Since their API is apparently .NET Core nowadays, they could really profit from having this work.
I should have noted, everything I’m doing is from python and I’m working in VS Code. .NET is not my specialty, so I’ll need some help on that debugging step. I took a look through some of the documentation on the wiki and it didn’t look like it was relevant, requiring Visual Studio proper. Can you help point me in the right direction?