VS2017 Debugging Tuple Task

I cannot view debug information when using Task of Tuple. EG. When a breakpoint hits it, I cannot view any variables on hover, in a local window or in a viewport.

Reproduction is simply to create a new WPF application, add System.ValueTuple, add this code to MainWindow.xaml.cs, and then set breakpoints on both lines using "return".

using System.Threading.Tasks;
using System.Windows;

namespace WpfApp2
{
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }

        private async void Button_Click(object sender, RoutedEventArgs e)
        {
            var task1 = TaskWithLocalDebugInfo();
            var task2 = TaskWithoutLocalDebugInfo();
        }

        private async Task<bool> TaskWithLocalDebugInfo()
        {
            var viewableInLocalWindowAndHover = true;
            return viewableInLocalWindowAndHover;
        }

        private async Task<(bool, bool)> TaskWithoutLocalDebugInfo()
        {
            var notViewableInLocalWindowAndHover = true;
            return (notViewableInLocalWindowAndHover, notViewableInLocalWindowAndHover);
        }
    }
}

Edit: if I add an unviewable local variable to view, I get: error CS8182: Predefined type 'ValueTuple`2' must be a struct.

+6
source share
2 answers

Visual Studio 2017. ​​ .

GitHub comment MS, , .

GitHub 13 2017 .:

, ValueTuple 4.3.0, 4.3.0-preview1-24530-04.

NuGet Package Manager/Manage NuGet Packages for Solution. 4.3.0-preview1-24530-04 ":" "".

, Visual Studio " " . , , "" . , , "" , ; , "", - , , .

+9

, # 7 ValueTask. system.threading.tasks.extensions ValueTask Task

private static async ValueTask<(bool, bool)> TaskWithoutLocalDebugInfo()
{
    var notViewableInLocalWindowAndHover = true;
    return (notViewableInLocalWindowAndHover, notViewableInLocalWindowAndHover);
}

.

+1

Source: https://habr.com/ru/post/1016012/


All Articles