Jump to content

How to make .NET assembly callable


Recommended Posts

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?

Link to comment

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.

Link to comment

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

Link to comment

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

Link to comment

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.

Link to comment

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 by JanJorgensen
Link to comment

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.

Link to comment

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.

Link to comment

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. throwpc.gif

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.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.