Jump to content

stack overflow in .NET invoke node


Recommended Posts

Hi!

After a .NET constructor node, I use the the Invoke Node to call the following function

public void TestFunction_LoadImageFile(ref string filepath)

{

Debug.WriteLine("TestFunction is called - make sure to use it only in debug mode !");

SrcImage = new System.Drawing.Bitmap(filepath);

}

where SrcImage is of Type System.Drawing.Bitmap.

As soon as this invoke node is reached, Labview crashes. If I debug it, I get a stack overflow is mscore lib...

Anyone got an idea why?

Thank you very much in advance for your help.

Link to comment
  • 7 months later...

Without knowing the exact values, my best guess is that the problem is with the "ref" part of the function definition.

Pull that out so you're passing the string by value instead of by reference. (The definition will be "public void TestFunction_LoadImageFile(string filepath)".)

Passing by reference means you're handing .NET a reference to a string, instead of just handing it the actual string. The glue that allows LabVIEW to call .NET code doesn't create .NET instances for LV values, it just creates the value. (At least, to my knowledge...)

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.