title | description | type | page_title | slug | position | tags | ticketid | res_type |
---|---|---|---|---|---|---|---|---|
Cannot read properties of null (reading addEventListener) |
How to resolve JavaScript JSInterop error about addEventListener in Blazor WebAssembly applications. |
troubleshooting |
Cannot read properties of null (reading addEventListener) |
common-kb-cannot-read-properties-of-null-reading-addeventlistener |
error, update, WASM, WebAssembly |
1545248, 1550215, 1550371, 1552007 |
kb |
Product | UI for Blazor |
Blazor application type | WebAssembly |
JSInterop (JavaScript) error in the browser devtools console:
Cannot read properties of null (reading 'addEventListener')
The error can occur in WebAssembly (WASM) projects after updating UI for Blazor to a new version.
````JS Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: Cannot read properties of null (reading 'addEventListener') TypeError: Cannot read properties of null (reading 'addEventListener') ```` ````JS Microsoft.JSInterop.JSException: Cannot read properties of null (reading 'addEventListener') TypeError: Cannot read properties of null (reading 'addEventListener') ````The error indicates that the app is still using the old version of our telerik-blazor.js
file.
To resolve the error:
- (if using CDN) Update the
telerik-blazor.js
file URL to the correct version. - (if using static assets) Clear the browser cache and add a cache buster for the Telerik assets.
- (if using a local JS file) Replace the
telerik-blazor.js
file with the new version.
The Blazor framework should normally take care of caching issues with static assets, but they might still occur sometimes.
- Telerik UI for Blazor version upgrade steps
- Troubleshooting JavaScript Errors
- Fix styling issues after component version update