-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix multi-window interaction with the single process work #972
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comments.
The app now doesn't open anymore, it like the following exists immediately:
_logger.LogInformation("Starting application loop.");
app.Run(MainThreadData.GlobalShutdownToken);
_logger.LogInformation("Application loop ended.");
00:00:01.793 [INFO] Starting UI application
00:00:02.104 [INFO] Starting application loop.
00:00:02.105 [INFO] Application loop ended.
00:00:02.105 [DEBUG] Startup handler returned 0
Edit: MainThreadData.GlobalShutdownToken
appears to already be canceled.
Is this in debug mode? Works fine in debug without a debugger attached on my machine ( |
NexusMods.App/src/NexusMods.App/StartupHandler.cs Lines 50 to 63 in 9232312
|
This gets us up back and running. I don't like how there's two paths for the code now, where some things only happen under Debug mode, but I need to think how to better manage this in a way where the code is a bit cleaner. Perhaps a lot of this logic can be moved into the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple windows now work again, however, you're unable to close any windows. If you close a window, an exception is thrown due to AvaloniaUI/Avalonia#14437 and the window stays frozen on screen. The only way to solve this is by manually killing the main process of the app.
This wasn't an issue before. Previously, the exception from AvaloniaUI/Avalonia#14437 would just be thrown, and the window would close without issues.
What process are you going through to get this to happen? I just opened and closed a bunch of windows with this branch and didn't see this exception? |
The exception should always appear in the log, since the underlying issue AvaloniaUI/Avalonia#14437 hasn't been fixed yet. However, the last two commits of this PR introduced another issue: the window doesn't close properly, and the main process is still running. I had to manually kill the main process before the windows disappeared. This happens when running with a debugger and without. |
I can't get this error at all, it all cleanly shuts down for me, I'll switch over to my ubuntu machine and see if I can get it to happen there. |
I'm testing the merge with main and I can reproduce on windows 11. The issue is that when you have two windows open and close one, that one crashes on close, which in turn crashes the other window as well. For me the second window closes automatically a few seconds after the crash instead of forcing me to close it manually. |
Ah I haven't managed a game yet, let me try that |
This PR conflicts with |
@halgari The app crash on close issue was fixed in: That should unblock work on this PR again. |
This PR doesn't conflict with |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #972 +/- ##
==========================================
- Coverage 54.89% 54.18% -0.72%
==========================================
Files 669 669
Lines 22126 22177 +51
Branches 1710 1713 +3
==========================================
- Hits 12147 12017 -130
- Misses 9580 9758 +178
- Partials 399 402 +3
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running the app without an attached debugger via dotnet run
, the processes remain running after closing the window.
When running the app with an attached debugger and running two instances, you get two processes, not a single process.
When Running on Linux, this PR makes it so you can't run the App in an IDE without the debugger attached. First process spawns 2nd process, then it dies, as far as I can tell. |
Fixes #968 and #965.
This fixes the above bugs by reworking how we open multiple windows. Namely: