Skip to content

Commit 8b1e9f3

Browse files
authored
Trap JSDisconnectedException on module disposal (#396)
1 parent aacc42e commit 8b1e9f3

File tree

32 files changed

+294
-42
lines changed

32 files changed

+294
-42
lines changed

5.0/BlazorSample_Server/Pages/call-js-from-dotnet/CallJsExample6.razor

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@
3939
{
4040
if (module is not null)
4141
{
42-
await module.DisposeAsync();
42+
try
43+
{
44+
await module.DisposeAsync();
45+
}
46+
catch (JSDisconnectedException)
47+
{
48+
}
4349
}
4450
}
4551
}

5.0/BlazorSample_Server/Pages/call-js-from-dotnet/CallJsExample8.razor

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,24 @@
3434
{
3535
if (mapInstance is not null)
3636
{
37-
await mapInstance.DisposeAsync();
37+
try
38+
{
39+
await mapInstance.DisposeAsync();
40+
}
41+
catch (JSDisconnectedException)
42+
{
43+
}
3844
}
3945

4046
if (mapModule is not null)
4147
{
42-
await mapModule.DisposeAsync();
48+
try
49+
{
50+
await mapModule.DisposeAsync();
51+
}
52+
catch (JSDisconnectedException)
53+
{
54+
}
4355
}
4456
}
4557
}

5.0/BlazorSample_WebAssembly/Pages/call-js-from-dotnet/CallJsExample6.razor

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,13 @@
3939
{
4040
if (module is not null)
4141
{
42-
await module.DisposeAsync();
42+
try
43+
{
44+
await module.DisposeAsync();
45+
}
46+
catch (JSDisconnectedException)
47+
{
48+
}
4349
}
4450
}
4551
}

5.0/BlazorSample_WebAssembly/Pages/call-js-from-dotnet/CallJsExample8.razor

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,24 @@
3434
{
3535
if (mapInstance is not null)
3636
{
37-
await mapInstance.DisposeAsync();
37+
try
38+
{
39+
await mapInstance.DisposeAsync();
40+
}
41+
catch (JSDisconnectedException)
42+
{
43+
}
3844
}
3945

4046
if (mapModule is not null)
4147
{
42-
await mapModule.DisposeAsync();
48+
try
49+
{
50+
await mapModule.DisposeAsync();
51+
}
52+
catch (JSDisconnectedException)
53+
{
54+
}
4355
}
4456
}
4557
}

6.0/BlazorSample_Server/Pages/call-js-from-dotnet/CallJsExample6.razor

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@
3838
{
3939
if (module is not null)
4040
{
41-
await module.DisposeAsync();
41+
try
42+
{
43+
await module.DisposeAsync();
44+
}
45+
catch (JSDisconnectedException)
46+
{
47+
}
4248
}
4349
}
4450
}

6.0/BlazorSample_Server/Pages/call-js-from-dotnet/CallJsExample8.razor

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,24 @@
3939
{
4040
if (mapInstance is not null)
4141
{
42-
await mapInstance.DisposeAsync();
42+
try
43+
{
44+
await mapInstance.DisposeAsync();
45+
}
46+
catch (JSDisconnectedException)
47+
{
48+
}
4349
}
4450

4551
if (mapModule is not null)
4652
{
47-
await mapModule.DisposeAsync();
53+
try
54+
{
55+
await mapModule.DisposeAsync();
56+
}
57+
catch (JSDisconnectedException)
58+
{
59+
}
4860
}
4961
}
5062
}

6.0/BlazorSample_WebAssembly/Pages/call-js-from-dotnet/CallJsExample6.razor

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@
3838
{
3939
if (module is not null)
4040
{
41-
await module.DisposeAsync();
41+
try
42+
{
43+
await module.DisposeAsync();
44+
}
45+
catch (JSDisconnectedException)
46+
{
47+
}
4248
}
4349
}
4450
}

6.0/BlazorSample_WebAssembly/Pages/call-js-from-dotnet/CallJsExample8.razor

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,24 @@
3939
{
4040
if (mapInstance is not null)
4141
{
42-
await mapInstance.DisposeAsync();
42+
try
43+
{
44+
await mapInstance.DisposeAsync();
45+
}
46+
catch (JSDisconnectedException)
47+
{
48+
}
4349
}
4450

4551
if (mapModule is not null)
4652
{
47-
await mapModule.DisposeAsync();
53+
try
54+
{
55+
await mapModule.DisposeAsync();
56+
}
57+
catch (JSDisconnectedException)
58+
{
59+
}
4860
}
4961
}
5062
}

7.0/BlazorSample_Server/Pages/call-js-from-dotnet/CallJsExample6.razor

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@
3838
{
3939
if (module is not null)
4040
{
41-
await module.DisposeAsync();
41+
try
42+
{
43+
await module.DisposeAsync();
44+
}
45+
catch (JSDisconnectedException)
46+
{
47+
}
4248
}
4349
}
4450
}

7.0/BlazorSample_Server/Pages/call-js-from-dotnet/CallJsExample8.razor

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,24 @@
3939
{
4040
if (mapInstance is not null)
4141
{
42-
await mapInstance.DisposeAsync();
42+
try
43+
{
44+
await mapInstance.DisposeAsync();
45+
}
46+
catch (JSDisconnectedException)
47+
{
48+
}
4349
}
4450

4551
if (mapModule is not null)
4652
{
47-
await mapModule.DisposeAsync();
53+
try
54+
{
55+
await mapModule.DisposeAsync();
56+
}
57+
catch (JSDisconnectedException)
58+
{
59+
}
4860
}
4961
}
5062
}

0 commit comments

Comments
 (0)