We help IT Professionals succeed at work.

visual studio - debugging- static object cannot be reset

pwerstreak
pwerstreak asked
on
I have a class in a WindowsApplication with a member static object that contains other static members. These don't seem to get reset once they're loaded - even after I close down Visual Studio 2008 and reopen the project and debug. There's no app.vshost.exe running either. Anyway I can flush these static objects?
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2015
Commented:
That doesn't quite make sense. Static members only retain their data as long as they are in memory--just like any other variable. Are you sure you are not loading data from a file, perhaps, or maybe initializing the data in some obscure method?
check running processes (zombie processes too), it should be cleared when no running process uses the class.

is this app not hosted in iis or a windows service which remains running?

CERTIFIED EXPERT
Top Expert 2015
Commented:
Are you sure that they are not set somewhere or that they are not set to a default value?

Put a breakpoint on the first line to execute in your application and examine their values, either in the Watch window or the Immediate window.

Show us the code of the class, we might be able to see something that escapes you.
I'd thought as much but wondered if there may've been some IDE property I didn't know about that was causing it.  Found a spot where the class was already populating these vars and wasn't breaking- latenight duh moment.

Thanks

Author

Commented:
none
CERTIFIED EXPERT
Most Valuable Expert 2011
Top Expert 2015

Commented:
Glad you tracked it down  = )

Explore More ContentExplore courses, solutions, and other research materials related to this topic.