Electron.NET
Electron.NET copied to clipboard
Can't change UserData path before Electron is ready
- 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).
Hi @The-MAZZTer I'm running into a similar issue (need to call appendSwitch before app is ready). Did you find any workaround for this in your case?
I ended up coding my own interface between electron and .NET that launches electron from .NET instead of the other way around. I think the workaround I found before then was to modify some JSON file for the election project but I forget exactly.
On Wed, Dec 1, 2021, 9:26 PM gbenthomas @.***> wrote:
Hi @The-MAZZTer https://github.com/The-MAZZTer I'm running into a similar issue (need to call appendSwitch before app is ready). Did you find any workaround for this in your case?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ElectronNET/Electron.NET/issues/555#issuecomment-984234084, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAC4AHLN5UFOUR2NYMGWO5DUO3KNHANCNFSM43AGGLVQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
🎉🚀 New Electron.NET version 23.6.1 released 🚀🎉
With native Electron 23 and .NET 6 support. Your problem should be fixed here. If you continue to have the problem, please let us know. Please note the correct updating of your API & CLI. Info in the README. Have fun!