Skip to content

Can't change UserData path before Electron is ready #555

@The-MAZZTer

Description

@The-MAZZTer
  • Version:
    9.31.2 (latest version compatible with .NET Core 3.1)

.NET Core 3.1

  • Target:
    Windows

From looking through the main,js of the electron host, it looks like the bridge to ASP.NET Core is only constructed after Electron's ready event fires. Unfortunately this means it is not possible to set up some things in electron. Specifically you need to call app.setPath for the userdata folder before the ready event fires in order for everything to use it.

For example this means every Electron.NET app will mix its browser profiles in the same folder (%APPDATA%\Electron) which could be undesirable.

Possible solutions would be to add a field to electron.manifest.json to allow changing this folder. main.js could read it and call app.setPath for you.

However this is only a bandaid. The way Electron.NET runs applications now is pretty janky and prone to other problems like this.

I think the real solution is going to be having the ASP.NET Core process serve as the root process, and having it launch the electron process as a child. This also solves problems with debugging as VS will attach to the root process automatically (you can manually attach to the process today, but not only is that annoying, but if the process crashes before you can attach then that's not an acceptable solution to debug the crash).

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions