Click here to Skip to main content
15,903,854 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Polymorphic object comparison Pin
Benny_Lava10-Jun-10 0:57
Benny_Lava10-Jun-10 0:57 
AnswerRe: C# Polymorphic object comparison Pin
LookSharp11-Jun-10 13:13
LookSharp11-Jun-10 13:13 
Questioncrystal reports and c# (report directly with parameters). Pin
Absoluto9-Jun-10 22:10
Absoluto9-Jun-10 22:10 
AnswerRe: crystal reports and c# (report directly with parameters). Pin
Adam R Harris10-Jun-10 5:52
Adam R Harris10-Jun-10 5:52 
QuestionIntelliSense bug in VS2005 Pin
Mc_Topaz9-Jun-10 21:54
Mc_Topaz9-Jun-10 21:54 
AnswerRe: IntelliSense bug in VS2005 Pin
#realJSOP10-Jun-10 4:29
professional#realJSOP10-Jun-10 4:29 
GeneralRe: IntelliSense bug in VS2005 Pin
Mc_Topaz10-Jun-10 4:38
Mc_Topaz10-Jun-10 4:38 
GeneralRe: IntelliSense bug in VS2005 Pin
dybs12-Jun-10 10:19
dybs12-Jun-10 10:19 
Question.net framework 4 Pin
michaelgr19-Jun-10 20:46
michaelgr19-Jun-10 20:46 
AnswerRe: .net framework 4 Pin
Abhinav S9-Jun-10 21:01
Abhinav S9-Jun-10 21:01 
AnswerRe: .net framework 4 Pin
Pete O'Hanlon9-Jun-10 21:38
mvePete O'Hanlon9-Jun-10 21:38 
QuestionMicrosoft sync framework Pin
hadad9-Jun-10 20:37
hadad9-Jun-10 20:37 
Questionhow to recognize the identityfing code in the image Pin
yu-jian9-Jun-10 20:16
yu-jian9-Jun-10 20:16 
QuestionTextureBrush problem Pin
Xmen Real 9-Jun-10 17:41
professional Xmen Real 9-Jun-10 17:41 
AnswerRe: TextureBrush problem Pin
Luc Pattyn9-Jun-10 17:58
sitebuilderLuc Pattyn9-Jun-10 17:58 
GeneralRe: TextureBrush problem Pin
Xmen Real 10-Jun-10 4:31
professional Xmen Real 10-Jun-10 4:31 
QuestionError in printing Pin
future38399-Jun-10 13:45
future38399-Jun-10 13:45 
AnswerRe: Error in printing Pin
Luc Pattyn9-Jun-10 14:04
sitebuilderLuc Pattyn9-Jun-10 14:04 
GeneralRe: Error in printing Pin
future38399-Jun-10 14:20
future38399-Jun-10 14:20 
GeneralRe: Error in printing Pin
Luc Pattyn9-Jun-10 14:36
sitebuilderLuc Pattyn9-Jun-10 14:36 
QuestionExceptions From Threads Pin
JohnLBevan9-Jun-10 12:03
professionalJohnLBevan9-Jun-10 12:03 
AnswerRe: Exceptions From Threads Pin
Luc Pattyn9-Jun-10 12:52
sitebuilderLuc Pattyn9-Jun-10 12:52 
So what you have created here is:
- a main thread launching a repetitive timer;
- a timer executing "something" on another thread (which happens to be an arbitrary ThreadPool thread);
- as your Run() method takes longer than your timer's interval, two ThreadPool threads are likely to be executing the Run() method in an overlapping way, i.e. a second will start before the first has finished.

No, whatever goes wrong in Run() stays in there. The threadpool thread will survive but not report anything.
Unless (I'm not sure, haven't done this for a while) you set a handler to Application.ThreadException; but then that handler will possibly catch a lot, and your app will in general have a hard time to somehow recover from whatever went wrong.

Here is an alternative that may or may not fit your needs: have a look at BackGroundWorker; this basically is a thread that executes your work; when everything is done, it fires its RunWorkerCompleted event, which (1) runs on the main thread (assuming you created the BGW on the main thread), so you can touch GUI Controls freely from there; and (2) has an Error parameter that holds any uncaught exception that may have occured in (and terminated execution of) the DoWork handler. This way, the exception is there, when you want it, and close to what has caused it.

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

I only read formatted code with indentation, so please use PRE tags for code snippets.

I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).

GeneralRe: Exceptions From Threads Pin
JohnLBevan10-Jun-10 1:52
professionalJohnLBevan10-Jun-10 1:52 
QuestionThreads, Static Fields & Abstract Classes Problem Pin
JohnLBevan9-Jun-10 11:53
professionalJohnLBevan9-Jun-10 11:53 
AnswerRe: Threads, Static Fields & Abstract Classes Problem Pin
Luc Pattyn9-Jun-10 12:43
sitebuilderLuc Pattyn9-Jun-10 12:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.