Showing me a special form has faced a strange problem with the way one is being thrown . First of all, here is the code for the main {} where I start the splash form:
[statatread] static zero main (string [] args) {Application .EnableVisualStyles (); Application.SetCompatibleTextRenderingDefault (wrong); Thread Splash = New Thread (New Thread Start (ShowSlash)); Splash.start (); application. Play (New Mainform ()); } Static ZeroShopSlash () {SplashFormSwash = New SplashForm ()} {Application. Run (splash); }} I am using .NET2.0 with Win XP.
During some tests where the application was left to last for hours, I noticed that sometimes the exceptions increase by one or two (number obtained by Perfomon, '# Accysps Throde 'The viewers of the counter.) These exceptions have been caught by the runtime and are being swallowed because they do not copy and the application itself does not cause the wrongs to happen. At least not anything that I can determine anyway.
I've found that an exception is thrown when the user-proof event is removed by the system. After finding it, I can make exception an exception by changing the background image or screen saver, etc.
I'm not taking myself directly from this event anywhere in the code, but I understand (through power) Google's all top-level controls and forms are automated for this event Subscribe in the form.
I still do not know why this incident is being run in the first place, because it seems that the app is going on in the night, but I think another secret can be solved. is.
Now, if I stop running the Splash Form thread, the exception disappears. Run the thread, it comes back. So, it seems that the membership is not ending from some event, and since then the exception is probably due to this?
Interestingly, if I change my splash form with one default, outside the box form, the problem still remains:
Fixed zero showplash () (By using the form splash = new form ()) {application.Run (splash);}} While this form is being displayed, any exceptions in any UserPreferenceChanged events As soon as the form closes, and the thread is released, the exception is thrown. Come The research of the field has taken me forward, with the following comment:
Common reasons are a splash screen created on any control made on a secondary UI thread or worker thread.
Hmm, it seems like guilty guilty. Note that my app does not live or is not anything unpleasant.
Right now, it's comparable to anything else There is more of a curiosity, but I suspect that here Hidden for the future is waiting to bite into Ntion.
For me, it was seen as a form or a message pump that starts the application. When it is finished then the cleaning is not properly done.
Any thoughts?
Yes, you are running with system events class. That class creates a hidden window that listens to system events, especially in userfranchrange changelog events, so many controls know to use that event when they need to redraw themselves because the system colors had changed.
The problem is that the encryption code that creates a window is very sensitive to the apartment, the situation of the thread which says it is wrong in your case, you did not call the thread. SATA specialist for switching to SATA () It is important for threads displaying a UI Too many
Be careful that your solution is not really well, system events Will be raised on the wrong thread. Your splash threads instead of your program's UI threads. Whenever the actual system event is removed, you will still be random and extremely difficult to diagnose failure. The most notorious when the user locks the workstation, then the program is deadlock when it is unlocked.
I think calling the thread.Set adapterstate () should fix your problem. Not 100% fixed, these UI thread interactions are very hard to analyze and I have not found this wrong. Note that .NET is already very much for the splash screen. It certainly receives details like this right.
Comments
Post a Comment