Dictionary of tuple shows wrong value while debugging
#35,925 opened on May 23, 2019
Repository metrics
- Stars
- (20,414 stars)
- PR merge metrics
- (Avg merge 6d 17h) (256 merged PRs in 30d)
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<string, (DateTimeOffset Expiry, SomeClass Token)> dict =
new Dictionary<string, (DateTimeOffset Expiry, SomeClass Token)>();
dict. Add("yaayoo", (DateTimeOffset.Now, new SomeClass { Id = 1, Foobar = "Barbarian" }));
Console.WriteLine(dict["yaayoo"]. 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["yaayoo"]. 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)