try-catchrealbasicrealstudio

Why does Real Studio Break on the Catch of an Exception?


I have a try-catch block like this:

Try
  Listbox1.RemoveRow(Listbox1.ListIndex)
Catch err As OutOfBoundsException
  MsgBox("Derp")
End Try

When I run my project in the debugger I get an OutOfBoundsException on the exact line I was trying to catch! Why doesn't this work?!?


Solution

  • Seems to me like the debugger will break at that line and show you the exception. But if you hit resume, it will continue, catch the exception, and then display the message.

    Maybe they changed the behavior of the debugger with this release.

    Update: You can go to Project > Break on exception to change this