c# - Application freezes outside of Visual Studio. While starting it from Visual Studio it works -
slowly i'm overworked...
i have huge application threading, timers, invoke (not begininvoke, synchronous) , application.doevents.
it post here , don't know problem is.
every method of mine inside try catch. every catch logged.
if start application visual studio (f5) or while profiling via ants there no problem. application runs since days. start same debug version via windows explorer freezes every few hours. freezes without exception or so. if attach visual studio application , break it, stops on application.run(new form1());
i'm confused , have no idea repair it.
it .net 3.5 winforms application
it looks 1 thread hangs here:
if (grabber.invokerequired) { console.writeline("grabber.invokerequired"); this.invoke((methodinvoker) delegate { grabber.navigate("http://www.google.de"); }); // <-- hang } else { grabber.navigate(ig.starturl); } this snippet part of timer event
_timeout = new system.timers.timer(10000); _timeout.elapsed += new elapsedeventhandler(onwatchdogbark); edit
a sample doevents(). in lock() , in invoke
grabber.documentcompleted -= grabber_documentcompleted; grabber.navigate("http://www.google.de"); while (grabber.readystate != webbrowserreadystate.complete) { timeout--; application.doevents(); thread.sleep(200); if (timeout < 0) { timeout = 50; grabber.navigate("http://www.google.de"); } } currently use system.windows.forms.timer , locks there no improvement.
okay used windbg informations
edit: 14.06.2012
!threads
preemptive gc alloc lock id osid threadobj state gc context domain count apt exception 0 1 37ec 007cab18 6020 enabled 00000000:00000000 007c8510 0 sta system.argumentexception (02762ba8) 2 2 85b8 007d7c38 b220 enabled 00000000:00000000 007c8510 0 mta (finalizer) xxxx 3 0 06e9f548 9820 enabled 00000000:00000000 007c8510 0 ukn 21 5 3464 0d6dc598 200b020 enabled 28cb5820:28cb5fe8 007c8510 0 mta 22 6 62b0 0d6db9e0 200b220 enabled 00000000:00000000 007c8510 0 mta 23 7 8e58 0d6db5f8 80a220 enabled 00000000:00000000 007c8510 0 mta (threadpool completion port) xxxx 4 0 06f62d40 1801820 enabled 00000000:00000000 007c8510 0 ukn (threadpool worker) xxxx f 0 132a3290 1801820 enabled 00000000:00000000 007c8510 0 ukn (threadpool worker) xxxx 10 0 132a3678 1801820 enabled 00000000:00000000 007c8510 0 ukn (threadpool worker) xxxx e 0 132a26d8 1801820 enabled 00000000:00000000 007c8510 0 ukn (threadpool worker) xxxx 9 0 0d6db210 1801820 enabled 00000000:00000000 007c8510 0 ukn (threadpool worker) !dlk
examining syncblocks... scanning readerwriterlock instances... scanning holders of readerwriterlock locks... scanning readerwriterlockslim instances... scanning holders of readerwriterlockslim locks... examining criticalsections... not find symbol ntdll!rtlcriticalsectionlist. no deadlocks detected.
could possible deadlock in background thread. try looking @ other threads block app.
toolbar -> debug -> windows -> threads http://msdn.microsoft.com/en-us/library/w15yf86f.aspx
there should multiple threads , if double click 1 see line stopping app.
and if line in code:
control.checkforillegalcrossthreadcalls = false; set true again. possible cause dead locks background thread accessing controls.
instead of writing backgroud threads.
button1.text = "hello" write this.
this.invoke(() => button1.text = "hello");
Comments
Post a Comment