LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Wrong version of NET assembly System.Windows.Forms

Solved!
Go to solution

Dear all,

I am trying to use a .NET assembly provided by Thorlabs which can be used to control one of their cameras. However, when I load the example vi, I am getting this warning:

 - Expected Assembly "System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", but found "System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089."

And when I run the VI, it returns error 1172.

 

A few things I already found out:

- LabVIEW is using .NET v4.0.30319 by default. I tried to force it to v2.0.50727 using this KB: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000kG83SAE (v2.0.50727 is present on the PC in C:\Windows\Microsoft.NET\Framework). Didn't solve the problem.

- I also tried the workaround as described in the labVIEW help: http://zone.ni.com/reference/en-XX/help/371361M-01/lvhowto/configuring_clr_version/ . Didn't help. It seems strange to me that version 4 is referenced in that config file, is that correct?

- I found that Systems.Windows.Forms.dll is located in C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Windows.Forms\v4.0_4.0.0.0__b77a5c561934e089. I created a folder v2.0_2.0.0.0__b77a5c561934e089 in C:\Windows\Microsoft.NET\assembly\GAC_MSIL\System.Windows.Forms and copied Systems.Windows.Forms.dll into it from C:\Windows\Microsoft.NET\Framework\v2.0.50727. Didn't help.

- I am admin on the PC, it's Windows 7, LabVIEW 2014 32 bit.

- The Thorcam application installer doesn't allow you to install the 32 bit version on a 64 bit machine, but the 64 bit version includes examples and dll's for 32 bit;

Capture.JPG

 

Has anyone seen this before? Is there a solution?

 

Kind regards,

Joszz

0 Kudos
Message 1 of 6
(5,203 Views)

What does ThorLabs say?

 

Bob Schor

0 Kudos
Message 2 of 6
(5,171 Views)

"Error 1172" isn't terribly helpful because it's the error literally every .NET node throws for any problem.  Can you supply the exact error text that comes along with it?  It will be a lot more helpful.

 

I haven't used Thorlabs camera drivers in LabVIEW, but I have used their .NET motion control drivers and they have had issues with DLL #1 calling DLL #2 but the application can't find it in memory because of some of the interesting rules about how .NET finds things on disk, and there's a chance the error text will point to something like that.

0 Kudos
Message 3 of 6
(5,167 Views)

Thanks for the response all! I am also reaching out to Thorlabs to see what they can do.

When loading the VI, I get the warning as displayed in the first post. The run time error is as below:

 

 

Error 1172 occurred at Invoke Node Error calling method uc480.Information.ToString, (System.ArgumentNullException: Key cannot be null.
Parameter name: key)

Possible reason(s):

LabVIEW:  A .NET exception occurred in an external assembly. For information about correcting this error, copy the following exception (in bold), and search the Microsoft Developer Network (MSDN) Web site or the Web for a possible explanation.
System.ArgumentNullException in uc480_SubVI_Example_MemoryAllocation.vi->uc480_SimpleLive.vi

 

0 Kudos
Message 4 of 6
(5,127 Views)

Hey all!

Thanks for the replies. I contacted Thorlabs in parallel to see if they can help fix this. The run-time error text:

 

Error 1172 occurred at Invoke Node Error calling method uc480.Information.ToString, (System.ArgumentNullException: Key cannot be null.Parameter name: key)

0 Kudos
Message 5 of 6
(5,127 Views)
Solution
Accepted by topic author Joszz

Problem solved. Thorlabs instructed to download and install 'uc480 Version x.xx for Compact USB Cameras' from their website (https://www.thorlabs.com/software_pages/ViewSoftwarePage.cfm?Code=ThorCam#). This has to be done after installing the Thorcam software. Now the .NET errors are gone. I will ask Thorlabs why this is needed, since the Thorcam application already comes with 32-bit LabVIEW examples and should install all required drivers.

 

 

 

0 Kudos
Message 6 of 6
(5,119 Views)