Problem with Try Catch Block

  • Thread starter Thread starter scarfinv
  • Start date Start date
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.
 
Back
Top