Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

asp.net unhandled exception and appdomain termination

$
0
0

As far as I have read an unhandled exception terminates the appdomains and the process. But, I am facing a seemingly contradictory/ambiguous behavior as described below -

I have made a simple asp.net web application with 2 simple pages: Webform1.aspx and Webform2.aspx with the code shown below

Webform1.aspx

protected void Page_Load(object sender, EventArgs e)    {    } 

protected void Button1_Click(object sender, EventArgs e)  {    Thread.Sleep(20000);   


Webform2.aspx

protected void Page_Load(object sender, EventArgs e)    
{        
    throw new Exception("Something Happened.");    
}

I start by running Webform1.aspx and click Button1 which makes the current thread go to sleep. Then from another browser window I run Webform2.aspx. The exception caused by Webform2 should cause the appdomain for the application to terminate and affect the processing for Webform1.aspx but seemingly that doesnt happen as Webform1.aspx continues to be processed normally.

 This is ofcourse the desired behaviour, but I want to know how does the Webform1 processing continues after the exception, if the  appdomain is terminated? Am I missing something here?

Viewing all articles
Browse latest Browse all 1710

Trending Articles