Skip to content

Convert EnsureUIThread optimization to a trimmer feature switch #26104

Closed

Description

@rolfbjarne

Sub-issue of #11477.

Convert the EnsureUIThread optimization from the hand-written IL rewrite in OptimizeGeneratedCode (ProcessEnsureUIThread in tools/linker/OptimizeGeneratedCode.cs) to a trimmer feature switch, so ILLink can evaluate the condition and remove the [NS|UI]Application::EnsureUIThread calls itself.

Reference: analysis of the current state.

Prior art: DynamicRegistrationSupported was already converted to a feature switch (bf5e35a); _SetDynamicRegistrationSupportedFeature in dotnet/targets/Xamarin.Shared.Sdk.targets is a good template.

Activity

  1. added
    enhancement
    dotnet
    on Jul 15, 2026
  2. added this to the .NET 11 milestone on Jul 16, 2026
  3. added a commit that references this issue on Aug 5, 2026
    a26e2d4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    copilotdotnetenhancement

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions