C# interview question

This is an interview question I need help with.

You have the following ASP.NET code-behind class:

public partial class Page1 : Page 
{
    private string _value;

    public Page1() 
    {
        if (DateTime.Now.Ticks % 10 == 0)
            _value = "Test";
    }       

    ~Page1() 
    {
        if(_value.Equals("Test"))
            _value = string.Empty;      
    }
}

Any time someone requests this page, the w3wp.exe process terminates unexpectedly.

  • Why does this occur versus the user seeing a yellow screen of death (default ASP.NET error page)?

  • Why is there always an OutOfMemoryException present on the managed heap?

9
задан SuperMan 9 April 2011 в 21:36
поделиться