1

I'm using ChromiumWebBrowser in my program. I created a UserControl to contain a ChromiumWebBrowser instance, and in the MainForm, I load UserControl into a SplitContainer. When I debug my program, If I hit a breakpoint into dispose method, program run correctly. enter image description here

But if I delete breakpoint, and run debug, then program crashed. enter image description here

I can not find the cause of the error. Anyone explain to me?

Minh Giang
  • 631
  • 9
  • 28
  • Maybe there's another thread running which is trying to access your controls? When you hit a breakpoint it has time to end and then you can proceed? – Kamil T May 06 '16 at 10:28
  • what exception is thrown? – user1666620 May 06 '16 at 10:29
  • This is race condision you are dealing with. Please, provide more information on other threads running in parallel. – Karolis Kajenas May 06 '16 at 10:41
  • I already try-catch everywhere, but were unable to catch any errors, so I don't know what exception :(. I've tried sleep a few second before dispose control, but errors still occurred. – Minh Giang May 06 '16 at 10:45
  • @Carl my program in single thread – Minh Giang May 06 '16 at 10:56
  • "By default, the debugger can only diagnose exceptions that are raised on a thread started by managed code." http://stackoverflow.com/questions/14381842/vshost32-exe-stopped-working-but-i-can-continue-debugging – DaFi4 May 06 '16 at 10:59
  • I'd almost suggest you remove controls from their parent before trying to `Dispose` them. Also if your using a `CEF` based framework (you really should tag which one), then it's multi threaded, so you must be careful which handlers you call what from. – amaitland May 09 '16 at 11:01

0 Answers0