I'm finding that ValueTuples evaluate differently when I access their properties from a collection.
public static List<Tuple<string, bool>> MyTupleList = new List<Tuple<string, bool>>
{
new Tuple<string, bool>("test", true)
};
public static List<(string b, bool c)> MyList = new List<(string b, bool c)>
{
("test", true)
};
Why do these two highlighted lines evaluate differently and how can I change "MyList[0].c" to get the value correctly?
Refresh watch values A refresh icon (circular arrow) might appear in the Watch window when an expression is evaluated. The refresh icon indicates an error or a value that is out of date. To refresh the value, select the refresh icon, or press the spacebar.
On the Debug menu, choose Windows > Immediate.
This seems to be a bug in Visual Studio 2017.
There are a few related bugs mentioned on Roslyn's github issue tracker, e.g.:
List<Tuple>
properly - which is still open but seems to be fixed (when accessing the value as Item1
), see Rango's comment.Since the issue tracker of Visual Studio is not public, we can only wait and hope that these bugs get fixed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With