Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source info not available for desktop projects if it created from netcore template #373

Closed
smadala opened this issue Jan 24, 2017 · 4 comments
Assignees
Labels

Comments

@smadala
Copy link
Contributor

smadala commented Jan 24, 2017

Description

Source info not available for tests.

Steps to reproduce

Create netcore unit test project from VS templates
Change TargetFramework from netcoreapp1.0 to net46 in csproj file.

Expected behavior

Source info should be available.

Actual behavior

Source info not available.

Workaround

Add following PropertyGroup to test csproj file.

<PropertyGroup>
    <DebugType Condition="'$(TargetFramework)' != '' AND !$(TargetFramework.StartsWith('netcoreapp'))">Full</DebugType>
</PropertyGroup>
@codito codito changed the title Sorurce info not available for desktop projects if it created from netcore template Source info not available for desktop projects if it created from netcore template Jan 24, 2017
@codito codito added the bug label Jan 24, 2017
@codito
Copy link
Contributor

codito commented Jan 24, 2017

This is happening because there's an assumption that projects that target desktop can only build with Full PDBs.

@Faizan2304
Copy link
Contributor

This has been fixed with #528

@tmat tmat reopened this Nov 17, 2017
@tmat
Copy link
Member

tmat commented Nov 17, 2017

Reopening this issue. The problem has not been fixed fully.

The SDK still has the following lines, which break debugging tests built with embedded PDBs:

  <!--
     In IDE scenario for full CLR projects default test platform is v1, which expects full pdbs for source information.
     This can be removed once TPv2 is default for full CLR. Related issue https://github.com/Microsoft/vstest/issues/373.
   -->
  <PropertyGroup>
    <DebugType Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">Full</DebugType>
  </PropertyGroup>

Note that this actually completely breaks these tests -- the targets file sets DebugType after it has been used by the SDK to determine whether symbols need to be copied to the output directory. If the project sets DebugType to embedded the SDK determines that no PDBs need to be copied but then the test SDK overwrites DebugType value which makes the compiler to produce Windows PDB. This PDB is not copied to the output directory. XUnit will not find it there when displaying stack traces so the stack traces will miss line and file information.

@johnwc
Copy link

johnwc commented Jun 12, 2020

This may still be an issue. I have the latest VS 2019 installed. Created two .net standard libraries targeting 2.0/2.1. The created a xUnit test project, the only code coverage that was appearing was in the unit test project. I had to add DebugType like mentioned above in order for the other two libraries showed up in code coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants