Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!
You are not logged in or you do not have permission to access this page. This could be due to one of several reasons:
You are not logged in. If you are already registered, fill in the form below to log in, or follow the "Sign Up" link to register a new account.
You may not have sufficient privileges to access this page. Are you trying to edit someone else's post, access administrative features or some other privileged system?
If you are trying to post, the administrator may have disabled your account, or it may be awaiting activation.
Logging in...
Previously on ".NET 1.1 Exceptions during shutdown"
With complex multithreaded apps always test your application on a single processor/single-core machine and also a multiprocessor/multi-core machine as a lot of strange errors can be found during testing that only show up on one or the other configurations.
They run it on a dual core machine and all bets are definitely off.....
Fortunately the hardware platform is very specific.
With complex multithreaded apps always test your application on a single processor/single-core machine and also a multiprocessor/multi-core machine as a lot of strange errors can be found during testing that only show up on one or the other configurations.
Hrm, you could use Thread[2].ThreadState and check to see if an abort has been requested.
Ah, yes. That might do. I'll hack around that and see what I can come up with
The other problem is it happens infrequently. Can't make the bugger do it now. It's timing critical.
This leads to another question
What I **think** is happening is:
If thread 2 (which is a itmer callback) is not actively executing when the app exits then it's all OK
If it is then I am surmising that:-
- The app has asked Thread 3 to abort (the thread of the component I am using).
- If this happens then the objects this is using get disposed but I have no way of knowing this from the available interface.
- There is a thread switch during the execution of the code in Thread 2 (this happens to be a short piece of code on a timer callback).
So, is there a way to block all other threads during a method [I rather imagine this would be somewhat dangerous to say the least though].
Ok, I have a thread [t2] which is happily running around. This uses some objects supplied by a third party (in this case microsoft).
Now as the app is terminated the thread [t2] gets terminated, but the objects it is using are on yet another thread [t3]. This get killed first.
Now, the first part of the problem is that the objects dspose themselves and throw "disposed" exceptions. Thus [t2] gets an exception what it tries to access their parent object [on which there is no indication of disposed].
So, I can esily enough code an exception handler to swallow disposed exceptions - but that is a bit too agressive. What I want to do is detect that the application is shutting down. I can't seem to find a way of detecting this :-(. [except maybe by producing an exception handler for threads and checking IsTerminaring]
n.b. System.Environment.HasShutdownStarted is false at this point
[I can't simply set a property somewhere myself, the application does not have a structured exit, any exit is only caused by an abort of some description]
Leave a comment: