G
Guest
I'm doing some interop work and I intended to use ThrowExceptionForHR to
convert HRESULTs into .Net exceptions. But ThrowExceptionForHR doesn't seem
to do anything as this simple C# illustrates:
static void Main(string[] args)
{
try
{
Console.WriteLine("before");
Marshal.ThrowExceptionForHR(5);
Console.WriteLine("after");
}
catch (Exception e)
{
Console.WriteLine("exception");
Console.WriteLine(e.Message);
}
}
I would expect to see the output "before;exception;message" but I actually
see "before;after". No exception is being thrown. Am I missing the point?
I'm using VS 2005.
convert HRESULTs into .Net exceptions. But ThrowExceptionForHR doesn't seem
to do anything as this simple C# illustrates:
static void Main(string[] args)
{
try
{
Console.WriteLine("before");
Marshal.ThrowExceptionForHR(5);
Console.WriteLine("after");
}
catch (Exception e)
{
Console.WriteLine("exception");
Console.WriteLine(e.Message);
}
}
I would expect to see the output "before;exception;message" but I actually
see "before;after". No exception is being thrown. Am I missing the point?
I'm using VS 2005.