none
[UWP][XBOX] XB1 Window Size

    Question

  • Hi there!  I have a UWP game that runs great on Windows 10. I deployed it to XB1 tonight (yay MS Build conference!) and it worked but the resolution was way off.  For some reason it was displaying what appeared to be a 1024x768 resolution (approximate) instead of 1920x1080.  Does anyone know why this might be happening?  Congrats on the excellent build conference -- can't wait to see my work on XB1.  Thank you!

    Also --- I think my use of the file storage APIs cause the XBOX to reboot.  Is there a process for reporting bugs such as this?

     

    Thursday, March 31, 2016 1:47 AM

Answers

  • The issue is that OnLaunching is too late. You need to do it in the app constructor. I'll follow up to figure out if this is a bug or not. The following worked for me.

    thanks

    mark

            public App()
            {
                bool result = Windows.UI.ViewManagement.ApplicationViewScaling.TrySetDisableLayoutScaling(true);
                Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
                    Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
                    Microsoft.ApplicationInsights.WindowsCollectors.Session);
                this.InitializeComponent();
                this.Suspending += OnSuspending;
            }

    • Marked as answer by S Tonstad Wednesday, April 6, 2016 3:07 AM
    Tuesday, April 5, 2016 4:51 PM
    Moderator

All replies

  • Oops -- I put this in windows phone.  Not sure if a moderator might be OK moving it to the general dev category?  (It won't let me delete the original post... error occurs).
    • Edited by S Tonstad Thursday, March 31, 2016 1:48 AM
    Thursday, March 31, 2016 1:48 AM
  • [Updated 3/30/2016]Welcome to the Developing Universal Windows apps forum!

    This is the correct forum. XBOX team is monitoring this forum.

    Next time, please tag your threads based on Guide to posting: subject line tags  to bring XBOX experts' attention.


    <THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
    Thanks
    Alan Yao
    MSDN Community Support

    Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.


    Thursday, March 31, 2016 2:53 AM
    Owner
  • Hi S Tonstad,

    What resolution is your Xbox One currently set to display out at? Its possible it may be set to 720p or other supported resolution. You should be able to check this within the Settings app on your console under Display & sound > Video Output.

    Regarding the second bit about the file storage APIs causing the Xbox to reboot: Do you have any additional information on the reboot and/or your project that you can share. Repro steps if you're able to reproduce this would be a great help as well. 

    Thanks! 

    Thursday, March 31, 2016 4:47 PM
    Moderator
  • Hi - we automatically scale apps so that apps designed for the desktop appear larger on a TV. This article https://msdn.microsoft.com/windows/uwp/input-and-devices/designing-for-tv explains why. if you don't want scaling you can turn it off using this call

    bool result = Windows.UI.ViewManagement.ApplicationViewScaling.TrySetDisableLayoutScaling(true);

    thanks

    mark

    • Marked as answer by S Tonstad Friday, April 1, 2016 5:30 PM
    • Unmarked as answer by S Tonstad Monday, April 4, 2016 2:27 PM
    Thursday, March 31, 2016 5:17 PM
    Moderator
  • Thank you!  For individuals following this thread -- this API call requires Windows Build 14295.0. You can get this through the Windows insider program.
    • Edited by S Tonstad Friday, April 1, 2016 5:30 PM
    Friday, April 1, 2016 5:26 PM
  • S Tonstad,

    Did you have any additional information on the 2nd item you listed about the File API causing a reboot of your Xbox?  Are you able to reproduce this, and if so, what APIs specifically are you calling when you hit this?

    Friday, April 1, 2016 5:47 PM
  • Hey Matt -- thank you for following up.  I forgot to reply back to your question.   This weekend I will continue to re-enable branches of code to identify an exact line.  The good news (well sort of good) is that the hard reboot happens every time a specific line of code in my app executes.  I have it narrowed it down to one of the following (which I currently have commented out)

    • Reading/Writing with parallel tasks using the Isolated Storage API
    • Parallel HttpRequest calls with large file sizes (downloading assets)
    • A workflow involving multiple tasks which perform heavy IO and hands off UI work to the Dispatcher

    I will definitely reply back this weekend once I find the offending line.  Also -- and this is likely a big caveat -- I was using Windows SDK 10586 instead of 14295.  I didn't realize I was using the older SDK.



    • Edited by S Tonstad Friday, April 1, 2016 6:08 PM
    Friday, April 1, 2016 6:06 PM
  • In 10586/14295 this causes a reboot for me:

            private static async Task LoadAsync(MediaElement mediaElement, string fileName)
            {
                StorageFolder storageFolder = ApplicationData.Current.LocalFolder;
                IStorageItem storageItem = await storageFolder.TryGetItemAsync(fileName);
                if (storageItem == null)
                    return;
                IStorageFile storageFile = storageItem as IStorageFile;
                IRandomAccessStream stream = await storageFile.OpenAsync(FileAccessMode.Read);
                mediaElement.SetSource(stream, storageFile.ContentType); // REBOOT
            }

    Variables:

    fileName "fight_for_your_freedom.mp3"
    storageItem.Folder "LocalState"
    storageFile.ContentType "audio/mpeg"
    stream.CanRead true
    stream.Size 1952914




    • Edited by S Tonstad Monday, April 4, 2016 2:29 PM
    Sunday, April 3, 2016 6:28 AM
  • OK, I tried this out but I am not sure that I understand what the expected behavior should be. It didn't do what I expected.  Here are some screenshots to explain further:

    1) 1920x1080 (100% Scaling), Laptop

    2) XBOX One w/ 1080 TV and 1080 resolution set.  Default - With Layout Scaling

    3) XBOX One w/ 1080 TV and 1080 resolution set.  w/ TryDisableLayoutScaling(True):

    ... I was expecting the UI to look like #1 with layout scaling disabled.  What should it do?


    • Edited by S Tonstad Sunday, April 3, 2016 6:38 PM
    Sunday, April 3, 2016 6:36 PM
  • Reference to ongoing discussion regarding back buffer resolution behavior in MonoGame community: https://github.com/mono/MonoGame/issues/4697

    Sunday, April 3, 2016 6:45 PM
  • I would have expected the same thing as you. We'll need to dig in a bit more. From the other thread, it sounds like you are using Monogame. Is that correct?

    thanks

    mark

    Monday, April 4, 2016 5:14 PM
    Moderator
  • Hi Mark -- thank you for your response.  I am using MonoGame but I don't actually use it until a few screens after this one.  At this start-up screen everything is XAML with no presentation.  When I do present 3D later in the application it is via SwapChainPanel user controls which are subservient to the XAML layout tree.  In the above example with screenshots -- the only thing I am changing is the TryDisableLayoutScaling command.  
    • Edited by S Tonstad Monday, April 4, 2016 6:54 PM
    Monday, April 4, 2016 6:42 PM
  • Thanks. So that screen is just XAML?
    Monday, April 4, 2016 7:48 PM
    Moderator
  • Yes, pure XAML on the load screen. I will try to create a test app that has an image which is 1920x1080 pixels and variations thereof, to see if it is easy to reproduce outside my app.
    Tuesday, April 5, 2016 12:09 AM
  • OK, this seemed easy to repro. I created a new universal app. Here is the XAML for mainpage.xaml:

        <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
            <Rectangle Fill="Red" Width="960" Height="540" HorizontalAlignment="Center" VerticalAlignment="Center"/>
        </Grid>

    And then in app.xaml.cs ...

            protected override void OnLaunched(LaunchActivatedEventArgs e)
            {
                var applicationView = ApplicationView.GetForCurrentView();
                applicationView.TryEnterFullScreenMode();

    Top screen is XB1 at 1080.

    Bottom screen is Laptop at 1080 w/ 100% scale factor.

    If we add Windows.UI.ViewManagement.ApplicationViewScaling.TrySetDisableLayoutScaling(true) we get the following behavior:

    Separate from the layout behavior... I am seeing a totally unexpected quirk.  The XBOX/TV version of the rectangle has a black stroke...  I do not have a stroke defined in the XAML. To test this further I switched from a white background to a TV safe color palette and the black stroke remains.



    • Edited by S Tonstad Tuesday, April 5, 2016 4:34 AM
    Tuesday, April 5, 2016 2:07 AM
  • I think the answer to this thread is that the API call is bugged in this prerelease version of the SDK.  If there is a workaround please let me know.  Thank you for the feedback and insight.


    • Edited by S Tonstad Tuesday, April 5, 2016 1:47 PM
    Tuesday, April 5, 2016 1:47 PM
  • The issue is that OnLaunching is too late. You need to do it in the app constructor. I'll follow up to figure out if this is a bug or not. The following worked for me.

    thanks

    mark

            public App()
            {
                bool result = Windows.UI.ViewManagement.ApplicationViewScaling.TrySetDisableLayoutScaling(true);
                Microsoft.ApplicationInsights.WindowsAppInitializer.InitializeAsync(
                    Microsoft.ApplicationInsights.WindowsCollectors.Metadata |
                    Microsoft.ApplicationInsights.WindowsCollectors.Session);
                this.InitializeComponent();
                this.Suspending += OnSuspending;
            }

    • Marked as answer by S Tonstad Wednesday, April 6, 2016 3:07 AM
    Tuesday, April 5, 2016 4:51 PM
    Moderator