LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LABVIEW calling .net method with Interface as parameter

Many thanks to everyone that shed light on this topic. The interfaces can accessed using the "To More Specific Class" and by using the right constructors.

 

The trick is to create a constant where you will need the reference. Once you have the constant it can be used to provide the specific class for the desired property or invoke node. e.g. The TfsTeamProjectCollection GetService shown in the VI.

 

Enjoy!

Message 11 of 15
(1,367 Views)

I'm also trying to connect to TFS.

Simply checking out an item it no problem, but for creating workspaces and mappings I struggle.

 

Unfortunately your sample VI is not working for me.

I always get Error 1 at "To more specific class".

Possible reason(s):

LabVIEW:  An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @.

 

Any ideas? Thx in advance

0 Kudos
Message 12 of 15
(1,325 Views)

Error 1 means generally that something you passed in was invalid. For the To More Specific class this almost always means that you did not wire a valid refnum into it. For some reasons that refnum seems invalid. Generally that would mean that the node generating that refnum had an error, though in this specific case that would mean that the To More Specific had an error in on the input side and shouldn't even attempt to look at the refnum. Are you sure the error comes from the To More Specific function and not somewhere earlier?

 

Besides the example opens a lot of refnums but never closes any of them after use. That counts for a sort memory leak in your program. If you call this function only once it won't matter but if you intend to use this function in a program that will call it repeatedly many times you really want to go through this VI and make sure that every single refnum is properly closed after you have used it.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 13 of 15
(1,321 Views)

For testing I deleted all error wires, the error 1 is coming directly from the "to more specific class", even in the example.

Closing references is something I am aware of, thanks.

 

0 Kudos
Message 14 of 15
(1,317 Views)

@Tesla1977 wrote:

For testing I deleted all error wires, the error 1 is coming directly from the "to more specific class", even in the example.

 


That's not very useful! In that case the previous function most likely generates an error somehow and therefore will not be executed which will result in an invalid refnum being returned. The To More Specific Class node needs a valid refnum!

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 15 of 15
(1,315 Views)