dotnet/roslyn

Dictionary of tuple shows wrong value while debugging

Ouverte

#35 925 ouverte le 23 mai 2019

 (2 commentaires) (1 réaction) (0 personne assignée)C# (4 257 forks)batch import
Area-InteractiveBugDeveloper CommunityInteractive-Debugginghelp wanted

Métriques du dépôt

Stars
 (20 414 étoiles)
Métriques de merge PR
 (Merge moyen 6j 17h) (256 PRs mergées en 30 j)

Description

VSF_TYPE_MARKDOWNI have a Dictionary<string,(tupletype)>, where the tupletype has two named items inside. When I debug the application, if I have an expression that references an element from this dictionary and then from the tuple, the value is shown wrong. If I dive into the dictionary from the dictionary object, the value is correct.

Here is a code to reproduce the issue:

    class Program {
        static void Main(string[] args) {
            Dictionary&lt;string, (DateTimeOffset Expiry, SomeClass Token)&gt; dict = 
                new Dictionary&lt;string, (DateTimeOffset Expiry, SomeClass Token)&gt;();

dict. Add(&quot;yaayoo&quot;, (DateTimeOffset.Now, new SomeClass { Id = 1, Foobar = &quot;Barbarian&quot; }));

Console.WriteLine(dict[&quot;yaayoo&quot;]. Expiry);
        }
    }

class SomeClass {
        public int Id { get; set; }
        public string Foobar { get; set; }
    }

Place a breakpoint on the WriteLine line. Observe that the currect value is printed to the console. Now hover over Expiry. It will show 1.1.0001, or the MinValue for the DateTimeOffset member.

Now hover over the dict object. As you open up the only item inside, you can see the tuple and the values correctly.

Same happens in the Watch window. If you add dict[&quot;yaayoo&quot;]. Expiry it will show MinValue, but if you add just dict and open it up, the correct values are displayed.

See also attached screenshot.

This issue has been moved from https://developercommunity.visualstudio.com/content/problem/578571/dictionary-of-tuple-shows-wrong-value-while-debugg.html VSTS ticketId: 897034 These are the original issue comments:

Visual Studio Feedback System on 5/23/2019, 01:52 AM (14 hours ago): We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Visual Studio Feedback System on 5/23/2019, 09:52 AM (6 hours ago): This issue is currently being investigated. Our team will get back to you if either more information is needed, a workaround is available, or the issue is resolved.

These are the original issue solutions: (no solutions)

Guide contributeur