LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Error occured while generating .NET controller code

Hi everyone.

 

I'm using Visual Studio 2010, and I'm trying to use an assembly from CVI. When I use the tool to create a CVI .NET controller, I get the following error:  "Error occured while generating .NET controller code. Error in the application."

 

.NETcontrollerError.png

 

 

 

 

 

 

 

 

 

I'm on a Windows 7 x86 machine and I have the project in Visual Studio 2010 targeted to the 2.0 .NET Framework (I'd rather use 4.0, but I changed it to 2.0 for troubleshooting).  I've tried building in both debug and release mode.  I'm specifying the assembly by path (it's not in the GAC).

 

The source code for my assembly is this:

using System;
using System.Collections.Generic;
using System.Text;

namespace test
{
 public class test1
 {
  public string GetModelNumber()
  {
   return "1234";
  }

 }
}

Update: now I find that sometimes it works.  If I open the tool, select the debug assembly, I get the error.  If I then select the release assembly without closing the tool, it works!  Weird.

Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 1 of 3
(3,605 Views)

Hey Josh - 

 

I took a look at this, but wasn't able to reproduce what you are seeing.  Is it possible that when the operation fails the assembly you are browsing to is located on a network share?  If the assembly is on a network share, a security exception is likely being thrown as we reflect over the assembly to generate the wrapper, thus causing the failure.  If you must leave the assembly on the network location, you may be able to run CasPol to fully trust the network share.

 

NickB

National Instruments

 

PS - good to see you on the boards buddy 🙂

0 Kudos
Message 2 of 3
(3,596 Views)

Nope, not a network share.  I do have two partitions on my harddrive (C and D).  CVI is installed on C, and my files (cvi project and assembly) are on D. 

 

Oh well.  For now, my assembly is fairly static, so I won't have to regenerate the wrapper for a bit.  If I run into the error and am able to narrow down the cause, I'll let you know.

Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 3 of 3
(3,593 Views)