I have a VI that takes a .NET bitmap object and copies its contents into IMAQ image buffer. I do this by converting the IMAQ buffer into it's own .NET reference, then doing a Graphics.DrawImage of the original .NET bitmap into the IMAQ bitmap. The code works fine on my Windows 7, LV 2017x64 computer, but immediately crashes LV on several Windows 8 and 10 machines using 64-bit. Using 32-bit LV, they work fine. I've confirmed all machines have the same .NET Framework and CLR versions. I've installed the F2 updates for LV on at least one of the systems, but it did not help.
Using highlight execution, disabling, and various Bitmap formats, I've confirmed that it crashes while in the Graphics.DrawImage invoke node. However, I have (and you can see in the various disabled cases) used other Graphics methods that all result in LV crashing as well.
The crash that happens does not result in the normal LV error reporting window, rather it's a Windows dialog saying the application has stopped working and will close. The Windows event log doesn't seem to contain anything that stands out as helpful.
I've attached both the VI that does the conversion and a test VI to load images into both the Bitmap and the IMAQ buffer. I load something into the IMAQ buffer to be able to see that it has changed if successful.
Hopefully someone out there has some insight into why this seems to work fine in 32-bit and not 64, but also on 64-bit Win7.
Solved! Go to Solution.
You just made my week! The IntPtr had come from an example I had found from like 2011 and I just accepted that it was the thing to do without really questioning why. Also the method doesn't visually specify that it's of a specific type, so I never considered looking at it.
Well I'm happy to present this code for any who may need it:
I've actually made a couple changes since. The format going into the IMAQ Bitmap has to be the same as the imaq itself, not of the source bitmap. Also I added an option to return the IMAQ Bitmap reference since I have some potential need for that as well.