How can I remove exception “Predefined type 'V

2019-02-18 06:32发布

问题:

I started using the new tuple feature in c# 7.0 but I noticed that neither in the function that returns a tuple nor in its caller is possible to check the variable values in debug mode. Instead an exception is shown:

$exception  error CS8182: Predefined type 'ValueTuple`2' must be a struct.  

Is there a way to get rid of that glitch and debug normally?

回答1:

It seems a bug that Microsoft has fixed but it will be available in a future update (2017) https://github.com/dotnet/roslyn/pull/16930



回答2:

It is a bug in the current version of System.ValueTuple. To workaround it till MS releases the fix, downgrade the package version from 4.3.0 to a pre-release one.