I have C# control derived from UserControl. When I close the design view of a form incorporating this control Visual Studio crashes. On XP I get the opportunity to debug the crash and I can see it is throwing a DLL not found exception on an API in a C dll. If I comment out the call to this function it stops the crash. Is closing the design view actually calling my dispose method? Why am I getting the DLL (or entry point) not found exception and what should I do to stop this happening?
Asked
Active
Viewed 1,029 times
0
-
Would you please post the usercontrol code ? – Amen Ayach Feb 18 '12 at 16:30
-
You will need to use the DesignMode property to prevent this code from running in design mode. – Hans Passant Feb 18 '12 at 17:02
-
Have you looked at: http://stackoverflow.com/q/2663873/6294 http://stackoverflow.com/q/3874841/6294 – Maggie Feb 18 '12 at 17:12
1 Answers
0
If the C DLL is not available to Visual Studio at design-time you either need to put it in a place where Visual Studio can find it or add code to your control to check if you are in design mode and avoid making calls to the DLL.

Jim Rhodes
- 5,021
- 4
- 25
- 38