troubleshooting Question

C#, UserControl OnPaint, Visual Studio Crashes

Avatar of collages
collagesFlag for United States of America asked on
.NET ProgrammingC#
7 Comments1 Solution1201 ViewsLast Modified:
I'm creating a user control and it would crash over and over again as soon as I opened the project.  

After the crash (and before i continued with the visual studio restart), i re-checked the code and finally found that I was disposing of an object that would be null in designer mode.

How do I debug code that would be executing in designer mode.  It doesn't tell me what line it's having a problem with or anything like that.  It's completely transparent and just crashes Visual Studio the second it opens.

My last problem was due to a Bitmap Dispose() function call that would be null if it were running in designer mode but there was no way for me to tell this unless I ignored the crash window and reread all of my code to find the bug.

What's the best way to debug in designer mode?  Having visual studio crash immediately on something like this with no error codes or anything makes it difficult to figure out what's going on.  Any help would be appreciated.

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros