Skip to content

Error on reloading a window after a second window is closed #664

@dlitty

Description

@dlitty
  • Version: latest (13.5.1)
  • .NET 5
  • Target: None; electronize start will reproduce

Using the latest Electron.NET API & CLI: if an application has two windows open, then one of them is closed, and you call Reload() on the first one, an error occurs:

A Javascript error occurred in the main process
Uncaught Exception: TypeError: Object has been destroyed
at BrowserWindow.<anonymous>( ... path ... /obj/Host/api/browserWindows.js:205:55 ...

Steps to Reproduce:

  1. Create a new .NET 5 ASP.NET web application
  2. Follow the instructions in the readme to set up Electron.NET in the project
  3. Instead of Task.Run(async () => await Electron.WindowManager.CreateWindowAsync());, use:
    Task.Run(async () => 
    {
        var mainWindow = await Electron.WindowManager.CreateWindowAsync();
        var secondWindow = await Electron.WindowManager.CreateWindowAsync();
        secondWindow.Close();
        mainWindow.Reload();
    }

Alternatively, comment out the Close and Reload lines, and manually close one window and hit Cmd-R on the other.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions