JanJorgensen Posted February 12, 2010 Report Share Posted February 12, 2010 Hi. I'm using LV8.5. I have developed a quite large application in .NET 2.0, and have also made a separate assembly (dll) which can be used by other applications for interoperating with our application. I can browse the classes and interfaces inside the assembly from LV, but no constructors are shown for any of my classes. I don't get an information from LV, why the constructors are not shown. I have searched around, but haven't found a good description on the preconditions for a .NET assembly to be callable from LV. Any ideas? Quote Link to comment
Yair Posted February 12, 2010 Report Share Posted February 12, 2010 I believe they need to be marked as public, but I'm not a .NET developer. The best resource you can get for the "interesting" stuff is Brian Tyler's blog (Lycangeek), as he used to head the LV .NET integration team. Quote Link to comment
JanJorgensen Posted February 12, 2010 Author Report Share Posted February 12, 2010 Thanks, Yair. My assembly is perfectly callable from other environments and other .NET assemblies. But not from LV... What I'm looking for is e.g. a checklist of preconditions I can run through to make it sure it is usable from LV. It would have been easier if LV showed ALL constructors for a class, and made those not usable gray with a tooltip telling why they aren't callable. I checked Bryan Tylers blog, and found nothing on the subject. I have located the VI in the same folder as the dll. The referenced private assemblies are also there. The class I wish to use can be used from other assemblies and my main application. When I build a test-assembly with a simple class, I have no problems using it from LV. It's just as easy as it should be. But LV is not helping me by telling me what's wrong. The OK button of the Select .NET Constructor dialog is even enabled when I select a class with only private constructors! I will be VERY greatfull if anyone can help me on this. It would be really really great if our application could be used with LabVIEW. I have tried so many things and I'm pretty stuck right now. Quote Link to comment
Mark Smith Posted February 12, 2010 Report Share Posted February 12, 2010 I don't know what your specific problem may be, but just for comparison I'm attaching a very simple .NET (VS2005) project that builds a DLL I can call from LabVIEW. Maybe you can compare your project and figure out where the differences are. Also, have you lloked at your assembly with ILDASM and confirmed that the constructor/functions are indeed getting built as expected? MarkIPv6 .NET Tools 1.0.0.zip Quote Link to comment
JanJorgensen Posted February 12, 2010 Author Report Share Posted February 12, 2010 I don't know what your specific problem may be, but just for comparison I'm attaching a very simple .NET (VS2005) project that builds a DLL I can call from LabVIEW. Maybe you can compare your project and figure out where the differences are. Also, have you lloked at your assembly with ILDASM and confirmed that the constructor/functions are indeed getting built as expected? MarkIPv6 .NET Tools 1.0.0.zip Thanks, Mark. I will have a look at your code tomorrow. Maybe there's something that triggers. OK tip about ILDASM, but I have been using the assembly from my .NET application for years, so I know the classes have public constructors. /Jan Quote Link to comment
Yair Posted February 13, 2010 Report Share Posted February 13, 2010 Rechecking to see if they're actually public is the only advice I can give (maybe there are different levels of "public" in .NET?). I can say that I ran into cases where stuff (I remember properties for sure, can't comment on constructors) was available inside .NET, but was not available in LabVIEW until it was marked as public. By the way, I seem to remember that there are some issue with .NET and LV 8.5, but I don't remember the details. See this thread for an example. Quote Link to comment
JanJorgensen Posted February 14, 2010 Author Report Share Posted February 14, 2010 (edited) Rechecking to see if they're actually public is the only advice I can give (maybe there are different levels of "public" in .NET?). I can say that I ran into cases where stuff (I remember properties for sure, can't comment on constructors) was available inside .NET, but was not available in LabVIEW until it was marked as public. By the way, I seem to remember that there are some issue with .NET and LV 8.5, but I don't remember the details. See this thread for an example. Thanks alot, Yair. I will walk through the discussion, and see if I find something usefull. It looks very much like the same problems I am having. I'm sure it's not a 'public' problem, because all classes are perfectly usable from my main (.NET) application. /Jan Edited February 14, 2010 by JanJorgensen Quote Link to comment
Rolf Kalbermatter Posted February 14, 2010 Report Share Posted February 14, 2010 Another problem I have seen repeatedly with people complaining that the constructor is not available in LabVIEW is when they try to use static objects. That are objects that do not need nor can't be instantiated to work since they do not hold onto any local data for their operation. For instance mathematical function libraries that always take all their data as method parameters. LabVIEW simply allows to call static objects by selecting them into a refnum and then selecting the methods for those objects in a method node. Quote Link to comment
JanJorgensen Posted February 15, 2010 Author Report Share Posted February 15, 2010 Another problem I have seen repeatedly with people complaining that the constructor is not available in LabVIEW is when they try to use static objects. That are objects that do not need nor can't be instantiated to work since they do not hold onto any local data for their operation. For instance mathematical function libraries that always take all their data as method parameters. LabVIEW simply allows to call static objects by selecting them into a refnum and then selecting the methods for those objects in a method node. Yes, I'm sure that makes it harder to understand .NET connectivity for people without any object oriented programming experience. Quote Link to comment
JanJorgensen Posted February 18, 2010 Author Report Share Posted February 18, 2010 OK. I haven't found a solution yet and I haven't found a way to get information from LabVIEW about the reason for not showing the constructors. Instead I have created a new assembly (.NET dll) with only the classes needed from my LabVIEW code. To be sure I can distribute it along with an LLB-file, I am registering the assembly in the GAC. This is not the desired solution, and maybe I can use the "real" assembly some time in the future, when it can be registered in the GAC. - all its dependencies must also be in the GAC . But with my current solution, it is very easy to use the assembly in LabVIEW, and all changes are immediately available after closing and re-opening LabVIEW. Thanks for the attention. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.