LabVIEW and .NET Exceptions

Updated Sep 26, 2019

Reported In


  • LabVIEW

Issue Details

How does LabVIEW handle .NET exceptions?


Any exception thrown when calling a .NET object property or method is converted into LabVIEW error 1172. This error means that LabVIEW received a .NET exception from the API you called. The typical message you will see is similar to:
1172, kLVE_DotNetException, A .NET exception occurred.​

The root cause of the error will be related to the .NET Exception Message, as 1172 is a generic error code for any .NET Exception.
  1. In LabVIEW 8.0 and later, more information was added to the error messages by placing the .NET Exception Message property into the error source string in the error cluster. Unbundle the source element to view the additional information on the exception.
  2. In LabVIEW 7.x, the only information displayed was that a .NET Exception occurred. To resolve this error in LabVIEW 7.x, try one of the following:
  • Ensure that the .NET assemblies that you are using are saved in the root directory of the top-level VI.
  • Add the .NET assembly as a reference in LabVIEW by selecting Tools»Advanced»NET Assembly References. Click the Add button and navigate to the location of all the assemblies that you want to call. 

Additional Information

 In LabVIEW 8.0 and later, you will only receive the extra information if you use manual error handling. For more information about error handling, please see Handling Errors in NI LabVIEW.

Other considerations for calling a .NET Assembly from LabVIEW are:
  • Private assemblies must be placed in the same directory as the calling application. 
  • Shared assemblies must be installed in the GAC. This includes assemblies called from a network drive. For information about installing to the GAC, see Install an Assembly into the Global Assembly Cache
  • If building an application, make sure to include the assembly in the build. LabVIEW Application Builder should automatically save assemblies that are not registered in the GAC to the data subdirectory. You must distribute the data directory with the built application. 
  • When distributing built applications, make sure the target computer has the .NET Framework installed that corresponds with the called .NET assembly.
  • Use the Probe Tool to make sure the .NET object reference, originally created by the .NET Constructor Node VI, is valid.
  • If using a third party .dll, a .NET exception can be the cause of the issue and LabVIEW is simply giving a generic error message saying something went wrong in that .dll. In that case, please reach out to the 3rd party .dll provider for further troubleshooting.
For more information, please see Requirements for Using .NET Assemblies in LabVIEW.