45

To generate open cover report I have to make debugType as Full. I generate report on build server as I have to fail the build if the coverage doesn't reach a certain threshold. The build is generated in Release mode. What consequence does keeping debugType Full in my csproj file have? Will it degrade the performance in production?

Jacob Stamm
  • 1,660
  • 1
  • 29
  • 53
Viraj Pangam
  • 469
  • 1
  • 4
  • 4
  • 2
    difference between /debug:pdbonly and /debug:full is that with /debug:full the compiler emits a DebuggableAttribute, which is used to tell the JIT compiler that debug information is available – Anant Dabhi Oct 24 '17 at 04:49
  • 2
    Will this degrade the performance in production? – Viraj Pangam Oct 24 '17 at 04:51
  • @AnantDabhi the question is not about `pdbonly` but about the `/debug:portable` equivalent argument (seems like official docs haven't been updated to include it) – Martin Ullrich Oct 24 '17 at 07:24
  • It is [documented](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/debug-compiler-option), quote: "If you use /debug:full, be aware that there is some impact on the speed and size of JIT optimized code and a small impact on code quality with /debug:full. We recommend /debug:pdbonly or no PDB for generating release code." The side-effects of /debug:portable are not documented, it is for one missing the option to in/exclude file+line number info so this may change some day. – Hans Passant Oct 24 '17 at 09:19

2 Answers2

53

The difference is that the "full" type emits a classic windows PDB symbol file which is complex and poorly documented. The "portable" PDB format is a new open-source format that can be created and used on all platforms. You can read more information on this format at it's documentation on the dotnet/core repo.

It has nothing to do with whether or not the application can be debugged, but rather the tools that support the new vs classic format. So there aren't any runtime consequences (except for printing stack traces in .NET Framework < 4.7.1 when you ship portable pdb files with the application and want to see line number mapping).

So until tools are updated to work with the new format, you'll need to change the DebugType property to Full if you need to use tooling which does not yet support the new format which is now the default for "SDK-based" projects.

To only do that for debug builds, you'll want your csproj to contain a section like

<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
  <DebugType>Full</DebugType>
</PropertyGroup>
Martin Ullrich
  • 94,744
  • 25
  • 252
  • 217
10

There is no difference between full and pdb-only since Visual Studio 2013 (Roslyn). We should update the docs. @VSadov

https://github.com/dotnet/runtime/issues/25550#issuecomment-374996117

dimaaan
  • 861
  • 13
  • 16
  • 2
    [Official documentation that states it](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/code-generation) : "For all compiler versions starting with C# 6.0, there is no difference between pdbonly and full." – Otiel Jan 17 '22 at 10:20
  • [official documentation](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/code-generation#debugtype) states " If you use Full, be aware that there's some impact on the speed and size of JIT optimized code and a small impact on code quality with full. We recommend pdbonly or no PDB for generating release code." – Matt Oakley Mar 23 '22 at 14:29
  • 1
    @MattOakley Before that sentence, [the same documentation](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/code-generation#debugtype) says "The following information applies only to compilers older than C# 6.0." ;) – DeveTho Jul 08 '22 at 15:50