«

»

Jun
22
2007

Mehrstündiges DoEvents führt zum Absturz!?

Wieder einmal haben wir einen kuriosen Fehler in unserer Applikation lösen können. Nach mehreren Stunden der Ausführung des DoEvents-Befehls kann eine .NET Applikation abstürzen.

View Code VBNET
1
2
3
While Not isComplete
   System.Windows.Forms.Application.Doevents()
End While

Dies Schlaufe verursacht bei deren Ausführung über mehrere Stunden hinweg die folgende Exception:

Das Element wurde bereits hinzugefügt. Schlüssel im Wörterbuch: “-1″ Hinzuzufügender Schlüssel: “-1″

Der Stacktrace der Ausnahme lautet wie folgt:

1
2
3
4
5
6
at System.Collections.Hashtable.Insert(Object key, Object nvalue, Boolean add)
at System.Collections.Hashtable.Add(Object key, Object value)
at System.Windows.Forms.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FRegisterComponent(IMsoComponent component, MSOCRINFOSTRUCT pcrinfo, Int32& dwComponentID) at System.Windows.Forms.ThreadContext.get_ComponentManager()
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.DoEvents()

Permanentlink zu diesem Beitrag: http://www.matusz.ch/blog/2007/06/22/mehrstundiges-doevents-fuhrt-zum-absturz/

Hinterlasse eine Antwort

Ihre E-Mail-Adresse wird nicht veröffentlicht.

Sie können diese HTML-Tags verwenden: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>