LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

System.Access.ViolationException when dragging from a .NET control

When I have a .NET control running in the .NET containerwhich allows dragging, I get an exception when I leave the container with my drag.
This happens with different .NET controls and independently from implementing an event case for LV drag drop. All the .NET controls work fine in Windows Forms.
The exception thrown is:
"System.Access.ViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
The exception stack always contains a call of DoDragDrop.
 
So there seems to be some incompatibility between .NET DoDragDrop and LV Drag Drop.
 
Does anyone know how  to solve or avoid this problem. I definitely need to drag from a .NET control.
 
Torsten
http://topiks.blogs.com/topiks/
0 Kudos
Message 1 of 6
(4,139 Views)
hello torsten,


can you provide a VI and a example control, which reproduces the behaviour?


regards,

robert h
NI germany
0 Kudos
Message 2 of 6
(4,112 Views)
Here it is. In the LVprojct there is a TestDragNDrop.vi. When you click on the DragFromHere Control there will be the Exception, because I attached the DoDragDrop method to the MouseDown Event on that control. The ctrls, the source as well as a WinFormsApp with the same controls are in the VSTestDragNDrop folder. It is all based on .NET 2.0; I am still waiting for an MSBee CTP to be able to build against .NET 1.1 with VS2005.
 
By the way: try to run the vi and the WinFormsApp in parallel: you can then drag from the WinForm and drop on the vi, so drop semms to make no problems.
 
Thanks,
Torsten
http://topiks.blogs.com/topiks/
0 Kudos
Message 3 of 6
(4,092 Views)
Torsten,

I manually back-ported your test case to .NET 1.1 and verified that it works fine, without throwing exceptions, under .NET 1.1.
I have also reproduced the exception under .NET 2.0. However,  I have not been able to reproduce the problem under .NET 2.0 with a debug version of LabVIEW. So I have not yet been able to determine if there is a problem in LabVIEW contributing to this issue.

Note that LabVIEW 8.0 does not currently support drag and drop between .NET controls and LabVIEW's native controls.
Also, LabVIEW supports .NET 1.1, but has not yet been fully tested with .NET 2.0.

I recommend that you  use .NET 1.1 with LabVIEW. You can do that by placing a text file named LabVIEW.exe.config in the same directory where LabVIEW.exe is located (by default, C:\Program Files\National Instruments\LabVIEW 8.0) that contains the text:

<configuration>
   <startup>
      <requiredRuntime version="v1.1.4322"/>
   </startup>
</configuration>

George Erwin-Grotsky
National Instruments LabVIEW Research & Development
George Erwin-Grotsky
National Instruments
LabVIEW Research & Development
Message 4 of 6
(4,081 Views)

George,

thank you very much for the information and your tests.

I will be developing .NET components for a LabVIEW 8.0 based project, so I have to decide soon, which version of the .NET framework to use. Is there a date, when LV 8.0 will be tested against .NET 2.0?

Thanks,

Torsten
http://topiks.blogs.com/topiks/
0 Kudos
Message 5 of 6
(4,068 Views)
Torsten,

I have been corrected: LV 8.0 does officially support .NET 2.0, with the exception of generics.
Drag and Drop between native LabVIEW controls and .NET controls is not supported,
but theoretically D&D between two .NET controls like you were trying to do should work.
I have entered this bug into our tracking database. In the mean time, if you need to do this, try using .NET 1.1.
George Erwin-Grotsky
National Instruments
LabVIEW Research & Development
Message 6 of 6
(4,044 Views)