Solution
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 called API. 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.
This article will detail the necessary steps to:
- Obtain the full .NET exception message.
- Troubleshoot the error in order to resolve it.
Obtaining the .NET Exception Message
In LabVIEW 8.0 and Later
In LabVIEW 8.0 and later, more information was added to the error messages by placing the .NET exception message property into the
Source string of the
Error Cluster.
This exception message can only be accessed when implementing manual error handling. Within the error handling, the
Source element of the
Error Cluster can be unbundled to reveal additional error information. For more information about error handling, refer to
Handling Errors in LabVIEW.
In LabVIEW 7.x
In LabVIEW 7.x, additional .NET exception information cannot be obtained. Move to the next section to troubleshoot the error.
Troubleshooting the .NET Error
- Ensure that the .NET assemblies are saved in the correct directory.
- For standalone VIs (not within a project), the assembly must be saved in the directory that contains the LabVIEW.exe. This is usually C:\Program Files (x86)\National Instruments\LabVIEW 20xx where xx stands for the version number.
- For VIs within a project, save the assembly in the project directory or any of it's subdirectories.
- For build applications, Application Builder automatically saves the assemblies in the data subdirectory. This must be distributed along with the application.
- Shared assembles (including assemblies on a network drive) must be installed in the Global Assembly Cache (GAC). Refer to How to: Install an assembly into the global assembly cache for further details.
- For LabVIEW 7.x, add the .NET assembly as a reference in LabVIEW by selectin Tools >> Advanced >> NET Assembly References. Click the Add button and navigate to the location of the assemblies that are called.
- If distributing a built application, ensure that the target PC has the .NET Framework installed that corresponds with the .NET assembly. Use the How to: Determine which .NET Framework versions are installed Microsoft article as a guide to confirm your .NET Framework version. If the required .NET Framework version is not installed, use the Download .NET Framework webpage to install it.
- Use the Probe Tool to make sure the .NET object reference, originally created by the .NET Constructor Node VI, is valid.
- If using a 3rd party DLL, the DLL can be the cause of issue, which is highlighted in LabVIEW via this generic error.
- Attempt to call the .NET DLL through another language to verify whether this function can be called. This can include calling it in another .NET assembly with a different access scope.
- In this case, reach out to the 3rd party developer for further troubleshooting.
- Ensure that the .NET feature is supported in LabVIEW.