Uncaught (in promise) Error: System.NullReferenceException: Object reference not set to an instance of an object.

Rashmi
Rashmi
1068 Points
19 Posts

I upgraded Telerik UI for Blazor 6.0.2 package from 5.0.0. Now it's erroring on window resizing as:

Uncaught (in promise) Error: System.NullReferenceException: Object reference not set to an instance of an object.
   at Telerik.Blazor.Components.TelerikWindow.SetSize(WindowSizeDescriptor size)
   at Telerik.Blazor.Components.TelerikWindow.Window_ResizeEnd(WindowResizeEventArgs args)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeDirectByRefWithFewArgs(Object obj, Span`1 copyOfArgs, BindingFlags invokeAttr)
--- End of stack trace from previous location ---
   at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.InvokeSynchronously(JSRuntime jsRuntime, DotNetInvocationInfo& callInfo, IDotNetObjectReference objectReference, String argsJson)
   at Microsoft.JSInterop.Infrastructure.DotNetDispatcher.BeginInvokeDotNet(JSRuntime jsRuntime, DotNetInvocationInfo invocationInfo, String argsJson)
    at y.endInvokeDotNetFromJS (https://localhost:44312/_framework/blazor.server.js:1:3502)
    at Xt._invokeClientMethod (https://localhost:44312/_framework/blazor.server.js:1:61001)
    at Xt._processIncomingData (https://localhost:44312/_framework/blazor.server.js:1:58476)
    at Xt.connection.onreceive (https://localhost:44312/_framework/blazor.server.js:1:52117)
    at s.onmessage (https://localhost:44312/_framework/blazor.server.js:1:80262)

Anyone has any clue?

Views: 249
Total Answered: 1
Total Marked As Answer: 1
Posted On: 27-Jun-2024 01:11

Share:   fb twitter linkedin
Answers
Rashmi
Rashmi
1068 Points
19 Posts
         

Resolved issue myself by changing content policy in the application. Current content policy is not allowing insecure evaluation in blazor js causing above error. Added 'unsafe-eval'.

Changed from:

context.Response.Headers.Append("Content-Security-Policy", "script-src 'self' 'unsafe-inline' kit.fontawesome.com;");

to:

context.Response.Headers.Append("Content-Security-Policy", "script-src 'self' 'unsafe-eval' 'unsafe-inline' kit.fontawesome.com;");

 

Posted On: 27-Jun-2024 20:39
Thanks for sharing solution.
 - Brian  30-Jun-2024 07:24
welcome!
 - Rashmi  08-Jul-2024 04:05
 Log In to Chat