locked
RDP error on Surface Pro: is it a system or hardware bug??

    Question

  • Hello, dear all,

    Recently I encountered an RDP error on Surface Pro: I connect to a remote Win8 Pro machine through the RDP ActiveX control on Surface Pro. When I played a HD video for about a few seconds, the RDP session will be disconnected with a message box popped up:because of a protocol error (0x112f) the remote session will be disconnected...

    I've made some search but got no correct solution. Here is the original discussion thread: http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/72ceca09-ab4a-4689-896c-6c86697333d6/#aff1f11a-7dd2-464d-8061-6b87fcac076b.

    After debugging the issue on both Surface RT and Surface Pro, I found that RT works well, while Pro always hits this issue. The RDP window resolution on Pro is always set as 1371*771, while on RT it is 1366*768. After manually change the height and width of the RDP window, such as 1280*800, the issue couldn't be reproduced on Pro, so I believe it is an issue of resolution.

    Does any one know how to resolve it?
    Friday, May 3, 2013 4:52 AM

Answers

  • What doesn't work? Do you mean that the issue still reproduces - RDP window does not respond (original issue) or do you mean that the solution does not work because you have to add scrollbars (the one you have reported above)?

    The solution I had recommended was to ensure that SetRdpProperty should be used with the target resolution = 1920*1080, and the size of the <object> tag of the RDP control should be adjusted to the relative height/width of 1371*771 when you want to run the remote desktop "fullscreen". If there are other elements such as buttons and textboxes (like the RDP sample has) sharing space with the RDP window object, then you need to reduce the size of the RDP window so that you don't have to add scrollbars. With this approach, the <object> size remains low, but since you are using the SetRdpProperty with the target resolution of 1920*1080 (HD resolution), the screen resolution that gets used will be high res.

    Actually, I forgot to mention that you have to also set the height & width of the <object> tag that gets created in the sample code in addition to the changes I had suggested earlier:

    In all your code should look like this, and also ensure that your code is using "fullscreen" to prevent using any scrollbars:

    var scaleFactor = Windows.Graphics.Display.DisplayProperties.resolutionScale / 100;
    var preciseBounds = document.documentElement.getBoundingClientRect();

    // Set remote desktop resolution using device pixels (1920 * 1680)
    var desktopWidth = Math.round(preciseBounds.width * scaleFactor);
    var desktopHeight = Math.round(preciseBounds.height * scaleFactor);

    // Set <object> size using relative pixels (~1371.43 * ~771.43)
    var objectStyleWidth = preciseBounds.width + "px";
    var objectStyleHeight = preciseBounds.height + "px";

        var page = WinJS.UI.Pages.define("/html/make-connection.html", {
            ready: function (element, options) {
            ......
            ......
            var rdpDiv = document.getElementById("clientControlRegion");
            rdpDiv.style.width = objectStyleWidth;
            rdpDiv.style.height = objectStyleHeight;
        }

            if (connect) {
                // Create the client control, set connection properties and connect.
                var objectStyleWidth = preciseBounds.width + "px";
                var objectStyleHeight = preciseBounds.height - document.getElementById("btnConnect").clientHeight + "px";

                myClientControlObject = Microsoft.Sample.RDPClient.createClientControl(objectStyleWidth, objectStyleHeight);

    Thanks,

    Prashant


    @prashantphadke || Windows Store Developer Solutions #WSDevSol || Want more solutions? See our blog, Windows Store & Phone Developer Solutions

    • Marked as answer by B0L Thursday, May 30, 2013 8:05 AM
    Tuesday, May 28, 2013 10:10 PM
    Moderator

All replies

  • The issue could only be reproduced with:

    1. a Win8 system

    2. The HD video is played with the Win8 Video app.

    However, if we play the video with Windows Media Player, everything is OK. That is the strangest thing.


    • Edited by B0L Friday, May 3, 2013 9:44 AM
    Friday, May 3, 2013 9:44 AM
  • For Microsoft's Remote Desktop app container client sample, it also has the same bug. The reproducing steps are as the following:

    1. download the sample from http://code.msdn.microsoft.com/windowsapps/Remote-Desktop-app-461567af
    2. open make-connection.js, change desktopWidth to 1371, and desktopHeight to 771. These two values are actually the window width and height for a full screen App on a Surface Pro.
    3. Run the app, connecting to a remote Win 8 desktop, and play a HD video with the system's Video App. After a while, the RDP window will be no responsible.

    I really hope some one here could give me some suggestions. Thanks.

    Friday, May 10, 2013 2:13 AM
  • Hi B0L,

    If I am not mistaken, Surface PRO has a default resolution of 1920*1280, and the Surface RT has a default resolution of 1366*788. http://www.microsoft.com/surface/en-us/surface-with-windows-8-pro/specifications

    I would also like to get some more clarification on this issue.

    1.) Does this problem happen ONLY when connecting from a Surface PRO machine to another Windows 8 machine or can you reproduce this problem with the app running on a regular Windows 8 machine as well?

    2.) Where should I play the HD video on? The Surface PRO machine - where the RDP app is running or on the remote machine?

    Thanks,

    Prashant


    @prashantphadke || Windows Store Developer Solutions #WSDevSol || Want more solutions? See our blog, Windows Store & Phone Developer Solutions

    Thursday, May 16, 2013 5:44 PM
    Moderator
  • Hello, Prashant,

    Really thank you very much for your follow-through.

    Yeah, this issue only exists on Surface Pro@1920*1080. As Microsoft has some optimizations on this resolution for HD tablets, they are treated as scaled 140%, namely, if this resolution will be treated as 1371*771 for Windows Metro App.

    There is a long discussion on http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/314f03ae-6b27-4f4a-acb5-c67d3372238c/.

    Microsoft also has an official blog talking about this: http://blogs.msdn.com/b/b8/archive/2012/03/21/scaling-to-different-screens.aspx.

    If I set other resolution on Surface Pro, such as 1600*900, the issue couldn't be reproduced. Thanks.

    Friday, May 17, 2013 4:23 AM
  • Hi, Prashant,

    For the second question: yes, playing the video on the remote machine through the Video app. Thanks.

    Tuesday, May 21, 2013 7:35 AM
  • Hi B0L,

    On the Surface Pro when the immersive scale factor is 1.4 JavaScript sees 1371*771, but you’ll get crisper graphics and input handling if you set the remote desktop resolution (using SetRdpProperty) to the true device resolution, i.e. 1920*1080 on the Surface Pro. The height/width style for the container object (clientControlRegion div in the sample) will still need to be set using relative pixels – preferably something like “100%”, but precise “1371.AApx” * “771.BBpx” (via getBoundingClientRect) is still ok.

    Here is sample code that you can use in the Remote desktop sample that should help you:

    var scaleFactor = Windows.Graphics.Display.DisplayProperties.resolutionScale / 100;
    var preciseBounds = document.documentElement.getBoundingClientRect();

    // Set remote desktop resolution using device pixels (1920 * 1680)
    var desktopWidth = Math.round(preciseBounds.width * scaleFactor);
    var desktopHeight = Math.round(preciseBounds.height * scaleFactor);

    // Set <object> size using relative pixels (~1371.43 * ~771.43)
    var objectStyleWidth = preciseBounds.width + "px";
    var objectStyleHeight = preciseBounds.height + "px";

        var page = WinJS.UI.Pages.define("/html/make-connection.html", {
            ready: function (element, options) {
            ......
            ......
            var rdpDiv = document.getElementById("clientControlRegion");
            rdpDiv.style.width = objectStyleWidth;
            rdpDiv.style.height = objectStyleHeight;
        }

    Let me know how it goes.

    Thanks,

    Prashant.


    @prashantphadke || Windows Store Developer Solutions #WSDevSol || Want more solutions? See our blog, Windows Store & Phone Developer Solutions

    Saturday, May 25, 2013 12:19 AM
    Moderator
  • I've tried but it doesn't work:

    a. there is no horizontal or vertical toolbar (It should be able to be added, but I didn't do so);

    b. based on item a, the content couldn't be fully displayed in the RDP window.

    c. if we add horizontal/vertical toolbar, the UI looks bad.

    So I don't think the solution work...Thanks.

    Monday, May 27, 2013 11:53 AM
  • What doesn't work? Do you mean that the issue still reproduces - RDP window does not respond (original issue) or do you mean that the solution does not work because you have to add scrollbars (the one you have reported above)?

    The solution I had recommended was to ensure that SetRdpProperty should be used with the target resolution = 1920*1080, and the size of the <object> tag of the RDP control should be adjusted to the relative height/width of 1371*771 when you want to run the remote desktop "fullscreen". If there are other elements such as buttons and textboxes (like the RDP sample has) sharing space with the RDP window object, then you need to reduce the size of the RDP window so that you don't have to add scrollbars. With this approach, the <object> size remains low, but since you are using the SetRdpProperty with the target resolution of 1920*1080 (HD resolution), the screen resolution that gets used will be high res.

    Actually, I forgot to mention that you have to also set the height & width of the <object> tag that gets created in the sample code in addition to the changes I had suggested earlier:

    In all your code should look like this, and also ensure that your code is using "fullscreen" to prevent using any scrollbars:

    var scaleFactor = Windows.Graphics.Display.DisplayProperties.resolutionScale / 100;
    var preciseBounds = document.documentElement.getBoundingClientRect();

    // Set remote desktop resolution using device pixels (1920 * 1680)
    var desktopWidth = Math.round(preciseBounds.width * scaleFactor);
    var desktopHeight = Math.round(preciseBounds.height * scaleFactor);

    // Set <object> size using relative pixels (~1371.43 * ~771.43)
    var objectStyleWidth = preciseBounds.width + "px";
    var objectStyleHeight = preciseBounds.height + "px";

        var page = WinJS.UI.Pages.define("/html/make-connection.html", {
            ready: function (element, options) {
            ......
            ......
            var rdpDiv = document.getElementById("clientControlRegion");
            rdpDiv.style.width = objectStyleWidth;
            rdpDiv.style.height = objectStyleHeight;
        }

            if (connect) {
                // Create the client control, set connection properties and connect.
                var objectStyleWidth = preciseBounds.width + "px";
                var objectStyleHeight = preciseBounds.height - document.getElementById("btnConnect").clientHeight + "px";

                myClientControlObject = Microsoft.Sample.RDPClient.createClientControl(objectStyleWidth, objectStyleHeight);

    Thanks,

    Prashant


    @prashantphadke || Windows Store Developer Solutions #WSDevSol || Want more solutions? See our blog, Windows Store & Phone Developer Solutions

    • Marked as answer by B0L Thursday, May 30, 2013 8:05 AM
    Tuesday, May 28, 2013 10:10 PM
    Moderator
  • Hi, Prashant, thank you very much! I think it could satisfy my request.

    Thursday, May 30, 2013 8:05 AM