Error 1316 While Using .NET Methods in LabVIEW

Updated Feb 2, 2024

Reported In

Software

  • LabVIEW

Issue Details

  • Why can't I call methods with generic parameters?
  • Which .NET features are not supported by LabVIEW?
  • Why am I receiving the following error:
Error 1316: Invoke Node

 


 

Solution

This error occurs because you are calling a .NET feature that is unsupported in LabVIEW. Refer to the "Additional Information" section for a workaround. You can find a list of .NET features that are unsupported in LabVIEW below.

.NET 2.0 and later

  • Generics—LabVIEW does not provide a mechanism to instantiate generic classes or to call generic methods. The .NET Constructor Node and the .NET Invoke Node do not allow you to specify which types you want to substitute for the generic types.
    • Exceptions:
      • LabVIEW can instantiate objects and call methods that are defined in .NET assemblies that also contain generic type definitions or generic method definitions. However, LabVIEW can access only the parts of these assemblies that do not use generic features.
      • LabVIEW can instantiate .NET objects that use generic classes or methods internally.
      • LabVIEW can call .NET methods that use generic classes or methods internally.

.NET 4.0

  • In-process side-by-side execution (only applies to LabVIEW versions prior to LabVIEW 2013. Visit the Loading.NET 2.0, 3.0, and 3.5 Assemblies in LabVIEW documentation to see how to load mixed-mode assemblies in LabVIEW 2013 and later versions of LabVIEW).— LabVIEW cannot use a different version of the .NET Common Language Runtime (CLR) for .NET assemblies targeted to run in different versions of the CLR. Instead, LabVIEW uses only one version of the CLR for all the .NET assemblies that it loads in a single application instance. LabVIEW uses the following rules to determine which installed version of the CLR to use:
    • By default, LabVIEW uses the CLR 2.0, which is installed with .NET 2.0, 3.0, and 3.5.
    • If you create the appropriate application configuration file, LabVIEW uses the CLR 4.0.
To change which version of the CLR LabVIEW uses, you must exit LabVIEW and add or remove the application configuration file. Refer to the Loading .NET 4.0 Assemblies in LabVIEW topic in the LabVIEW Help (linked below) for more information.
If you do not know which version of the CLR a specific assembly is targeted to use, you can refer to the .NET Assemblies in Memory dialog box. Refer to the .NET Assemblies in Memory Dialog Boxtopic in the LabVIEW Help (linked below) for more information.
  • dynamic keyword—.NET 4.0 introduces the dynamic keyword, which specifies that the type of associated data is not determined or enforced until run time. LabVIEW, however, requires .NET objects to have a defined type in order to display the available methods in the .NET Invoke Node. Therefore, although LabVIEW allows you to call .NET methods that return a dynamic data type, you cannot use the returned data to call other methods.

    • Exception: LabVIEW can successfully call assemblies that use dynamic data types internally.
  • Default values for optional parameters—.NET assemblies may include methods that allow optional parameters. Optional parameters, in turn, have default values that the method uses if the caller does not specify a value for the parameter. However, when you call a method with an optional parameter from LabVIEW, LabVIEW always passes its own default value for the parameter instead of letting the method use its own preconfigured defaults.

Finally, National Instruments does not guarantee that LabVIEW fully supports all .NET 4.0 class libraries. When possible, National Instruments recommends that you use assemblies targeted for the CLR 2.0 instead of the CLR 4.0 when working with LabVIEW versions prior LabVIEW 2013. 

Additional Information

In general, if you want to use a .NET feature that LabVIEW does not support, you can create a wrapper .NET assembly that accesses the unsupported feature internally. Because you create the wrapper assembly yourself, you can limit the exposed types and method definitions to those supported by LabVIEW.