LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

.NET invoke missing methods

Solved!
Go to solution

Hi everyone,

 

I'm starting to use LabView. I've been tasked in refactoring an existant (old) project where I have to do some improvement.

 

I must use LabView 2013 SP1.

 

My first activity is to use an external .NET assembly to handle Excel protection of report files.

 

The assembly, coded in Visual Studio (c#, .net 3.5), is pretty simple it just define a class ReportLocker with 3 methods Lock, Unlock, IsLocked.

 

Everything worked fine until I added the last method (IsLocked).

 

This method is not recognized by LabView, it just show the first two methods Lock, Unlock.

 

I tried to:

  • delete and recreate the Invoke nodes,
  • deleted and recreated Constructor node,
  • changed referencesto different assemblies and then reset it to mine
  • reset PC

...nothing works .. it just keep showing only the old methods.

 

What's the problem? There's an hidden cache somewhere? Methods must have a specific signature (parameter types ...)?

 

I tried also to add another method with a more canonical return type and parameter list.. but it's not listed.

 

Please note that I'm using the same assembly into a .NET executable and everything works correctly (all assembly methods are correctly called).

 

I'm attaching:

  • the VI project I'm using to check everything;
  • the assembly binaries along with its dependecies;
  • the source code of the assembly (just the .cs file).

P.S. In the VI block diagram the Check action is bound to a static factory of the assembly .. 

 

Bes regards,

 Mike

0 Kudos
Message 1 of 3
(369 Views)
Solution
Accepted by topic author michele.santucci

I found the problem: as reported in Constructor Node Help LabView relies on system manager policies to select which Assembly need to be loaded. This involve checking the assembly release number and choose the correct assembly according to the policies.

 

In my case I did two errors:

1) the first time I used the Constructor node I pointed it to the debug assembly (into the assembly project folder) then I pointed it to the local release assembly into the .vi folder;

2) I forgot to update the version of the assembly when I added the third method.

 

As a matter of fact LabView kept using the first (debug) selected assembly until I made a version change, when the version change had become evident a message was prompted since LabView insisted to use the older assembly version (probably according to some specific security policy). This triggered my attention and allowed to fix the problem.

 

Once I updated the assembly version I needed also to close LabView, clear GAC downloaded assembly cache with gacutil /cdl (from an elevated command prompt), then restarted LabView.

 

Best regards,

 Mike

Message 2 of 3
(332 Views)

Tthis's probably not a fault attributable to LabView but it should be noted that selecting a new assembly by the Constructor node doesn't trigger any warning message when it actually should.
This happens only if there's a version conflict between the original pointed assembly and the newly selected ...and anyway in my case this lead to keep the older one in use (but this may dependes on sysadmin policies).

0 Kudos
Message 3 of 3
(255 Views)