Barmaley2015 / open-hardware-monitor

Automatically exported from code.google.com/p/open-hardware-monitor
0 stars 0 forks source link

Object reference is NULL exception thrown when calling OpenHardwareMonitorLib.dll from an unmanaged application #612

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What is the expected output? What do you see instead?
When calling the Computer.Open() through COM from an unamanaged application 
(from NI LabVIEW for example) an Object reference is NULL exception is thrown. 
When calling the same code from a .NET application it works fine. 

What version of the product are you using? On what operating system?
SVN rev 424. Windows 7 64b bit. 

Please provide any additional information below:
The Ring0 GetTempFileName method uses the Assembly.GetEntryAssembly().Location 
for generating a log file path. The Assembly.GetEntryAssembly will return with 
NULL when called from an unmanaged application. See the remarks section here: 
http://msdn.microsoft.com/en-us/library/system.reflection.assembly.getentryassem
bly%28v=vs.110%29.aspx

I do not know what is the rationale behind creating a temporaly file next to 
the application with a sys extension, but I would recommend to remove the 
Ring0::GetTempFileName function totally and use the Path.GetTempFileName() 
insteda of that. 

I can create a patch if you agree with the method above. 

Original issue reported on code.google.com by martonmi...@gmail.com on 25 Jul 2014 at 6:59

GoogleCodeExporter commented 9 years ago
Patch attached.

Original comment by martonmi...@gmail.com on 14 Aug 2014 at 7:32

Attachments: