Skip to content

Consider adding a runtime diagnostic debug feature for trimmed applications #50130

Open

Description

Trimming a .NET Core application is expected to give size wins without compromising correctness. However, there are some coding patterns, largely centered around arbitrary use of reflections, that make it challenging for the Trimmer to reason about correctness. Serializers (such as XML and DataContractSerilaizers), feature area like EventSource, and other make heavy use of such patterns. The trimmer does a good job of warning in these cases but for scenarios where these warnings are incorrectly suppressed, trimmed applications can fail in production environment that will be hard to root cause.

We should provide a runtime diagnostic feature that can be leveraged in opt-in scenario testing mode that will warn developers of potential problems in their app. Such a feature should have the following:

  • Metadata in trimmed assemblies on trimmed types. This issue tracks the request in the mono repo

  • Library support to query the trimmed assemblies to get trimmed metadata

  • Showcase this feature using a trim-problematic component

  • Developer Experience to leverage this feature including a mechanism for make problematic types trim safe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status

      No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions