Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

How can my static class become undefined??

I am running a C# project inside Visual Studio 2015, and have a strange problem where a static class becomes undefined??

Upon a Clean of my solution, the attached image proves the value Is Defined...


User generated image

When I run the solution a second time, Constants Become UNdefined.

User generated image
Any ideas how this is possible?

I am not running Code Optimization, I believe.

Thanks.
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

>>When I run the solution a second time, Constants Become UNdefined.

You mean that you stop and you restart your application? All the memory containing variables (static or not) are released when you stop the application!
Avatar of curiouswebster

ASKER

Yes, when I restart the app  (F5) and I hit the breakpoint shown, the Constant static object is no longer defined. When I Clean before pressing F5, that breakpoint shows me Constant static object is visible in the Watch Window.
but what is the active line (the yellow one) on your first image?
In both images, I hit the same breakpoint. In the first image, I have rested F10 and moved the cursor to the next line.

The point is that when I hovered over the value in the first image, the string value "lcckey" is visible in the floating text. So, the Constant static object is resolving.

In the second image, notice the Watch Window at the bottom, the same USER_LCC_KEY is undefined since Constant is also undefined.
SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
But it's a Static Class....
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks