question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 issue

Description

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:

Reproduction:

  1. unpack ConsoleApp5, verify unit test projects use Full PDBs, compile
  2. unpack VstestTest, compile
  3. download microsoft.testplatform nuget, unpack
  4. 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
  1. observe missing CodeFilePath and incorrect LineNumber in output
  2. 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:

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:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tobyash86commented, Feb 12, 2020

I can confirm this issue as well. Currently, it is a blocker for me. Can anybody help with that?

1reaction
pkrukpcommented, Jan 7, 2020

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found