11-22-2012 09:05 AM
Hello I'm currently trying to translate a C# code into labview (joined vi is strictly the reflect of this code). I get the "System.Reflection.TargetException" error in the "Impersonate" method of my WindowsIdentity object. I've also tried to use the static "Impersonate" method with the same effect. I thought it was a security issue but if I call (from labview) the inital code in my .NET assembly it works.
Any idea ?
11-29-2012 07:51 AM
Hi,
Please, find some links about calling C code into LABview.
https://decibel.ni.com/content/docs/DOC-9069 Tutorial: Configuring the Call Library Function Node to call a Simple DLL
https://decibel.ni.com/content/docs/DOC-9079 Calling C/C++ DLLs Containing Simple and Complex Datatypes from LabVIEW
I didn't find any reason for your error.
Maybe if you call a .DLL with your code C into LABview, it should work.
Hope it helps.
MatthieuR
Matthieu RICORD
National Instruments France
Été de LabVIEW 2014
12 présentations en ligne, du 30 juin au 18 juillet
11-30-2012 01:04 AM
Hello,
The problem is not on the C DLL call since this part works fine, but it's when calling a .NET object method. As it works when it's called from inside a .NET assembly called from LabVIEW I would supose it is due to the way LabVIEW calls the .NET code. I guess it's using the reflection along with Invoke methods to do that, explaining the System.Reflection.TargetException, but I wonder why it fails precisely for the concerned method as the other method of that class are called normaly. Furthermore the reflection seems ok because the method appears in the browser while configuring the "invoke node" function.
12-10-2012 11:32 AM
Hi,
Can you try this VI, I changed a bit the structure condition with your "dispose" method.
Hope it could help.
Regards,
MatthieuR
Matthieu RICORD
National Instruments France
Été de LabVIEW 2014
12 présentations en ligne, du 30 juin au 18 juillet
12-11-2012 08:25 AM
It makes no difference at my side. Your change is a potential bug correction, but I still get the System.Reflection.TargetException. I've tryed on another computer with both LabVIEW 11 & 12 with the same issue. Does the impersonation really work on your side ?