Skip to content

[browser] fix MetadataUpdaterSupport default value - #127163

Merged
pavelsavara merged 2 commits into
dotnet:mainfrom
pavelsavara:MetadataUpdaterSupport
Apr 21, 2026
Merged

pavelsavara merged 2 commits into
dotnet:mainfrom
pavelsavara:MetadataUpdaterSupport

Conversation

@pavelsavara

@pavelsavara pavelsavara commented Apr 20, 2026 •

Copy link
Copy Markdown
Member

@pavelsavara pavelsavara self-assigned this Apr 20, 2026
@pavelsavara
pavelsavara requested a review from sbomer as a code owner April 20, 2026 15:02
Copilot AI review requested due to automatic review settings April 20, 2026 15:02
@github-actions github-actions Bot added the area-Tools-ILLink .NET linker development as well as trimming analyzers label Apr 20, 2026
@dotnet-policy-service dotnet-policy-service Bot added the linkable-framework Issues associated with delivering a linker friendly framework label Apr 20, 2026
@pavelsavara
pavelsavara requested a review from maraf April 20, 2026 15:03
@pavelsavara pavelsavara added this to the 11.0.0 milestone Apr 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the ILLink MSBuild targets to avoid forcing MetadataUpdaterSupport=false for trimmed Debug builds, aligning the default behavior with browser (WASM) debug scenarios where metadata update support is expected to remain available.

Changes:

  • Change the defaulting rule for MetadataUpdaterSupport under PublishTrimmed=true to only set it to false when $(Configuration) != Debug.

@pavelsavara

Copy link
Copy Markdown
Member Author

@lewing this may need merge into preview4 branch if we missed the train already

@pavelsavara
pavelsavara merged commit 6f2ad2d into dotnet:main Apr 21, 2026
92 checks passed
@pavelsavara
pavelsavara deleted the MetadataUpdaterSupport branch April 21, 2026 10:21
@tmat

tmat commented May 12, 2026 •

Copy link
Copy Markdown
Member

@pavelsavara Can we port to .NET 10 servicing?

@tmat

tmat commented May 12, 2026

Copy link
Copy Markdown
Member

Actually, we should delete this line entirely. ILLink targets should not be setting this property at all. It's already set in the SDK. https://github.com/dotnet/sdk/blob/main/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets#L157

@pavelsavara

Copy link
Copy Markdown
Member Author

Actually, we should delete this line entirely. ILLink targets should not be setting this property at all. It's already set in the SDK. https://github.com/dotnet/sdk/blob/main/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets#L157

There are many other linker features that it sets. If would be good to keep it in the same place. But I don't have any preference. Maybe just that SDK is not versioned, which makes runtime a better place.

<PropertyGroup Condition="'$(PublishTrimmed)' == 'true'">
<StartupHookSupport Condition="'$(StartupHookSupport)' == ''">false</StartupHookSupport>
<MetadataUpdaterSupport Condition="'$(MetadataUpdaterSupport)' == '' and '$(Configuration)' != 'Debug'">false</MetadataUpdaterSupport>
<CustomResourceTypesSupport Condition="'$(CustomResourceTypesSupport)' == ''">false</CustomResourceTypesSupport>
<EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization Condition="'$(EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization)' == ''">false</EnableUnsafeBinaryFormatterInDesigntimeLicenseContextSerialization>
<EnableUnsafeBinaryFormatterSerialization Condition="'$(EnableUnsafeBinaryFormatterSerialization)' == ''">false</EnableUnsafeBinaryFormatterSerialization>
<EnableUnsafeUTF7Encoding Condition="'$(EnableUnsafeUTF7Encoding)' == ''">false</EnableUnsafeUTF7Encoding>
<BuiltInComInteropSupport Condition="'$(BuiltInComInteropSupport)' == ''">false</BuiltInComInteropSupport>
<!-- GeneratedComInterface/ComImport interop requires built-in COM -->
<EnableGeneratedComInterfaceComImportInterop Condition="'$(BuiltInComInteropSupport)' == 'false'">false</EnableGeneratedComInterfaceComImportInterop>
<EnableGeneratedComInterfaceComImportInterop Condition="'$(EnableGeneratedComInterfaceComImportInterop)' == ''">false</EnableGeneratedComInterfaceComImportInterop>
<AutoreleasePoolSupport Condition="'$(AutoreleasePoolSupport)' == ''">false</AutoreleasePoolSupport>
<EnableCppCLIHostActivation Condition="'$(EnableCppCLIHostActivation)' == ''">false</EnableCppCLIHostActivation>
<!-- C++/CLI activation requires native hosting -->
<_EnableConsumingManagedCodeFromNativeHosting Condition="'$(EnableCppCLIHostActivation)' == 'true'">true</_EnableConsumingManagedCodeFromNativeHosting>
<_EnableConsumingManagedCodeFromNativeHosting Condition="'$(_EnableConsumingManagedCodeFromNativeHosting)' == ''">false</_EnableConsumingManagedCodeFromNativeHosting>
<VerifyDependencyInjectionOpenGenericServiceTrimmability Condition="'$(VerifyDependencyInjectionOpenGenericServiceTrimmability)' == ''">true</VerifyDependencyInjectionOpenGenericServiceTrimmability>
<JsonSerializerIsReflectionEnabledByDefault Condition="'$(JsonSerializerIsReflectionEnabledByDefault)' == ''">false</JsonSerializerIsReflectionEnabledByDefault>
<Http3Support Condition="'$(Http3Support)' == ''">false</Http3Support>
<!-- Linux Bionic doesn't ship GSSAPI, so enable managed implementation -->
<_UseManagedNtlm Condition="'$(_UseManagedNtlm)' == '' and $(RuntimeIdentifier.StartsWith('linux-bionic'))">true</_UseManagedNtlm>
<!-- Trim managed NTLM on Linux when it's not explicitly requested -->
<_UseManagedNtlm Condition="'$(_UseManagedNtlm)' == '' and $(RuntimeIdentifier.StartsWith('linux'))">false</_UseManagedNtlm>
<_ComObjectDescriptorSupport Condition="'$(_ComObjectDescriptorSupport)' == ''">false</_ComObjectDescriptorSupport>
<_DesignerHostSupport Condition="'$(_DesignerHostSupport)' == ''">false</_DesignerHostSupport>
<_DefaultValueAttributeSupport Condition="'$(_DefaultValueAttributeSupport)' == ''">false</_DefaultValueAttributeSupport>
<DynamicCodeSupport Condition="'$(DynamicCodeSupport)' == ''">true</DynamicCodeSupport>
<UseSystemResourceKeys Condition="'$(UseSystemResourceKeys)' == ''">false</UseSystemResourceKeys>
<_DataSetXmlSerializationSupport Condition="'$(_DataSetXmlSerializationSupport)' == ''">false</_DataSetXmlSerializationSupport>
</PropertyGroup>

cc @maraf

@pavelsavara

Copy link
Copy Markdown
Member Author

Actually, we should delete this line entirely. ILLink targets should not be setting this property at all. It's already set in the SDK. https://github.com/dotnet/sdk/blob/main/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets#L157

Also that ILLink line only sets the value if the value is empty. If SDK did it right, it would not be empty. Why is it empty ?

@tmat

tmat commented May 12, 2026

Copy link
Copy Markdown
Member

Empty means default, which is "true".

@tmat

tmat commented May 12, 2026 •

Copy link
Copy Markdown
Member

The new condition makes setting of the property redundant in ILLink. The SDK is essentially setting the defaults: false for non-Debug configuration, unchanged for Debug. ILLink (runtime) can further limit the support if needed. But it doesn't have to set false for non-Debug configuration because that's already the default.

jonathanpeppers added a commit to dotnet/sdk that referenced this pull request May 14, 2026
Warn when project configuration disables Hot Reload in `dotnet watch`, matching the checks that VS uses in [dotnet-project-system PR 738329](https://devdiv.visualstudio.com/DevDiv/_git/dotnet-project-system/pullrequest/738329).

### Background

Previously, `dotnet watch` only checked `StartupHookSupport` (and `PublishAot`/`PublishTrimmed` which imply it). It did not warn when the runtime's `MetadataUpdater.IsSupported` would be `false`, leading to confusing behavior — e.g. running `dotnet watch` in a non-Debug configuration would silently fail to apply Hot Reload updates.

### Changes

**TFM >= .NET 11** — check `MetadataUpdaterSupport`. This property is now [correctly set by the runtime](dotnet/runtime#127163) starting in .NET 11.

**TFM < .NET 11** — check `Optimize == false` and `DebugSymbols == true`, since `MetadataUpdaterSupport` was not reliably set for older frameworks. This matches what VS does.

### Files changed

- **`Versions.cs`** — Added `Version11_0` constant
- **`BuildNames.cs`** — Added `MetadataUpdaterSupport`, `Optimize`, `DebugSymbols` constants
- **`HotReloadAppModel.cs`** — Added TFM-gated checks with link to runtime PR
- **`SourceFileUpdateTests.HotReloadNotSupported.cs`** — Replaced `MetadataUpdaterSupport=False` test case with `Optimize=True` (test TFM is `net10.0`, so the `< 11` path is exercised)

Co-authored-by: Copilot <[email protected]>
@github-actions github-actions Bot locked and limited conversation to collaborators Jun 12, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-Tools-ILLink .NET linker development as well as trimming analyzers linkable-framework Issues associated with delivering a linker friendly framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Hot Reload with dotnet watch] Hot Reload does not instantly reflect changes when editing .razor file in Blazor WASM Standalone in .NET 11 preview 4

4 participants