cancelar
Mostrando los resultados de 
Buscar en lugar de 
Quiere decir: 

System.Reflection.TargetException

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 ?

Descargar todos
0 kudos
Mensaje 1 de 5
3.941 Vistas

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

0 kudos
Mensaje 2 de 5
3.891 Vistas

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.

0 kudos
Mensaje 3 de 5
3.880 Vistas

Hi,

 

Can you try this VI, I changed a bit the structure condition with your "dispose" method.

 

Hope it could help.

 

Regards,

 

MatthieuR

0 kudos
Mensaje 4 de 5
3.858 Vistas

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 ?

0 kudos
Mensaje 5 de 5
3.848 Vistas