-
-
Notifications
You must be signed in to change notification settings - Fork 32
[Bug]: Cannot read properties of null (reading 'setAttribute') #170
Copy link
Copy link
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Contact Details
No response
What happened?
I’ve built a Blazor WASM application and I’m running into the following error in the browser console:
invoke-js.ts:242 info: System.Net.Http.HttpClient.Refit.Implementation.Generated+ClepsydraClientInfrastructureApiWarIListsApi, Clepsydra.Client.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.LogicalHandler[100]
Start processing HTTP request GET https://localhost:5001/Api/warehouse/lists?*
invoke-js.ts:242 info: System.Net.Http.HttpClient.Refit.Implementation.Generated+ClepsydraClientInfrastructureApiWarIListsApi, Clepsydra.Client.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.LogicalHandler[100]
Start processing HTTP request GET https://localhost:5001/Api/warehouse/lists?*
invoke-js.ts:242 info: System.Net.Http.HttpClient.Refit.Implementation.Generated+ClepsydraClientInfrastructureApiWarIListsApi, Clepsydra.Client.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.ClientHandler[100]
Sending HTTP request GET https://localhost:5001/Api/warehouse/lists?*
invoke-js.ts:242 info: System.Net.Http.HttpClient.Refit.Implementation.Generated+ClepsydraClientInfrastructureApiWarIListsApi, Clepsydra.Client.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.ClientHandler[100]
Sending HTTP request GET https://localhost:5001/Api/warehouse/lists?*
blazor.webassembly.js:1 MudInput.FocusAsync: Cannot read properties of null (reading 'setAttribute')
**blazor.webassembly.js:1 TypeError: Cannot read properties of null (reading 'setAttribute')
blazor.webassembly.js:1 at window.__originalBlazorFocusMethod.Blazor._internal.domWrapper.focus (https://localhost:5002/_content/MudBlazor.Extensions/MudBlazor.Extensions.lib.module.js:1:57026)**
blazor.webassembly.js:1 at https://localhost:5002/_framework/blazor.webassembly.js:1:2900
blazor.webassembly.js:1 at new Promise (<anonymous>)
blazor.webassembly.js:1 at v.beginInvokeJSFromDotNet (https://localhost:5002/_framework/blazor.webassembly.js:1:2857)
blazor.webassembly.js:1 at Object.Zt [as invokeJSJson] (https://localhost:5002/_framework/blazor.webassembly.js:1:56051)
blazor.webassembly.js:1 at https://localhost:5002/_framework/dotnet.runtime.st3wwc8rqy.js:3:33879
blazor.webassembly.js:1 at Fc (https://localhost:5002/_framework/dotnet.runtime.st3wwc8rqy.js:3:172343)
blazor.webassembly.js:1 at wasm://wasm/00b5ba72:wasm-function[288]:0x1f1e1
blazor.webassembly.js:1 at wasm://wasm/00b5ba72:wasm-function[219]:0x1c8c7
blazor.webassembly.js:1 at wasm://wasm/00b5ba72:wasm-function[210]:0xea32
invoke-js.ts:242 info: System.Net.Http.HttpClient.Refit.Implementation.Generated+ClepsydraClientInfrastructureApiWarIListsApi, Clepsydra.Client.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.ClientHandler[101]
Received HTTP response headers after 1460.8ms - 200
invoke-js.ts:242 info: System.Net.Http.HttpClient.Refit.Implementation.Generated+ClepsydraClientInfrastructureApiWarIListsApi, Clepsydra.Client.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.LogicalHandler[101]
End processing HTTP request after 2060.1ms - 200
invoke-js.ts:242 info: System.Net.Http.HttpClient.Refit.Implementation.Generated+ClepsydraClientInfrastructureApiWarIListsApi, Clepsydra.Client.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.ClientHandler[101]
Received HTTP response headers after 2326.4ms - 200
invoke-js.ts:242 info: System.Net.Http.HttpClient.Refit.Implementation.Generated+ClepsydraClientInfrastructureApiWarIListsApi, Clepsydra.Client.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.LogicalHandler[101]
End processing HTTP request after 2470.3ms - 200
I can’t handle this exception in my code. Has anyone seen this MudInput.FocusAsync error before? Would adding a null check around the focus call be the right mitigation, or is there a better fix (e.g., ensuring the element exists before calling FocusAsync)?
Thanks in advance!
Expected Behavior
null check
Screenshots
No response
Reproduction link
No response
What application type are you referring to?
WebAssembly
Custom Application Type
No response
MudBlazor.Extension Version
8.12.0
MudBlazor Version
8.12.0
What .net Version are you using?
.Net9
What browser are you using?
Edge
Sample Solution
No response
Pull Request
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working