VBobCat
VBobCat

Reputation: 2732

Get more details about handled exceptions in Visual Studio (Immediate Window)

When running a VB.NET Winforms application in Visual Studio 2015 (debug mode), Immediate Window shows notice about handled exceptions this way (it is in Portuguese but I think English is not so different):

Exceção gerada: 'System.NullReferenceException' em MyApp.exe
Exceção gerada: 'System.NullReferenceException' em MyApp.exe
Exceção gerada: 'System.NullReferenceException' em MyApp.exe
Exceção gerada: 'System.NullReferenceException' em MyApp.exe
Exceção gerada: 'System.NullReferenceException' em MyApp.exe
Exceção gerada: 'System.NullReferenceException' em MyApp.exe

My question is: can I adjust some setting so that it shows also where it comes from? (filename and line number, or method name, or both if possible)

Thank you very much.

Upvotes: 1

Views: 504

Answers (1)

taracus
taracus

Reputation: 393

I cant promise this is a fix because my portugese is limited, but there is a window called Exception Settings that you can usually bring up with CTRL+ALT+E, where you have checkboxes for all types of exception and if your code should break when they happen.

Find the one called NullReferenceException for example and make sure it's checked and your code should break when the exceptions are thrown (gerada?).

If you have problems finding the Exception Settings window check top answer on this post:

Visual Studio 2015 break on unhandled exceptions not working

Upvotes: 1

Related Questions