Why do my exception stack traces always point to t

2019-05-21 14:08发布

问题:

I have a problem with my Visual Studio installation. When I got an exception I always have incorrect line numbers in it's stack trace. There are always point to last line of each method in my codebase. At the same time it's OK when I'm tracing programs with debugger. What's happed with PDBs?

No, I'm not re-throwing exception at each method.

In each line of stack trace I have last row of corresponding method, while exception had thrown by statement in the middle.

回答1:

Sounds like you're running your app in Release mode. Release mode has difficulties with line numbers for exceptions and whatnot.

Compile your app in Debug mode (no need to attach the debugger) and see if it sorts itself out.