Skip to content

Cannot make trimmed app with debugging symbols #4017

@dmorrison42

Description

@dmorrison42

Unfortunately, I am unsure if this is a feature request, bug report, or my failure to properly read the documentation, but I am unable to make a trimmed single executable with debugging symbols. I have a simple code example here : https://github.com/dmorrison42/CrashTestDummy

The following line will create a single executable that will print a line number of an exception, but is fairly large (~67M).

dotnet publish -c release -r win10-x64 -p:PublishSingleFile=true -p:IncludeSymbolsInSingleFile=true -o .

The following line with create a single executable that will print no line number, but is relatively small (~25M).

dotnet publish -c release -r win10-x64 -p:PublishSingleFile=true -p:IncludeSymbolsInSingleFile=true -p:PublishTrimmed=true -o .

Update: As of dotnet core 3.1.100. The workaround provided by @sbomer works.

Just add the following to the csproj:

  <ItemGroup>
    <TrimmerRootAssembly Include="System.Diagnostics.StackTrace" />
  </ItemGroup>
  <PropertyGroup>
    <_ExtraTrimmerArgs>--keep-facades true</_ExtraTrimmerArgs>
  </PropertyGroup>

The sample project has been updated appropriately.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions