Reputation: 58
I have a unit test project that uses Fakes and building it fails but without generating any errors or warnings. The build output shows 0 Errors and 0 Warnings when set to Normal verbosity:
1>Build FAILED.
1> 0 Warning(s)
1> 0 Error(s)
1>
1>Time Elapsed 00:00:05.27
========== Build: 0 succeeded, 1 failed, 13 up-to-date, 0 skipped ==========
When looking earlier in the build output, I can spot when it fails:
1> 4:start> "C:\Program Files (x86)\Microsoft Visual
Studio\2019\Enterprise\MSBuild\Microsoft\VisualStudio\v16.0\Fakes\fakes.exe" @"Path\To\My\CsProj\obj\Debug\net48\Fakes\m\f.args"
1> Microsoft Fakes v16.600.320.22103 - .NET v4.0.30319
1> Copyright (c) Microsoft Corporation 2007-2010. All rights reserved.
1>
1> fakes
1> fakes generator 0 errors, 0 warnings
1>
1> Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
1> at Microsoft.QualityTools.Testing.Fakes.CodeGenerator.ExtendedReflection.Metadata.Roslyn.RoslynAssemblyImpl.get_TypeDefinitions()
1> at Microsoft.QualityTools.Testing.Fakes.Engine.FakesDriver.TryGetTypeDefinitions(AssemblyEx assembly, ICountable`1& typeDefinitions)
1> at Microsoft.QualityTools.Testing.Fakes.Engine.FakesDriver.ExecuteProtected()
1> at Microsoft.QualityTools.Testing.Fakes.Engine.FakesDriver.Execute()
1> at Microsoft.QualityTools.Testing.Fakes.FakesProgram.LaunchSingleFakes(FakesConsoleOptions
options)
1> at Microsoft.QualityTools.Testing.Fakes.FakesProgram.Main(String[] args)
1> at Microsoft.QualityTools.Testing.Fakes.Program.Main(String[] args)
1> 4:end> Fakes\mscorlib.fakes AccessViolation (-1073741819 - 0xc0000005)
1>
1>
1> Fakes compilation FAILED - 1.7001673s
1> result: unexpected exception occured (-1002 - 0xfffffc16)
1> Fakes assemblies:
The weird thing is this project compiles properly on a previous computer I was using.
Upvotes: 2
Views: 158
Reputation: 58
This seems to be a bug in Visual Studio 2019 version 16.6.0.
According to this bug report: https://developercommunity.visualstudio.com/content/problem/1046515/visual-studio-2019-1660-microsoft-fakes-issue.html
This seems to also correspond to my problem, since my older computer uses an older version of VS2019 and my newest one uses the latest VS 2019 version.
Upvotes: 0