@@ -26,11 +26,6 @@ public static class WebAssemblyHotReload
26
26
27
27
internal static async Task InitializeAsync ( )
28
28
{
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
-
34
29
if ( Environment . GetEnvironmentVariable ( "__ASPNETCORE_BROWSER_TOOLS" ) == "true" )
35
30
{
36
31
// 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()
50
45
[ JSInvokable ( nameof ( ApplyHotReloadDelta ) ) ]
51
46
public static void ApplyHotReloadDelta ( string moduleIdString , byte [ ] metadataDelta , byte [ ] ilDelta , byte [ ] pdbBytes )
52
47
{
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
+
53
53
var moduleId = Guid . Parse ( moduleIdString , CultureInfo . InvariantCulture ) ;
54
54
55
55
_updateDeltas [ 0 ] . ModuleId = moduleId ;
56
56
_updateDeltas [ 0 ] . MetadataDelta = metadataDelta ;
57
57
_updateDeltas [ 0 ] . ILDelta = ilDelta ;
58
58
_updateDeltas [ 0 ] . PdbBytes = pdbBytes ;
59
59
60
- _hotReloadAgent ! . ApplyDeltas ( _updateDeltas ) ;
60
+ _hotReloadAgent . ApplyDeltas ( _updateDeltas ) ;
61
61
}
62
62
63
63
/// <summary>
0 commit comments