Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RC 26127.3: Debugger broken when using tuples #16879

Closed
YaakovDavis opened this issue Feb 1, 2017 · 13 comments
Closed

RC 26127.3: Debugger broken when using tuples #16879

YaakovDavis opened this issue Feb 1, 2017 · 13 comments

Comments

@YaakovDavis
Copy link

YaakovDavis commented Feb 1, 2017

Version Used: 26127.3

Steps to Reproduce:

  1. Place a breakpoint at the ending brace of the Main method bellow:
    class Program
    {
        static void Main(string[] args)
        {
            var a = 77;
            var b = (5, 6);
        }
    }
  1. Run and wait for the breakpoint to hit.
  2. Hover over a. No info tooltip will appear.
  3. Right-click a and select Quick Watch. The following error will be displayed:
    error CS8182: Predefined type 'ValueTuple`2' must be a struct

The above behavior reproduces for any variable/field used in the method body, except for the tuple ones.
When removing the code that uses tuples, debugging works normally.

@gafter
Copy link
Member

gafter commented Feb 1, 2017

/cc @jcouv @VSadov @jaredpar FYI

@VSadov
Copy link
Member

VSadov commented Feb 1, 2017

Interesting. Visualizing b that is actually a tuple works fine.
It is the a that is just a regular int local causes a trouble.

@jcouv
Copy link
Member

jcouv commented Feb 1, 2017

@YaakovDavis Thanks for reporting this problem.
Did you define your own ValueTuple type? The one that we ship (currently as a nuget package) is a struct. Using that nuget package on recent version of VS 2017 RC.3, I was not able to repro the problem.
Never mind, Vlad was able to repro with the ValueTuple package from nuget.

I'm curious what's going on. My attempt didn't repro.
image

image

image

@jcouv jcouv added this to the 2.1 milestone Feb 1, 2017
@YaakovDavis
Copy link
Author

YaakovDavis commented Feb 2, 2017

I can confirm that I'm using the Nuget package as well.

In case it helps, the following repros it as well:

    class Program
    {
        static (int a, int b) t;
        static void Main(string[] args)
        {
            var a = 77;
            var b = t;
        }
    }

b and t are hoverable, while a is not. (The tuple syntax doesn't need to actually appear in the method's body; merely referring one causes the issue. This also repros with composite types containing tuples, like (int a, int b)[], List<(int a, int b)>, etc.).

@YaakovDavis
Copy link
Author

YaakovDavis commented Feb 2, 2017

Downgrading the nuget package to 4.3.0-preview1-24530-04 solves the issue.

@Cakez0r
Copy link

Cakez0r commented Mar 21, 2017

I had this issue too and it was resolved by downgrading to 4.3.0-preview1-24530-0. After reading the referenced issue #16930, I'm confused about whether this is a bug or user error. Is it possible to fix this issue with a code change on my part? What causes this error to occur?

My version spam:

Microsoft Visual Studio Community 2017
Version 15.0.26228.9 D15RTWSVC
Microsoft .NET Framework
Version 4.6.01586

Installed Version: Community

Visual Basic 2017   00369-60000-00001-AA202
Microsoft Visual Basic 2017

Visual C# 2017   00369-60000-00001-AA202
Microsoft Visual C# 2017

Visual C++ 2017   00369-60000-00001-AA202
Microsoft Visual C++ 2017

Visual F# 4.1   00369-60000-00001-AA202
Microsoft Visual F# 4.1

Application Insights Tools for Visual Studio Package   8.6.00209.10
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017   15.0.30223.0
ASP.NET and Web Tools 2017

ASP.NET Web Frameworks and Tools 2017   5.2.50127.0
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   15.0.30209.0
Azure App Service Tools v3.0.0

Azure Data Lake Node   1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio   2.2.5000.0
Microsoft Azure Data Lake Tools for Visual Studio

Common Azure Tools   1.9
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Fabric.DiagnosticEvents   1.0
Fabric Diagnostic Events

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

JavaScript UWP Project System   2.0
JavaScript UWP Project System

KofePackagePackage Extension   1.0
KofePackagePackage Visual Studio Extension Detailed Info

Merq   1.1.13-alpha (2f64b6d)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft Azure Hive Query Language Service   2.2.5000.0
Language service for Hive query

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.50131.1

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   Mono.Debugging.VisualStudio
Support for debugging Mono processes with Visual Studio.

Node.js Tools   1.3.50201.08
Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager   4.0.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

SQL Server Data Tools   15.1.61702.140
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript   2.1.5.0
TypeScript tools for Visual Studio

Visual Studio Tools for Apache Cordova   15.113.6201.1
Visual Studio Tools for Apache Cordova

Visual Studio tools for CMake   1.0
Visual Studio tools for CMake

Visual Studio Tools for Unity   3.0.0.1
Visual Studio Tools for Unity

Visual Studio Tools for Universal Windows Apps   15.0.26228.00
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

VsVim   2.3.0.0
VsVim is a Vim emulator for Visual Studio

Xamarin   4.3.0.784 (73f58d6)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android SDK   7.1.0.41 (9578cdc)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   10.4.0.123 (35d1ccd)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

@jcouv
Copy link
Member

jcouv commented Mar 21, 2017

Here's my understanding (@cston can correct):
The EE error occurs because the ValueTuple library gets loaded but it references another library (mscorlib) for ValueType. Normally, the EE will recognize that mscorlib needs to be loaded (it it wasn't already), because the compiler that it hosts produces a recognizable error, which the EE could handle.
But we had put special error handling for ValueTuple which messed that up. That special handling was fixed, and that fix is scheduled to release in the first quarterly release of VS2017 (the fix did not make it into RTM).

As to why the problem occurs with the release version of the ValueTuple package but not the pre-release version, that is even more obscure (relates to the runtime) and I do not fully understand it.

@cston, I believe that there is no known workaround aside from using the pre-release of the ValueTuple package. Is that correct?

@formdk
Copy link

formdk commented Mar 22, 2017

Wow. I had the bad luck of just running into this issue. Is there a rough ETA on the next release?

@cston
Copy link
Member

cston commented Mar 22, 2017

@jcouv I'm not aware of a workaround other than referencing the pre-release System.ValueTuple package. With the earlier package, the required assembly, System.Runtime.dll, is loaded by the debugger before hitting the breakpoint, at least with this example.

@jcouv
Copy link
Member

jcouv commented Mar 22, 2017

@formdk Sorry, I couldn't find any announced dates yet.

@jeff-pang
Copy link

Just updated the latest version 15.0.26228.12 D15RTWSVC. Issue still there. is it not released yet? It is a pain not being able to debug.

@jcouv
Copy link
Member

jcouv commented Apr 11, 2017

Two updates:

  • we're pulling the fix earlier (dev15.2 instead of dev15.3). I don't think there are any announced dates on that either though.
  • at least one user (above) reported that downgrading the ValueTuple package to its pre-release version mitigated the problem. That may be worth a try.

@Spongman
Copy link

i can confirm that the bug repros with ValueTuple 4.3.0, but not with 4.3.0-preview1-24530-04.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants