The issue can be reproduced when clicking on a button that opens a predefined Dialog, then making some changes on the page and hot reloading. In this scenario, I get the following error:
Microsoft.JSInterop.JSException: Cannot read properties of null (reading 'addEventListener') TypeError: Cannot read properties of null (reading 'addEventListener')