厦门手机网站建设,中国建设监理协会化工监理协会网站,南京江宁区住房建设局网站,网站服务器用什么系统LabVIEW中使用.NET方法时出现错误1316为什么不能调用带有泛型参数的方法#xff1f;LabVIEW不支持哪些.NET功能#xff1f;为什么会收到以下错误#xff1a;发生此错误的原因是正在调用LabVIEW中不支持的.NET功能。有关解决方法#xff0c;请参阅“其他信息”部分。可以在下…LabVIEW中使用.NET方法时出现错误1316为什么不能调用带有泛型参数的方法LabVIEW不支持哪些.NET功能为什么会收到以下错误发生此错误的原因是正在调用LabVIEW中不支持的.NET功能。有关解决方法请参阅“其他信息”部分。可以在下面找到LabVIEW中不支持的.NET功能列表。.NET2.0及更高版本泛型—LabVIEW不提供实例化泛型类或调用泛型方法的机制。.NET构造函数节点和.NET调用节点不允许指定要替换泛型类型的类型。异常LabVIEW可以实例化对象并调用在.NET程序集中定义的方法这些程序集还包含泛型类型定义或泛型方法定义。但是LabVIEW只能访问这些装配件中不使用通用功能的部分。LabVIEW可以在内部实例使用泛型类或方法的.NET对象。LabVIEW可以在内部调用使用泛型类或方法的.NET方法。.NET4.0进程内并行执行仅适用于LabVIEW 2013之前的LabVIEW版本。单击此处查看如何在LabVIEW 2013及更高版本的LabVIEW中加载混合模式装配程序—LabVIEW不能对以不同版本的CLR运行为的.NET程序集使用不同版本的.NET公共语言运行库CLR。相反LabVIEW只对它在单个应用程序实例中加载的所有.NET程序集使用一个版本的CLR。LabVIEW使用以下规则来确定使用哪个已安装的CLR版本默认情况下LabVIEW使用CLR2.0它随.NET2.0、3.0和3.5一起安装。如果创建了相应的应用程序配置文件LabVIEW将使用CLR4.0。要更改CLR LabVIEW使用的哪个版本必须退出LabVIEW并添加或移除应用程序配置文件。有关更多信息请参阅LabVIEW帮助链接如下中的在LabVIEW中加载.NET4.0装配主题。动态关键字-.NET4.0引入了关键字该关键字指定在运行时之前不会确定或强制实施关联数据类型。但是LabVIEW要求.NET对象具有定义的类型以便在.NETI nvoke Node中显示可用的方法。因此尽管LabVIEW允许调用返回动态数据类型的.NET方法但不能使用返回的数据来调用其他方法。异常LabVIEW可以成功调用内部使用动态数据类型的装配程序。可选参数的默认值-.NET程序集可能包含允许可选参数的方法。反过来可选参数具有默认值如果调用方未为参数指定值则方法将使用这些值。但是当从LabVIEW调用具有可选参数的方法时LabVIEW始终会为参数传递其自己的缺省值而不是让方法使用其自己预配置的缺省值。最后NI不保证LabVIEW完全支持所有.NET4.0类库。在可能的下NI建议在使用LabVIEW2之前的LabVIEW版本时使用针对CLR0.4的装配程序而不是CLR0.2013。通常如果要使用LabVIEW不支持的.NET功能可以创建一个包装的.NET程序集用于在内部访问不支持的功能。由于自己创建包装器程序集所以可以将公开的类型和方法定义限制为LabVIEW支持的类型和方法定义。英文版如下所示SolutionThiserror occurs because you are calling a .NET feature that is unsupported inLabVIEW. Refer to the Additional Information section for aworkaround. You can find a list of .NET features that are unsupported inLabVIEW below..NET2.0 and laterGenerics—LabVIEWdoes not provide a mechanism to instantiate generic classes or to call genericmethods. The .NET Constructor Node and the .NET Invoke Node do not allow you tospecify which types you want to substitute for the generic types.Exceptions:LabVIEWcan instantiate objects and call methods that are defined in .NET assembliesthat also contain generic type definitions or generic method definitions.However, LabVIEW can access only the parts of these assemblies that do not usegeneric features.LabVIEWcan instantiate .NET objects that use generic classes or methods internally.LabVIEWcan call .NET methods that use generic classes or methods internally..NET4.0In-processside-by-side execution (only applies to LabVIEW versions prior to LabVIEW 2013.Click here to see how to load mixed-mode assemblies in LabVIEW 2013 and laterversions of LabVIEW)—LabVIEW cannot use a different version of the .NET CommonLanguage Runtime (CLR) for .NET assemblies targeted to run in differentversions of the CLR. Instead, LabVIEW uses only one version of the CLR for allthe .NET assemblies that it loads in a single application instance. LabVIEWuses the following rules to determine which installed version of the CLR touse:Bydefault, LabVIEW uses the CLR 2.0, which is installed with .NET 2.0, 3.0, and3.5.If youcreate the appropriate application configuration file, LabVIEW uses the CLR4.0.Tochange which version of the CLR LabVIEW uses, you must exit LabVIEW and add orremove the application configuration file. Refer to the Loading .NET 4.0Assemblies in LabVIEW topic in the LabVIEW Help (linked below) for moreinformation.If youdo 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 .NETAssemblies in Memory Dialog Boxtopic in the LabVIEW Help (linked below) formore information.dynamickeyword—.NET 4.0 introduces the dynamic keyword, which specifies that the typeof associated data is not determined or enforced until run time. LabVIEW,however, requires .NET objects to have a defined type in order to display theavailable methods in the .NET Invoke Node. Therefore, although LabVIEW allowsyou to call .NET methods that return a dynamic data type, you cannot use thereturned data to call other methods.Exception:LabVIEW can successfully call assemblies that use dynamic data typesinternally.Defaultvalues for optional parameters—.NET assemblies may include methods that allowoptional parameters. Optional parameters, in turn, have default values that themethod 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 alwayspasses its own default value for the parameter instead of letting the methoduse its own preconfigured defaults.Finally,National Instruments does not guarantee that LabVIEW fully supports all .NET4.0 class libraries. When possible, National Instruments recommends that youuse assemblies targeted for the CLR 2.0 instead of the CLR 4.0 when workingwith LabVIEW versions prior LabVIEW 2013. AdditionalInformationWorkaroundIngeneral, if you want to use a .NET feature that LabVIEW does not support, youcan create a wrapper .NET assembly that accesses the unsupported featureinternally. Because you create the wrapper assembly yourself, you can limit theexposed types and method definitions to those supported by LabVIEW. 什么是DLL封装我什么时候需要使用DLL封装解决方案所谓封装就是指为另一种软件提供兼容性接口的程序。由于第三方DLL的开发设计通常是为了从C语言或者其它类似的底层语言中调用而不从是LabVIEW中调用因此当使用LabVIEW进行应用程序开发时往往会用到封装。例如有的DLL会返回指针或者其它复杂的数据结构而这在LabVIEW中却无法很容易的实现。编写一个DLL封装可以类比在C语言环境下按照该DLL原始开发者设计的调用DLL方式来编写一个完全独立的程序。反过来这个封装程序也是专门针对在LabVIEW中调用DLL所设计的。也就是说这个新的用C编写的“封装” 程序将原来的C程序DLL封装起来形成一个接口层。使用封装的好处在于不再需要使用原来的DLL的源代码也不需要对这些源代码进行任何改动。 需要说明的是上述的例程和文档都是可以下载的双击即可打开其中压缩文件是可以采用粘贴复制的方式拷贝到硬盘上。这不是图片各位小伙伴看到后尝试一下这个问题就不用加微信咨询了。有关LabVIEW编程、LabVIEW开发等相关项目可联系们。附件中的资料这里无法上传可去公司网站搜索下载。