@@ -26,11 +26,6 @@ public static class WebAssemblyHotReload
2626
2727 internal static async Task InitializeAsync ( )
2828 {
29- // Analyzer has a bug where it doesn't handle ConditionalAttribute: https://github.com/dotnet/roslyn/issues/63464
30- #pragma warning disable IDE0200 // Remove unnecessary lambda expression
31- _hotReloadAgent = new HotReloadAgent ( m => Debug . WriteLine ( m ) ) ;
32- #pragma warning restore IDE0200 // Remove unnecessary lambda expression
33-
3429 if ( Environment . GetEnvironmentVariable ( "__ASPNETCORE_BROWSER_TOOLS" ) == "true" )
3530 {
3631 // Attempt to read previously applied hot reload deltas if the ASP.NET Core browser tools are available (indicated by the presence of the Environment variable).
@@ -50,14 +45,19 @@ internal static async Task InitializeAsync()
5045 [ JSInvokable ( nameof ( ApplyHotReloadDelta ) ) ]
5146 public static void ApplyHotReloadDelta ( string moduleIdString , byte [ ] metadataDelta , byte [ ] ilDelta , byte [ ] pdbBytes )
5247 {
48+ // Analyzer has a bug where it doesn't handle ConditionalAttribute: https://github.com/dotnet/roslyn/issues/63464
49+ #pragma warning disable IDE0200 // Remove unnecessary lambda expression
50+ Interlocked . CompareExchange ( ref _hotReloadAgent , new HotReloadAgent ( m => Debug . WriteLine ( m ) ) , null ) ;
51+ #pragma warning restore IDE0200 // Remove unnecessary lambda expression
52+
5353 var moduleId = Guid . Parse ( moduleIdString , CultureInfo . InvariantCulture ) ;
5454
5555 _updateDeltas [ 0 ] . ModuleId = moduleId ;
5656 _updateDeltas [ 0 ] . MetadataDelta = metadataDelta ;
5757 _updateDeltas [ 0 ] . ILDelta = ilDelta ;
5858 _updateDeltas [ 0 ] . PdbBytes = pdbBytes ;
5959
60- _hotReloadAgent ! . ApplyDeltas ( _updateDeltas ) ;
60+ _hotReloadAgent . ApplyDeltas ( _updateDeltas ) ;
6161 }
6262
6363 /// <summary>
0 commit comments