[GH-ISSUE #55] Remote Desktop Crashes - Multi-Monitors #19

Closed
opened 2026-02-27 15:48:19 +03:00 by kerem · 11 comments
Owner

Originally created by @yankejustin on GitHub (Apr 13, 2015).
Original GitHub issue: https://github.com/quasar/Quasar/issues/55

Problem:
In a Multi-Monitor setup, suppose you have two monitors. Open up a Remote Desktop Form and Start, then Stop the Remote Desktop for one of the monitors. Select the other monitor, then attempt to Start Remote Desktop once again. For some reason, this will cause the Client to stop functioning (a window from Windows will pop up stating such, and the Client will crash entirely).

Edit Note 1:
I have two monitors with differing resolutions (1920x1080) and (1080x760).

Edit Note 2:
This problem will not only crash the Client out, but the Server will also crash entirely. Implementing a try-catch for each form disposal here (github.com/MaxXor/xRAT@f9b52c804d/Server/Core/UserState.cs (L46-59)) should fix a situation where one issue with any of the many Forms to be disposed will break the entire Server.

Originally created by @yankejustin on GitHub (Apr 13, 2015). Original GitHub issue: https://github.com/quasar/Quasar/issues/55 Problem: In a Multi-Monitor setup, suppose you have two monitors. Open up a Remote Desktop Form and Start, then Stop the Remote Desktop for one of the monitors. Select the other monitor, then attempt to Start Remote Desktop once again. For some reason, this will cause the Client to stop functioning (a window from Windows will pop up stating such, and the Client will crash entirely). Edit Note 1: I have two monitors with differing resolutions (1920x1080) and (1080x760). Edit Note 2: This problem will not only crash the Client out, but the Server will also crash entirely. Implementing a try-catch for each form disposal here (https://github.com/MaxXor/xRAT/blob/f9b52c804dcad48ea2a7e0ac8c3681b97682c4df/Server/Core/UserState.cs#L46-59) should fix a situation where one issue with any of the many Forms to be disposed will break the entire Server.
kerem 2026-02-27 15:48:19 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@ghost commented on GitHub (Apr 13, 2015):

I noticed this happening as well. I believe it has to do with resolution. Is one of your monitors a different resolution than the other? At 1920x1080 on both of my monitors switching between the two is fine for me, and doesn't crash. When I change the resolution while the Remote Desktop is running the client crashes

<!-- gh-comment-id:92175482 --> @ghost commented on GitHub (Apr 13, 2015): I noticed this happening as well. I believe it has to do with resolution. Is one of your monitors a different resolution than the other? At 1920x1080 on both of my monitors switching between the two is fine for me, and doesn't crash. When I change the resolution while the Remote Desktop is running the client crashes
Author
Owner

@yankejustin commented on GitHub (Apr 13, 2015):

I do have monitors with different resolutions. (1920x1080) and (1080x760). Perhaps that means that https://github.com/MaxXor/xRAT/blob/master/Client/Core/Commands/CommandHandler.cs#L226 could have something to do with this issue.

<!-- gh-comment-id:92182344 --> @yankejustin commented on GitHub (Apr 13, 2015): I do have monitors with different resolutions. (1920x1080) and (1080x760). Perhaps that means that https://github.com/MaxXor/xRAT/blob/master/Client/Core/Commands/CommandHandler.cs#L226 could have something to do with this issue.
Author
Owner

@yankejustin commented on GitHub (Apr 13, 2015):

Accidentally closed! Sorry!

<!-- gh-comment-id:92182485 --> @yankejustin commented on GitHub (Apr 13, 2015): Accidentally closed! Sorry!
Author
Owner

@ghost commented on GitHub (Apr 13, 2015):

https://github.com/MaxXor/xRAT/blob/master/Client/Core/Commands/CommandHandler.cs#L236-L239

The UnsafeStreamCodec class is throwing an exception "Bitmap width/height are not equal to previous bitmap"

Perhaps a try/catch/finally scenario could be of use? I'm not too sure how to handle it properly

<!-- gh-comment-id:92189168 --> @ghost commented on GitHub (Apr 13, 2015): https://github.com/MaxXor/xRAT/blob/master/Client/Core/Commands/CommandHandler.cs#L236-L239 The UnsafeStreamCodec class is throwing an exception "Bitmap width/height are not equal to previous bitmap" Perhaps a try/catch/finally scenario could be of use? I'm not too sure how to handle it properly
Author
Owner

@MaxXor commented on GitHub (Apr 13, 2015):

Can you check if the fix from this branch is working for you?
https://github.com/MaxXor/xRAT/tree/remote-desktop-fix

<!-- gh-comment-id:92244160 --> @MaxXor commented on GitHub (Apr 13, 2015): Can you check if the fix from this branch is working for you? https://github.com/MaxXor/xRAT/tree/remote-desktop-fix
Author
Owner

@ghost commented on GitHub (Apr 13, 2015):

No it does not.

https://github.com/MaxXor/xRAT/blob/master/Client/Core/Commands/CommandHandler.cs#L236-L239

The CodeImage method throws an exception. I think adding a try/catch around this method call and setting the StreamCodec to null in the catch block, then sending a packet with a flag to tell the server to reset the stream and create a new Codec class might do the trick.

<!-- gh-comment-id:92248698 --> @ghost commented on GitHub (Apr 13, 2015): No it does not. https://github.com/MaxXor/xRAT/blob/master/Client/Core/Commands/CommandHandler.cs#L236-L239 The CodeImage method throws an exception. I think adding a try/catch around this method call and setting the StreamCodec to null in the catch block, then sending a packet with a flag to tell the server to reset the stream and create a new Codec class might do the trick.
Author
Owner

@MaxXor commented on GitHub (Apr 13, 2015):

I just changed the monitor resolution of my second monitor to 1080x760 and no exception occured. I followed the steps from yankejustin to reproduce this issue.

<!-- gh-comment-id:92251634 --> @MaxXor commented on GitHub (Apr 13, 2015): I just changed the monitor resolution of my second monitor to 1080x760 and no exception occured. I followed the steps from [yankejustin](https://github.com/MaxXor/xRAT/issues/55#issue-67989812) to reproduce this issue.
Author
Owner

@ghost commented on GitHub (Apr 13, 2015):

My apologies, this DID fix the issue when switching between monitors with two different resolutions.

The issue I was having was changing my resolution on the other monitor while the Remote Desktop was running, which was causing the Codec class to throw the exception.

<!-- gh-comment-id:92252754 --> @ghost commented on GitHub (Apr 13, 2015): My apologies, this DID fix the issue when switching between monitors with two different resolutions. The issue I was having was changing my resolution on the other monitor while the Remote Desktop was running, which was causing the Codec class to throw the exception.
Author
Owner

@MaxXor commented on GitHub (Apr 13, 2015):

Alright! :) Do you think the client should also handle the situation when someone changes the resolution?

<!-- gh-comment-id:92253901 --> @MaxXor commented on GitHub (Apr 13, 2015): Alright! :) Do you think the client should also handle the situation when someone changes the resolution?
Author
Owner

@ghost commented on GitHub (Apr 13, 2015):

I think it should since its possible and bound to happen. Just another little thing to fix to have a bug-free application xD

<!-- gh-comment-id:92254676 --> @ghost commented on GitHub (Apr 13, 2015): I think it should since its possible and bound to happen. Just another little thing to fix to have a bug-free application xD
Author
Owner

@MaxXor commented on GitHub (Apr 13, 2015):

Yes, hehe. :D

<!-- gh-comment-id:92254830 --> @MaxXor commented on GitHub (Apr 13, 2015): Yes, hehe. :D
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Quasar#19
No description provided.