Reputation: 37
How to know that which line throws an exception in c# code.
I facing Selection Out of range exception directly on browser, so i can't detect where is the problem.
I try debugging many times but can't find where is the problem.
Please help me to solving this.
Upvotes: 1
Views: 3134
Reputation: 51
If you are using Visual Studio for debugging your server code, check the Exception Settings (if they are not visible go to the menu 'Debug' -> 'Windows -> 'Exception Settings'
and they should appear in the lower right by default) and make sure that the debugger is set to break on the relevant exceptions - in your case I would check the 'Common Language Runtime Exceptions'
tree, specifically the 'ArgumentOutOfRangeException'
there (but I usually enable the whole tree).
With this setting enabled on your next debug session, the visual studio debugger should break where the exception is thrown and show you a popup with details.
Upvotes: 4
Reputation: 19
Upvotes: 0