It's not possible to have two apps open simultaneously #990

Open
opened 2026-01-29 16:54:03 +00:00 by claunia · 0 comments
Owner

Originally created by @FrankBoehringerKirchner on GitHub (Oct 31, 2025).

  • ElectronNET.API Version: 23.6.2
  • ElectronNET.CLI Version: 23.6.2
  • Node: v22.19.0
  • .NET Core: 8
  • Target: Windows

I know ElectronNET should find the next available port if the default one is occupied, but for me (and my colleague) the port scanner hasn’t been working reliably inside the ElectronNET host. After multiple attempts, I’ve found it succeeds roughly 30% of the time. In other cases, it fails with the following error:

Image

I haven’t been able to determine exactly why the port scanner fails intermittently, especially since it works fine when tested in a separate project. However, I managed to fix the issue locally by modifying the main.js of the ElectronNET host to retry finding an available port if listening to the created socket fails.

Before I open a PR with this retry logic, I wanted to ask if anyone else has encountered this issue. It seems odd that no one has reported it yet. 😄 Although, to be fair, I think a retry loop would be beneficial anyway because it makes this critical part of the program more stable- and it would, for example, solve issue #871 as well.

Steps to Reproduce:

  1. create an empty ElectronNET app
  2. run it and wait for the application to pop up
  3. run it again

OR

  1. create an empty ElectronNET app
  2. build app for windows
  3. run the app and wait for the application to pop up
  4. run it again

By the way, as a longtime ElectronJS fan I was excited to see there’s a way to use it in .NET, since I need to create a cross-platform C# project for work. :D

Originally created by @FrankBoehringerKirchner on GitHub (Oct 31, 2025). * **ElectronNET.API Version**: 23.6.2 * **ElectronNET.CLI Version**: 23.6.2 * **Node**: v22.19.0 * **.NET Core**: 8 * **Target**: Windows I know ElectronNET should find the next available port if the default one is occupied, but for me (and my colleague) the port scanner hasn’t been working reliably inside the ElectronNET host. After multiple attempts, I’ve found it succeeds roughly 30% of the time. In other cases, it fails with the following error: <img width="443" height="215" alt="Image" src="https://github.com/user-attachments/assets/30d8c8f8-f00f-44a3-98a0-fc5c22537543" /> I haven’t been able to determine exactly why the port scanner fails intermittently, especially since it works fine when tested in a separate project. However, I managed to fix the issue locally by modifying the `main.js` of the ElectronNET host to retry finding an available port if listening to the created socket fails. Before I open a PR with this retry logic, I wanted to ask if anyone else has encountered this issue. It seems odd that no one has reported it yet. 😄 Although, to be fair, I think a retry loop would be beneficial anyway because it makes this critical part of the program more stable- and it would, for example, solve issue #871 as well. Steps to Reproduce: 1. create an empty ElectronNET app 2. run it and wait for the application to pop up 3. run it again **OR** 1. create an empty ElectronNET app 2. build app for windows 3. run the app and wait for the application to pop up 4. run it again By the way, as a longtime ElectronJS fan I was excited to see there’s a way to use it in .NET, since I need to create a cross-platform C# project for work. :D
claunia added the bug label 2026-01-29 16:54:03 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Electron.NET#990