New to Telerik UI for Blazor? Start a free 30-day trial
Cannot read properties of null (reading addEventListener)
Updated over 6 months ago
Environment
| Product | UI for Blazor | 
| Blazor application type | WebAssembly | 
Description
JSInterop (JavaScript) error in the browser devtools console:
Cannot read properties of null (reading 'addEventListener')
Steps to Reproduce
The error can occur in WebAssembly (WASM) projects after updating UI for Blazor to a new version.
Error Message
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')Possible Cause
The error indicates that the app is still using the old version of our telerik-blazor.js file.
Solution
To resolve the error:
- (if using CDN) Update the telerik-blazor.jsfile 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.jsfile with the new version.
Notes
The Blazor framework should normally take care of caching issues with static assets, but they might still occur sometimes.