aspnet / Tooling

Issue tracker and info on Visual Studio tooling for ASP.NET
Other
256 stars 124 forks source link

When declaring a method-scoped const and debugging, Watches will show CS0648, Locals window will be empty #239

Open ericwj opened 9 years ago

ericwj commented 9 years ago

The Locals window will be empty in Visual Studio 2015 when debugging a method that has a local const declaration. Valid Watches will in addition show an error.

error CS0648: '' is a type not supported by the language

The code runs fine. Stepping out of the method with the const declared will instantly have the Watches and Locals windows behave as normal again.

I found others reporting this on Stack Overflow but probably not with the right tags. I'm on beta8. It happens on all runtimes/architectures and people report this on different project types. I'm using plain C#+xunit.runner.dnx right now.

Reproduce: put a breakpoint in the following method, add i and n as watches and keep an eye on Locals and Watches while stepping through both methods. Then declare n as var and do it again.

public void Main() {
    string ding = "Hellow Orld!";
    CS0648(); 
    Debug.WriteLine(ding);
}
public void CS0648() {
    const int n = 100;
    for (int i=0; i< n; i++) continue;
}

I'm not quite sure if this is the right repo to report this. Maybe it's a Roslyn issue. I'll repost if needed. Let me know.

sayedihashimi commented 8 years ago

TFS: 162813 I've added this to our internal TFS, we will reply back here soon.

KevinH-MS commented 8 years ago

Hello @ericwj . I apologize for the tremendous delay in getting back to you on this. I just saw the issue in the internal TFS, and I tried out this scenario on VS "15" Preview 5 (https://www.visualstudio.com/visual-studio-pre-release-downloads/), and it appears to be fixed (although I don't recall the exact change that might have resolved this issue). It's also very likely fixed in VS 2015 Update 3 (because there aren't many differences between the two with respect to this scenario). Please let us know if this is still an issue for you.

ericwj commented 8 years ago

Yes, thanks. It is resolved for me in VS 2015 now.

webtools-bot commented 7 years ago

The GitHub Issue Tracker for the aspnet/Tooling repo is being deprecated in favor of Visual Studio's Report a Problem tool.

If this issue is still a problem with the RTW release of Visual Studio 2017, please report a new issue using the Report a Problem tool. While you can still use .NET Core and ASP.NET Preview tools with Visual Studio 2015, Visual Studio 2017 is now the officially supported tool for developing .NET Core and ASP.NET Core projects.

By using the Report a Problem tool (available in both VS 2017 and VS 2015), you can collect detailed information about the problem, and send it to Microsoft with just a few button clicks. See Visual Studio's Talk to Us page for more details.

Please use the discussion topic here for feedback and questions on the deprecation of this issue tracker. Thanks!