aspnet / Announcements

Subscribe to this repo to be notified about major changes in ASP.NET Core and Entity Framework Core

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Breaking change]: TrimMode defaults to `full` for WebSDK projects

captainsafia opened this issue · comments

Description

Trimming now trims all assemblies in applications targeting the Web SDK, by default. This change only affects apps that are published with PublishTrimmed=true, and it only breaks apps that had existing trim warnings.

Version

.NET 8 Preview 7

Previous behavior

Previously, TrimMode=partial was set by default for all projects that targeted the WebSDK.

New behavior

Starting in .NET 8 Preview 7, trimming trims all the assemblies in the app by default. Apps that may have previously worked with PublishTrimmed=true and TrimMode=partial may not work in .NET 8 Preview 7. However, only apps with trim warnings will be affected. If your app has no trim warnings, the change in behavior should not cause any adverse effect.

Type of breaking change

  • Binary incompatible: Existing binaries may encounter a breaking change in behavior, such as failure to load or execute, and if so, require recompilation.
  • Source incompatible: When recompiled using the new SDK or component or to target the new runtime, existing source code may require source changes to compile successfully.
  • Behavioral change: Existing binaries may behave differently at run time.

Reason for change

This change helps to decrease app size without users having to explicitly opt in and aligns with user expectations that the entire app is trimmed unless noted otherwise.

Recommended action

The best resolution is to resolve all the trim warnings in your application. For information about resolving the warnings in your own libraries, see Introduction to trim warnings.

To revert to the previous behavior, set the TrimMode property to partial.

<TrimMode>partial</TrimMode>

Affected APIs

None.