cancel
Showing results for 
Search instead for 
Did you mean: 

Failed to Load image in NX9 C#.NET App

Pioneer
Pioneer

Hi,  I have developed C# .net tool in VS 2012 with .Net Framework 4.0 for NX9.  I set 'Any CPU' in Configuration manager. The tool works in many computers I tested. But in only one computer, it fails. It says "Failed to load image". I used to see this message in NX7.5 with .NET framework 2.0. Once We adjust the 'Security' settings, this error will go away.

 

For NX9, there is no need to adjust this security settings.  Then what else is makine this error?

 

This is the error msg.  What dependency file its looking for?

 

The reason D:\Programs\APPS\xxxxxx.dll failed to load was:
Could not load file or assembly 'file:///c:\ug\NX9\ugii\managed\ManagedLoader.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
&MACRO FOCUS CHANGE OUT 1
&MACRO FOCUS CHANGE OUT 1
&MACRO FOCUS CHANGE IN 1
&MACRO MESSAGE_BOX  -2  Failed to load image - see log file for details
&MACRO MESSAGE_TEXT  
&MACRO MESSAGE_TEXT  File name: D:\Programs\APPS\xxxxxx.dll
&MACRO MESSAGE_TEXT  
&MACRO MESSAGE_TEXT  Function name: Main
&MACRO MESSAGE_TEXT  
&MACRO MENU, 0, UG_HELP_SYSTEM_LOG UG_GATEWAY_MAIN_MENUBAR <MenuBar->UG_HELP> ## ! 

 

Any help?

 

Thanks

 

6 REPLIES

Re: Failed to Load image in NX9 C#.NET App

Honored Contributor
Honored Contributor

Make sure that computer has the proper .NET framework version installed.

Re: Failed to Load image in NX9 C#.NET App

Pioneer
Pioneer

Yes. It has .NET framework 4.0 

Re: Failed to Load image in NX9 C#.NET App

Siemens Phenom Siemens Phenom
Siemens Phenom

 

Check the Properties on the ...ugii\managed folder, or you might need to check the Properties on each of the files in that folder.  On the General tab, is there a warning at the bottom that says the file was downloaded from the internet, and has been blocked to keep you safe?  If so, Unblock it with the button and then restart NX.

 

 

Re: Failed to Load image in NX9 C#.NET App

Honored Contributor
Honored Contributor

Rather than using "any CPU", you might want to use "x64". See the following thread:

http://community.plm.automation.siemens.com/t5/NX-Programming-Customization/NX-Open-Run-exe-program-...

Re: Failed to Load image in NX9 C#.NET App

Siemens Phenom Siemens Phenom
Siemens Phenom

 

I don't think that this is a 32/64 issue, because the error mentioned here is not "cannot classify image", as mentioned in that link.   The "cannot load ...ManagedLoader.dll or one of its dependencies" is different, and sometimes it is quite difficult to track down.

 

But we have had more than one occurrence reported with that exact error, that were fixed by unblocking the files.  Here is an interesting link:

 

http://www.howtogeek.com/70012/what-causes-the-file-downloaded-from-the-internet-warning-and-how-can...

 

Re: Failed to Load image in NX9 C#.NET App

Honored Contributor
Honored Contributor

My apologies, I used the forum search to find "failed to load image" and that was one thread that came up. It seemed relevant since the code in question used the "any CPU" option and the other thread suggested using the "x64" option.

 

Thanks for the link, that is good info to know.