Moq4: ValueTuple Package not necessary for .Net 4.7

Created on 19 Jan 2018  路  11Comments  路  Source: moq/moq4

As of .Net 4.7, the ValueTuple is provided in the framework and the separate package reference is not necessary. Its inclusion conflicts with the system library.

e.g. mock.Setup(e => e.DoStuff(It.IsAny<(int MyInt, DateTime MyDateTime) >())).Verifiable();

This would not compile until I forcibly removed the ValueTuple package reference from my project.

Most helpful comment

Many thanks.

All 11 comments

Hi @bdarby22. Thanks for reporting this. If that is correct, we'd have to add a separate framework target for net47 (or perhaps just netstandard20).

I do wonder, though: Wouldn't it make even more sense for the .NET team to change the System.ValueTuple NuGet package so it is basically empty for net47? First everyone's forced to use the NuGet package because the language feature relies on it, next we're forced to multi-target our projects because of the conflict you describe. .NET development has become a crazy mess lately. 馃槩

Wouldn't it make even more sense for the .NET team to change the System.ValueTuple NuGet package so it is basically empty for net47?

According to https://github.com/dotnet/corefx/issues/23085, this has already happened. But after the ordeal of #566 and #567, I am very reluctant to potentially repeat the same mistake by upgrading System.ValueTuple from 4.3.0 to 4.4.0, given the latter version's targeted frameworks. Adding an additional net47 framework target seems a safer choice at this point.

Can use moq 4.8.0, which doesn't have System.ValueTuple dep.
Currently moq 4.8.1 is latest.

I'm still seeing a dep on System.ValueTuple 4.3.0 when installing Moq 4.8.1

@steelerc Use 4.8.0

@steelerc:

I'm still seeing a dep on System.ValueTuple 4.3.0 when installing Moq 4.8.1

Once released, a particular version never get changed. 4.8.1 will always have that particular issue.

Expect a fix for 4.8.2 in about 3 or 4 weeks' time. Until then use 4.8.0 like suggested above. ;-)

Eagerly waiting for 4.8.2 because of this as 4.8.0 depends on System.Threading.Tasks.Extensions 4.4.0 which generates its own issues https://stackoverflow.com/questions/48060230/system-reference-troubles-when-introducing-netstandard-library-dependency#comment83123889_48060230

I'll try to resolve this during the weekend ahead.

Moq 4.8.2 (see changelog) has just been published on NuGet.

Please report if there's any more trouble with ValueTuple and .NET 4.7+.

@bdarby22 - Moq 4.10.1 has just become available on Moq. That version no longer has a dependency on System.ValueTuple.

Many thanks.

Was this page helpful?
0 / 5 - 0 ratings