Static values keeping their instance after stopping the debugger
-
Hi, I am debugging through a web application that was written in C#. When the app loads it gets some values using static methods. Whenever I stop the debugging and run it again then it doesn't go into these static methods again as they are static. I want to kill this static variable instance so that I can debug through these methods again. I have stopped the web server in VS2010, but it doesn't work. I hope I am making sense? :) Thanks
-
Hi, I am debugging through a web application that was written in C#. When the app loads it gets some values using static methods. Whenever I stop the debugging and run it again then it doesn't go into these static methods again as they are static. I want to kill this static variable instance so that I can debug through these methods again. I have stopped the web server in VS2010, but it doesn't work. I hope I am making sense? :) Thanks
That isn't what static methods mean. Static means that they do not rely on an instance of the object. If you call the method it will be executed every time it is called. If you aren't hitting your breakpoints in the static method then something else is going wrong.
-
That isn't what static methods mean. Static means that they do not rely on an instance of the object. If you call the method it will be executed every time it is called. If you aren't hitting your breakpoints in the static method then something else is going wrong.
Thanks for the reply. I'm actually testing a singleton that was written to retrieve global values. It's the first time I am working with singleton so I am debugging to see how it works. The first time I ran it I got the instance of the singleton object, then I stopped it. I ran it again, and it doesn't go into the property where it returns the singleton's instance. I am using VS2010. Thanks
-
Thanks for the reply. I'm actually testing a singleton that was written to retrieve global values. It's the first time I am working with singleton so I am debugging to see how it works. The first time I ran it I got the instance of the singleton object, then I stopped it. I ran it again, and it doesn't go into the property where it returns the singleton's instance. I am using VS2010. Thanks
Too many pronouns. When you ran "it", is "it" an exe, a method? If "it" is a method I would not expect a singlton to run the code to create an instance more than once. That is what makes something a singleton. Your description of the situation is far too vague to really give you any concrete answers.