Error creating fakes using iTuple

For a long time, we used the Microsoft Fakes framework in our solution to fake System.DateTime.UtcNow during testing.

More recently, although a few weeks ago we started using C # 7 functions (since VS 2017), including tuples as return values ​​from functions. Now I have created a new branch for release. In the new branch, fake generation fails with a few posts below

4>C:\Users\...\Source\... 2017\DEV\WebApp.UnitTests\f.cs(116674,53): error CS0234: The type or namespace name 'ITuple' does not exist in the namespace 'System.Runtime.CompilerServices' (are you missing an assembly reference?) [C:\Users\...\Source\... 2017\DEV\WebApp.UnitTests\obj\Debug\Fakes\m\f.csproj] 4>C:\Users\...\Source\... 2017\DEV\WebApp.UnitTests\f.cs(116674,13): error CS0538: 'ITuple' in explicit interface declaration is not an interface [C:\Users\...\Source\... 2017\DEV\WebApp.UnitTests\obj\Debug\Fakes\m\f.csproj]

I tried this:

  • Add Microsoft.Net.Compilers 2.4.0 NuGet for all projects
  • Update all projects to configure .NET 4.7 (from 4.6.1) and remove all System.ValueTuple links (as they are now built into .NET 4.7)

, . , System.ValueTuple NuGet. . , FakesAssemblies, NuGet -.

, , .

EDIT: , Fakes . .

+4
2

.NET Framework 4.7.1. (RTFM, ...), ITuple System.Runtime.CompilerServices :

https://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.ituple(v=vs.110).aspx

.NET Framework

4.7.1

+2

ITuple mscorlib.fakes:

<Fakes xmlns="http://schemas.microsoft.com/fakes/2011/">
  <Assembly Name="mscorlib" Version="4.0.0.0"/>
  <StubGeneration>
    <Remove FullName="System.Runtime.CompilerServices.ITuple"/>
  </StubGeneration>
</Fakes>

* : <StubGeneration> <ShimGeneration>

+7

Source: https://habr.com/ru/post/1688235/


All Articles