views:

212

answers:

3

It happens quite frequently, more times per day, that with Visual Studio 2010, during the debugging, when I used Immediate commands like:

? NamedVariable

I receive the following error:

'NamedVariable' is not declared. It may be inaccessible due to its protection level.

In this case also other debug features seems gone, but I can set breakpoints, step into, step over, etc.

The solution is stop debugging, clean and rebuild the project, and retry.

I am developing a VB.NET Windows Forms application, but it happened with VB.NET WPF projects too. I never had this behavior with VS 2008.

Is this a known bug or could it be a problem of my environment/installation? Do you have any idea how to solve this little, but annoying issue?

A: 

Try, making sure the code file that contains the variable is displayed and the cursor is within the same scope of the variable.

Try, deleting the solution's user options file (suo). You will lose your settings, such as bookmarks, breakpoints, and other user solution settings.

AMissico
A: 

This is happening to me, too, quite frequently. In fact, it is happening right now. Deleting the .suo file did not resolve the problem.

Jon
A: 

This happens quite often to me, too. And the only solution I found out up to now is:

The solution is stop debugging, clean and rebuild the project, and retry.

Deleting the suo file will not help. And it can happen anywhere in the code and does not seem to be depending on the code itself.

I think this is happening mostly after I modified some code during debugging or after a lot of minor changes and builds before the debugging. Maybe the debugging information gets "lost" or "unsynrconised" during some partial build process.

I think its a VisualStudio bug and that it will be fixed in a hopefully soon ServicePack.

WizzardsApprentice
It continuously happens to me and my colleagues, I think that is a Visual Studio bug too. Very annoying.
marco.ragogna