Skip to content

Commit cc368c8

Browse files
pranavkmmkArtakMSFT
authored andcommitted
Prevent null refs in RemoteJSRuntime
Fixes #13396
1 parent 29a1d50 commit cc368c8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Components/Server/src/Circuits/RemoteJSRuntime.cs

+5-5
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ private void EndInvokeDotNetCore(string callId, bool success, object resultOrErr
7070

7171
protected override void BeginInvokeJS(long asyncHandle, string identifier, string argsJson)
7272
{
73-
if (!_clientProxy.Connected)
73+
if (_clientProxy is null)
7474
{
75-
throw new InvalidOperationException("JavaScript interop calls cannot be issued at this time. This is because the component is being " +
76-
"prerendered and the page has not yet loaded in the browser or because the circuit is currently disconnected. " +
77-
"Components must wrap any JavaScript interop calls in conditional logic to ensure those interop calls are not " +
78-
"attempted during prerendering or while the client is disconnected.");
75+
throw new InvalidOperationException(
76+
"JavaScript interop calls cannot be issued at this time. This is because the component is being " +
77+
$"statically rendererd. When prerendering is enabled, JavaScript interop calls can only be performed " +
78+
$"during the OnAfterRenderAsync lifecycle method.");
7979
}
8080

8181
Log.BeginInvokeJS(_logger, asyncHandle, identifier);

0 commit comments

Comments
 (0)