Quiz: Gotcha with Exceptions and HRESULTs

The C# code below, when executed, prints the following:

  0x80004002

  0x80004002

Who can figure out why the second line printed isn't 0x80004003?

using System;

using System.Runtime.InteropServices;

public class Quiz

{

  const int E_NOINTERFACE = unchecked((int)0x80004002);

  const int E_POINTER = unchecked((int)0x80004003);

  public static void Main ()

  {

    try

    {

      Marshal.ThrowExceptionForHR(E_NOINTERFACE);

    }

    catch (Exception ex)

    {

      Console.WriteLine("0x{0:x}", Marshal.GetHRForException(ex));

    }

    try

    {

      Marshal.ThrowExceptionForHR(E_POINTER);

    }

    catch (Exception ex)

    {

      Console.WriteLine("0x{0:x}", Marshal.GetHRForException(ex));

    }

  }

}