Fakes SDK Style MSTest projects build is broken in VS 16.7 and .NET Core SDK 3.1.400 for 2020.1.4, EAP9
We had to change global.json to redirect to use .NET SDK 3.1.302, can't believe it is so broken in stable version of VS, we have a few projects which are SDK style project format, but targeting 4.8 and all builds are showing errors during build using latest sdk 3.1.400, funny enough that there is no such .NET Core SDK released yet!
Also all tests disappeared and error is related to not able generation fakes, we are using special property to switch to old generation behavior:
<FakeUseV2Generation>false</FakeUseV2Generation>
Which seems like undocumented feature until .NET Core SDK is released to support Fakes generation...
Had to install 16.6.5 to get back to normal, first time ever crazy broken after upgrade to LTS version:
https://docs.microsoft.com/en-us/visualstudio/releases/2019/history
Please sign in to leave a comment.
Hello Alexander,
Could you please clarify details: do you experience problems with building MS Fakes test projects or with running them? Please note that ReSharper cannot affect VS compiling problems.
Is the following setting enabled in VS options?
You've mentioned that installing VS 16.6.5 returned everything to normal. Does ReSharper EAP9 run tests with this version?
Thank you.
Yes, it is enabled, I guess, something changed in Fakes generation in SDK released with VS 16.7, but we noticed this issues was happening before upgrading to latest version, so could be related to something else?
16.6.5 run tests fine, we also had issue with COR_PROFILE not found when running with 16.7
we did try install EAP, but result was negative, only after we redirected to 3.1.302 SDK using global.json, but we still had issue with errors when covering tests like in this bug report:
https://youtrack.jetbrains.com/issue/RSRP-447662
Also MSTest options page was appearing empty...
Hello Alexander,
Could you please specify what are actual problems you are experiencing for:
VS 16.6.5 + ReSharper 2020.2 EAP9
VS 16.7 + ReSharper 2020.2 EAP9
Please specify for each combination what problem is reproduced (building project, running tests, "COR_PROFILE not found" error etc)
MSTest empty page is a known issue - https://youtrack.jetbrains.com/issue/RSRP-479970.
Thank you.
16.6.5 everything is fine, 16.7 everything is broken
Hello Alexander,
thank you for the reply.
Please try installing the latest ReSharper 2020.2 and check the issue once again.
If the problem is still reproduced could you please provide a sample solution demonstrating the problem. You can share it privately via "Submit a request" form.
Thank you.
Thank you, it just a bit of a hassle to install VS 2019 16.7 and if it does not work again downgrade is a bit of pain.
How about you try it and let us know it is working for you?
Create new .net core mstest project with targeting 4.8 .net and fakes generated for system. You can create simple test for System.Fakes.DateTime.NowGet...
It could be issue on Visual Studio side, we submitted support ticket with Microsoft as well and will let you know what is the outcome...
I've got great idea and will install 2019 16.8.1 preview to check side by side and will let you know...
Result: 2019 16.8.1 with ReSharper 2020.2 - Issues with building project with Fakes references, probably related to .NET Core SDK changes as the same issue for dotnet build from command line...
But when ReSharper build is enabled - all fakes are re-generated and then showing errors about Syste.Fakes not able to be found:
Error CS0234: The type or namespace name 'Fakes' does not exist in the namespace 'System' (are you missing an assembly reference?) (119, 17)
Also, tests are showing the following error when running from ReSharper Tests:
Test method *** threw exception:
Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationException: Failed to get address of function SetDetourProvider from library 'C:\Users\akachalkov\AppData\Local\JetBrains\Installations\ReSharperPlatformVs16_ac76d559\x64\JetBrains.Profiler.Core.dll'.
at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.LibraryMethods.GetProcAddress(IntPtr hModule, String functionName)
at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.LibraryMethods.GetFunction[T](IntPtr hModule, String functionName)
at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.IntelliTraceInstrumentationProvider.Initialize()
at Microsoft.QualityTools.Testing.Fakes.UnitTestIsolation.UnitTestIsolationRuntime.InitializeUnitTestIsolationInstrumentationProvider()
at Microsoft.QualityTools.Testing.Fakes.Shims.ShimRuntime.CreateContext()
at Microsoft.QualityTools.Testing.Fakes.ShimsContext.Create()
Managed to crash Visual Studio and empty unit test list,
14/08/2020 01:42:22 Critical Some of the projects might not be read correctly. You may disable solution loading from disk or do that for certain projects.|
Project 'MSFakes.Tests' load failed:
[MSB4236] The SDK 'Microsoft.NET.Sdk' specified could not be found. D:\Temp\MSFakes.Tests.csproj at (0:0)
tried uploading file (UploadID:2020_08_14_FkVjeZySdZDFLNCd), but it did not work, so here is the sample project:
works fine in VS Test Explorer
we raised premium support request with Microsoft support and they reproduced the issue with MSFakes, but we had to rollback to 2020.1.4 to get coverage working back as expected as looks like empty settings page for MSTest affects code coverage not picking up settings file selected in the solution and all code coverage is affected, generally feels like 2020.2 is step backwards rather than forward...
Alexander Kachalkov, please use the following page to specify the settings file in ReSharper 2020.2.2: ReSharper | Options | Tools | Unit Testing | Test Runner.
Please let us know how it works for you.
Maria Pleskunina thank you, but we don't have an option to install ReSharper side by side and we don't have time to install latest version to find out that it is still all broken :(
installed 2020.2.2 - still broken, so?
MSFakes issue is fixed in 16.8 Preview 3
Hello Alexander,
thank you for letting us know.