Simple test project: xUnit, targeting Net 6.0 Environment:
- Windows 10 21h1, 19043.1348
- Visual Studio 2022 Enterprise 17.0.0 (both Net 6 and Net 5 sdk installed from Visual Studio installer)
Add fake assembly of System.Runtime, compilation errors:
1>------ Rebuild All started: Project: TestProject1, Configuration: Debug Any CPU ------
Restored D:\TestProject1\TestProject1\TestProject1.csproj (in 570 ms).
1>D:\TestProject1\TestProject1\obj\Debug\net6.0\Fakes\sr\f.cs(94904,16): error CS1503: Argument 1: cannot convert from 'string' to 'System.Runtime.Serialization.SerializationInfo' [D:\TestProject1\TestProject1\obj\Debug\net6.0\Fakes\sr\f.csproj]
1>D:\TestProject1\TestProject1\obj\Debug\net6.0\Fakes\sr\f.cs(94904,31): error CS1615: Argument 2 may not be passed with the 'ref' keyword [D:\TestProject1\TestProject1\obj\Debug\net6.0\Fakes\sr\f.csproj]
1>GENERATEFAKES : error : project compilation failed with exit code 1
1>D:\TestProject1\TestProject1\obj\Debug\net6.0\Fakes\sr\f.cs(94904,16): error CS1503: Argument 1: cannot convert from 'string' to 'System.Runtime.Serialization.SerializationInfo' [D:\TestProject1\TestProject1\obj\Debug\net6.0\Fakes\sr\f.csproj]
1>D:\TestProject1\TestProject1\obj\Debug\net6.0\Fakes\sr\f.cs(94904,31): error CS1615: Argument 2 may not be passed with the 'ref' keyword [D:\TestProject1\TestProject1\obj\Debug\net6.0\Fakes\sr\f.csproj]
1>GENERATEFAKES : error : project compilation failed with exit code 1
1>Done building project "TestProject1.csproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
Changing target to Net 5.0 (after deletion of directory Fake and FakesAssemblies), add System.Runtime fake assembly, everything works.
Any idea ?