I have the following code in a view model:
public Point Location { get { var rangePixels = Range * PixelsPerMile; var xCoordinate = OwnLocation.X * MapScale + rangePixels * Math.Cos(Theta); var yCoordinate = OwnLocation.Y * MapScale - rangePixels * Math.Sin(Theta); return new Point(xCoordinate, yCoordinate); } }
One of the headers at the top of the code file is the System , which contains Math .
If I look at Math.Sin(Theta) in the Watch window (by selecting the code, right-clicking and selecting "Add Watch"), I get the following error:
The name "Math" does not exist in the current context
What I want to know:
- Is this the expected / standard behavior for Visual Studio 2010? I could have sworn that this was never a problem, but perhaps it always worked like that, and for some reason I did not notice.
- If it is not normal to get this error, any thoughts on what could be the problem? Visual Studio has a million settings, and I don't know where to start.
I should note that this question is vaguely similar to this one , but I have no problems with my local variables and I am not using PostSharp.
Edit
I just tried resetting all my Visual Studio settings to the default, and I still get the same error. If someone wants to try a simple test in Visual Studio, I just want to know if you get an error message if you add a clock for Math.Sin(1) .
Edit 2
Here are some screenshots to show what I'm experiencing:


Edit 3
Interestingly, intellisense works if I type Math. in the Watch window, but if I complete the expression, I still get the error:

Change 4
To ask BACON questions:
- I get the same behavior with QuickWatch and Immediate.
- Closing and reopening all windows does not solve the problem.
- I am using Visual Studio 2010 Professional (version 10.0.40219.1 SP1Rel)
- I tried targeting the .NET 4.0 Client Profile and the full .NET 4.0. There was no difference. I created a console application (and not a WPF application) focused on the .NET 4.0 client profile, and finally an error did not occur. Thus, WPF can be a problem (or WPF with some third-party libraries). (Will be checked for the following.)
debugging c # visual-studio visual-studio-2010 mono.cecil
devuxer
source share