0

I have problem with debuging code. I try to resolve one bug, but when I set breakpoint in catch statement and add watch to see details I get message from Visual Studio like below. Why? Can anyone explain me why is happens?

enter image description here

Jacek
  • 11,661
  • 23
  • 69
  • 123
  • Are you starting the application in the debugger, running in Debug mode? Also, you can usually use `$exception` to get the current exception. – Luaan Sep 22 '15 at 09:04
  • 1
    I set in web.config DEBUG to true and turn off code optimalization – Jacek Sep 22 '15 at 09:05
  • 4
    You may want to read [this question](http://stackoverflow.com/questions/730250/is-there-a-difference-between-throw-and-throw-ex) given your use of `throw exc`. If that's what you want, fair enough - just be aware of the difference... – James Thorpe Sep 22 '15 at 09:09
  • When you step one further? It may do the declaration actually when it is used. Are you sure you have the current code in the debugger? – Stefan Steinegger Sep 22 '15 at 09:11
  • Is your project a Web Application project or a Web Site project? – Matteo Umili Sep 22 '15 at 09:22
  • In the IDE, the compilation configuration is "Debug" or "Release"? – Matteo Umili Sep 22 '15 at 09:24
  • Did you add exc just now or did you add it for a different method before? – Thomas Weller Sep 22 '15 at 09:45

2 Answers2

1

try to set "generate debug info" to "full" in the Compiler-settings

anion
  • 1,516
  • 1
  • 21
  • 35
0

This error frequently occurs if you declare a variable in a loop or a try or if block and then attempt to access it from an enclosing code block or a separate code block.

BSG
  • 2,084
  • 14
  • 19