Roslyn: RC 26127.3: Debugger broken when using tuples

Created on 1 Feb 2017  路  13Comments  路  Source: dotnet/roslyn

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.

Area-Compilers Bug New Language Feature - Tuples

Most helpful comment

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.

All 13 comments

/cc @jcouv @VSadov @jaredpar FYI

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

@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

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.).

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

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.

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?

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

@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.

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

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.

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.

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

Was this page helpful?
0 / 5 - 0 ratings