Problem with Try Catch Block

S

scarfinv

I have a line of code inside a Try, that is throwing an exception of type
HLLAPISessionException.

My first Catch block is Catch ex as HLLAPPISessionException, with specific
code to be executed.

My second Catch block is Catch ex as Exception.

My problem is that an HLLAPISessionException is being thrown, but being
caught by the second catch block (Exception), rather than the first block.

I even put MsgBox(ex.GetType.ToString) inside the Catch ex as Exception
block, and it is displaying a type of HLLAPISessionException.

Why is my specific catch block being ignored?

I'm using VS 2008 SP1 targetting .NET Framework 2.0 SP2. I didn't have
this problem with my code when compiling in VS 2005 targetting .NET Framework
2.0 SP1.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top