c# - What is the rationale behind the (probably undocumented) cases of .NET suppressing exceptions? -


i trying grasp the .net criterion where, when .net exceptions suppressed, swallowed or passed unnoticed in order detect/suspect/prevent/be on alert such incidents.

the msdn online article "timer class" on .net framework 4.5 states:

in .net framework version 2.0 , earlier, timer component catches , suppresses exceptions thrown event handlers elapsed event. behavior subject change in future releases of .net framework

hmmm, .net 4.5 future release in relation .net 2.0?
though rhetorical question , not care specific case mentioned in docs.

what care , want understand is:
criterion, principles , rationale according .net exceptions being suppressed?

update (in response eugen rieck's answer:

so question is: thread should subject exception thrown on timer tick?

citing msdn article "exception handling (task parallel library)" :

if not wait on task propagates exception, or access exception property, exception escalated according .net exception policy when task garbage-collected.

(funny ".net exception policy" not find anywhere ...)

well, interested in wpf app, which, understand, sta , has 1 main parent thread.
wish crashes if exception unhandled.

update2 (in response matt smith' comment):

yes, know. citing <throwunobservedtaskexceptions> element:

if exception associated task has not been observed, there no wait operation, parent not attached, , taskexception property not read task exception considered unobserved.

in .net framework 4, default, if task has unobserved exception garbage collected, finalizer throws exception , terminates process. termination of process determined timing of garbage collection , finalization.

to make easier developers write asynchronous code based on tasks, .net framework 4.5 changes default behavior unobserved exceptions. unobserved exceptions still cause unobservedtaskexception event raised, default, process not terminate. instead, exception ignored after event raised, regardless of whether event handler observes exception.

in .net framework 4.5, can use element in application configuration file enable .net framework 4 behavior of throwing exception.

i skipped go further on avoid bloafing of question , getting reference explanation stephen toub's "task exception handling in .net 4.5"

the question after (really wanted start question) make sure me :

here's link policy (it changed in .net 2.0) , has remained same since then: http://msdn.microsoft.com/en-us/library/ms228965.aspx


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -