Prevent null refs in RemoteJSRuntime
Fixes https://github.com/aspnet/AspNetCore/issues/13396
This commit is contained in:
parent
29a1d50e02
commit
cc368c8e08
|
|
@ -70,12 +70,12 @@ namespace Microsoft.AspNetCore.Components.Server.Circuits
|
||||||
|
|
||||||
protected override void BeginInvokeJS(long asyncHandle, string identifier, string argsJson)
|
protected override void BeginInvokeJS(long asyncHandle, string identifier, string argsJson)
|
||||||
{
|
{
|
||||||
if (!_clientProxy.Connected)
|
if (_clientProxy is null)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("JavaScript interop calls cannot be issued at this time. This is because the component is being " +
|
throw new InvalidOperationException(
|
||||||
"prerendered and the page has not yet loaded in the browser or because the circuit is currently disconnected. " +
|
"JavaScript interop calls cannot be issued at this time. This is because the component is being " +
|
||||||
"Components must wrap any JavaScript interop calls in conditional logic to ensure those interop calls are not " +
|
$"statically rendererd. When prerendering is enabled, JavaScript interop calls can only be performed " +
|
||||||
"attempted during prerendering or while the client is disconnected.");
|
$"during the OnAfterRenderAsync lifecycle method.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.BeginInvokeJS(_logger, asyncHandle, identifier);
|
Log.BeginInvokeJS(_logger, asyncHandle, identifier);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue