Reputation: 13
I have a string which I declare as "" at the start of a method. I've set up breakpoints each time the string is used. The first time I debug the app, it rightly stops at where I declared the variable. Then I stop debugging, try debug again, and it doesn't stop where the variable is declared - it stops at where I am supposed to be giving it a value for the first time (except it already has a value according to VS debugger!!). It's not just when I debug, it's when I run the app normally too. Restarting ASP.NET Development Server fixes the problem. Anyone have any ideas?
Upvotes: 1
Views: 118
Reputation: 1302
Read about static members Static Classes and Static Class Members. I think you declared static field at global.asax file or somewhere similar. Because of it field is initialzed only once at appliaction start. When you start/stop/start debugging of application, you not restart application. Application restart occurs when you restart ASP.NET Development Server.
Upvotes: 1