Missing source information (CodeFilePath, LineNumber) in discovered test cases for .NET Core (3.x?) projects with "Full" PDB (instead of "Portable" PDB)
See original GitHub issueDescription
Hi,
I’m using VsTestConsoleWrapper API to discover test cases.
When the test assembly is compiled to .NET Core (3.x?) and is configured to produce Full PDB instead of default Portable PDB, the discovered TestCase have null CodeFilePath and LineNumber is -1.
After switching to Portable PDB the CodeFilePath and LineNumber are correct.
As you can see in next comment, it looks like a regression, because it works correctly if unit test project targets .net core 2.1
Steps to reproduce
I’m attaching:
- ConsoleApp5.zip - project with unit tests
- VstestTest.zip - project which uses VsTestConsoleWrapper to discover and display test cases
Reproduction:
- unpack ConsoleApp5, verify unit test projects use Full PDBs, compile
- unpack VstestTest, compile
- download microsoft.testplatform nuget, unpack
- run VstestTest, for example:
D:\dv.scripts\vstest_repro\VstestTest\VstestTest\bin\Debug\VstestTest.exe ^
D:\dv.scripts\vstest_repro\microsoft.testplatform.16.4.0\tools\net451\Common7\IDE\Extensions\TestPlatform\vstest.console.exe ^
D:\dv.scripts\vstest_repro\ConsoleApp5\UnitTestProject1\bin\Debug\netcoreapp3.1\Microsoft.VisualStudio.TestPlatform.MSTest.TestAdapter.dll ^
D:\dv.scripts\vstest_repro\ConsoleApp5\UnitTestProject1\bin\Debug\netcoreapp3.1\UnitTestProject1.dll
- observe missing CodeFilePath and incorrect LineNumber in output
- modify ConsoleApp5 to use Portable PDB, recompile it, rerun VstestTest, observe correct values
Expected behavior
DisplayName=TestMethod1
CodeFilePath=D:\dv.scripts\vstest_repro\ConsoleApp5\UnitTestProject1\UnitTest1.cs
LineNumber=11
Actual behavior
DisplayName=TestMethod1
CodeFilePath=
LineNumber=-1
Diagnostic logs
I’m attaching:
- logs.zip - vstest logs and output
Environment
I have used vstest from nuget packages microsoft.testplatform.16.4.0 and microsoft.testplatform.16.5.0-preview-20191115-01.
I’m testing this on Windows 10.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:4
- Comments:8 (3 by maintainers)
Top Results From Across the Web
"PDB format is not supported" with .NET portable ...
My Visual Studio 2017 debugger can't work with PDBs in "portable" format ... will not be able to include source file names and...
Read more >Debugging ASP.NET Core 2.0 Source Code - Steve Gordon
Investigating the initial ASP.NET Core support for Source Link PDB files which link to the source on GitHub to enable debugging ASP.
Read more >dotnet publish command - .NET CLI
The dotnet publish command publishes a .NET project or solution to a directory.
Read more >Instrumenting .Net Core 2.0 console app "File contains no ...
When the project is set to emit Embedded PDBs, the same caveat applies as stated above. Source file and line number information isn't...
Read more >Deep-dive into .NET Core primitives: deps.json ...
NET Core app” is really just a collection of the *.dll files (and a few config ... First, write this C# code into...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I can confirm this issue as well. Currently, it is a blocker for me. Can anybody help with that?
It works correctly when tested project targets .net core 2.1 (2.x?) - source information is present for both portable and full PDB. So this looks like a regression.
I may be wrong, but I think I read somewhere about DIA update in .net core 3.x - I may be wrong though.
Attaching