-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Mono] trim hot reload #111247
base: main
Are you sure you want to change the base?
[Mono] trim hot reload #111247
Conversation
Tagging subscribers to 'size-reduction': @eerhardt, @SamMonoRT, @marek-safar |
cc @MichalStrehovsky - this is separated from the timezones PR |
@@ -33,6 +33,7 @@ Copyright (c) .NET Foundation. All rights reserved. | |||
could be removed by the ILLink, causing a trimmed app to crash. --> | |||
<PropertyGroup Condition="'$(PublishTrimmed)' == 'true'"> | |||
<StartupHookSupport Condition="'$(StartupHookSupport)' == ''">false</StartupHookSupport> | |||
<MetadataUpdaterSupport Condition="'$(MetadataUpdaterSupport)' == ''">false</MetadataUpdaterSupport> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you test that hot reload still works when you dotnet run
(or dotnet watch
) a project that has PublishAot/PublishTrimmed=true
in the .csproj?
I think setting this property is going to break hot reload at debug time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried:
using System.Runtime.CompilerServices;
while (true)
{
Do();
await Task.Delay(500);
}
[MethodImpl(MethodImplOptions.NoInlining)]
static void Do() => Console.WriteLine("Hello, World!");
with
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<MetadataUpdaterSupport>false</MetadataUpdaterSupport>
</PropertyGroup>
</Project>
With dotnet watch
and then tried editing the Hello World string. The metadata does get updated. Did I miss some step?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try using something that uses MetadataUpdater.IsSupported
:
Like Blazor WASM.
See also - #57143 (comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using System.Reflection.Metadata;
Console.WriteLine(MetadataUpdater.IsSupported);
This will print False with dotnet run (irrespective of MetadataUpdaterSupport value) and True with dotnet watch (again, irrespective of the property). This still matches my expectations.
Trim
Mono.HotReload
classes whenMetadataUpdaterSupport
isfalse
or not specified.Related discussion #111215 (comment)