Runtime: Difference between IncludeSymbolsInSingleFile and DebugType embedded?

Created on 15 Sep 2020  路  10Comments  路  Source: dotnet/runtime

What's the difference between adding

<IncludeSymbolsInSingleFile>true</IncludeSymbolsInSingleFile>

and

<DebugType>embedded</DebugType>

to your .csproj?

This is pretty straightforward question, but I really couldn't find anything more than "IncludeSymbolsInSingleFile" is only available for .NET Core 3.0+ in design.md (which is kind of obvious, as you have to be able to build single-file).

So, is there any difference? Especially in how they get embedded?

area-Single-File question

Most helpful comment

In 3.0, symbols could be included by embedding the PDBs in the bundle, and at runtime they would be extracted to a temporary directory next to the app DLLs. In 5.0, we removed support for bundling and extracting the PDBs and recommend using embedded PDBs instead, where the PDB information is directly embedded inside each assembly (there are no separate PDB files). In general, embedded PDBs are better. It's a long supported feature and is usually understandable by most debuggers.

All 10 comments

Tagging subscribers to this area: @agocke
See info in area-owners.md if you want to be subscribed.

In 3.0, symbols could be included by embedding the PDBs in the bundle, and at runtime they would be extracted to a temporary directory next to the app DLLs. In 5.0, we removed support for bundling and extracting the PDBs and recommend using embedded PDBs instead, where the PDB information is directly embedded inside each assembly (there are no separate PDB files). In general, embedded PDBs are better. It's a long supported feature and is usually understandable by most debuggers.

Thanks for your reply, I managed to think of some additional questions in the meantime:

  1. How does IncludeSymbolsInSingleFile work in .NET 5 then?
  2. How can one extract/inspect the "non-extracting" .NET 5 bundle?
  3. Could you point me into some sources that could help me better understand what sits inside such .NET 5 bundle and how to potentially read it?
  4. Can .NET 5 potentially generate self-extracting bundle? How to achieve this?

How does IncludeSymbolsInSingleFile work in .NET 5 then?

It doesn't. It's not supported.

How can one extract/inspect the "non-extracting" .NET 5 bundle?

It's currently not supported to examine the bundle, it's basically an opaque exe.

Can .NET 5 potentially generate self-extracting bundle? How to achieve this?

Setting the property IncludeContentForSelfExtract to true will go back to the .NET Core 3.1 behavior instead of using the new bundling.

How does IncludeSymbolsInSingleFile work in .NET 5 then?

It doesn't. It's not supported.

Ah, just updated to RC1, it was still ~supported~ working in Preview 8, with results below, and thus the question.

Results in Preview 8

Using simple WPF app, referencing Microsoft.Data.SqlClient, using single-file, framework-dependent, win-x86 publish, without IncludeSymbolsInSingleFile (or set to false), I was getting the following files as a publish output:

no include

After setting IncludeSymbolsInSingleFile to true, I was getting the following:

IncludeSymbolsInSingleFile

How can one extract/inspect the "non-extracting" .NET 5 bundle?

It's currently not supported to examine the bundle, it's basically an opaque exe.

馃槩

Can .NET 5 potentially generate self-extracting bundle? How to achieve this?

Setting the property IncludeContentForSelfExtract to true will go back to the .NET Core 3.1 behavior instead of using the new bundling.

That either works different than expected, or doesn't work at all. I expected it to extract itself in %temp%\.net\, but I was not able to found _extracted_ executable anywhere (used Everything to search for WpfApp1.exe - nothing that could be considered extraction folder). Should I create issue for this?

Sorry, I think I typo'd that: should be IncludeAllContentForSelfExtract. Can you try that instead?

With IncludeAllContentForSelfExtract folder in %temp%\.net\ is generated, although it only seems to contain native dependencies - in this case, just one file: Microsoft.Data.SqlClient.SNI.dll. No WpfApp1.dll, .deps.json, .runtimeconfig.json like in raw .NET Core 3.1.

@holc-tkomp You're right! That looks like a bug to me.

Sorry for the late response...

In 5.0.0 the IncludeAllContentForSelfExtract should behave basically identical to 3.1 bundles - all files should be extracted to disk and executed from the disk.

As for the bundle format:

Design doc

Implementation of the bundling

Writing a tool to extract all of the content from the bundle should be pretty simple (the format is rather primitive).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

omariom picture omariom  路  3Comments

yahorsi picture yahorsi  路  3Comments

sahithreddyk picture sahithreddyk  路  3Comments

matty-hall picture matty-hall  路  3Comments

nalywa picture nalywa  路  3Comments