1

I have an Xbox One/Xbox Series X|S app that reliably encounters a fatal exception (app crash) on only some consoles. Here are my observations:

  1. The crash affects Xbox Series X consoles
  2. Does not affect Xbox One consoles
  3. I am uncertain if Xbox Series S consoles are affected
  4. All consoles affected have an early manufacturing date (circa 2019)
  5. The problem resolves after setting the resolution to 1080p on the settings menu of the Xbox

After some troubleshooting, I discovered the problem was the television connected to the console. The app will only crash if the Xbox is connected to a UHD television (any UHD television), but not if connected to an HD television. I tried several TVs, so I know it is not just one TV that causes the problem.

Technical info

Written as a UWP app in C#/XAML, it targets min and max framework versions 1903 (10.0; Build 18362) and 2004 (10.0; Build 19041). The app is not very complex and is merely a hosted web app container. It contains little more than a WebView (EdgeHTML) and some code for proper scaling while in full-screen mode on the Xbox. The execution mode for the WebView is WebViewExecutionMode.SameThread.

I think the only workaround for this would be to limit the app to 1080p rendering only. Is there a way I can do that?

After capturing the error (information posted below), it is apparent that the app is running out of memory while the user navigates through screens on the hosted portion of the app. I did check the JavaScript, and there is nothing buggy in it. It appears that rendering the webpage in 4K is the problem:

Exception thrown at 0x00007FFA0CF346AC (KernelBase.dll) in 
********.exe: WinRT originate error - 0x8007000E: 'Not enough 
memory resources are available to complete this operation.'

Result of error lookup on 0x8007000E

# anonymous HRESULT: Severity: FAILURE (1), Facility 0x1fff, Code 0xffff
# for hex 0xffff / decimal 65535
  CDERR_DIALOGFAILURE                                            cderr.h
# 1 matches found for "0x00007FFA0CF346AC"
# for hex 0x8007000e / decimal -2147024882
  COR_E_OUTOFMEMORY                                              corerror.h
# The EE thows this exception when no more memory is avaible
# to continue execution
  DDERR_OUTOFMEMORY                                              ddraw.h
  DIERR_OUTOFMEMORY                                              dinput.h
  DSERR_OUTOFMEMORY                                              dsound.h
  STIERR_OUTOFMEMORY                                             stierr.h
  E_OUTOFMEMORY                                                  winerror.h
# Ran out of memory
# as an HRESULT: Severity: FAILURE (1), FACILITY_WIN32 (0x7), Code 0xe
# for hex 0xe / decimal 14
  ERROR_OUTOFMEMORY                                              winerror.h
# Not enough memory resources are available to complete this
# operation.

Two potential solutions were suggested:

  1. Run the memory diagnostic tool in Visual Studio
  2. Change the execution mode of the WebView

Results:

  1. Execution mode = WebViewExecutionMode.SameThread

    • This is the control. When on the cranky Xbox Series X and similar models like it, the app behaves unexpectedly by crashing.
  2. Execution mode = WebViewExecutionMode.SeparateThread

    • Behaves just how it does as if it were on the same thread.
  3. Execution mode = WebViewExecutionMode.SeparateProcess

    • Behaves well for a little while until you look away and try again.

I don’t think the execution mode is to blame. Also, trying to attach the VS memory profiler revealed this is a heisenbug. Its behavior is apparent, but if one tries to observe why, the behavior changes, and by that, I mean the crash does not happen.

Joshua Dannemann
  • 2,003
  • 1
  • 14
  • 34
  • If you're developing for Xbox you should have direct access to Xbox Developer Support... so I'm curious why you're posting this to SO? (After all, we really don't see game-devs post here... well, excepting Unity hobbyists). – Dai Aug 05 '22 at 15:50
  • This is not game development. This is an app for Xbox and my question relates to UWP/C# development. It could very well also be a Windows app. Essentially, I am asking if there is a way to set the app to render with 1080p resolution or if there is some other workaround in code. – Joshua Dannemann Aug 05 '22 at 15:54
  • You say it's using `WebView`... please confirm if that's the new (Chromium-based) or old (EdgeHTML-based) or _ancient_ (MSHTML-based) control? – Dai Aug 05 '22 at 15:56
  • It is using the legacy Edge-based WebView. WebView2 (to my knowledge) is not yet available to use on Xboxes – Joshua Dannemann Aug 05 '22 at 15:57
  • Are you able to do any memory-profiling, attach a debugger at runtime, or perform any other diagnostics? Can you reliably reproduce the issue? – Dai Aug 05 '22 at 16:00
  • Yes, the issue happens reliably within 10-30 seconds of opening the app. I have not used the memory profiler yet, but then it is straightforward that the root cause is an out of memory exception and I was able to catch this with the Visual Studio debugger attached. – Joshua Dannemann Aug 05 '22 at 16:03
  • 2
    I'd still contact Microsoft about this because it sounds like a random webpage could crash _any_ Xbox app using the WebView which _at least_ presents a DoS attack vulnerability (...at best), so I'm sure they'd want to hear about this too. – Dai Aug 05 '22 at 16:22
  • I am in the process of reporting it to Microsoft through our channels, but I do need to find a fix or workaround for this problem ASAP if one exists. – Joshua Dannemann Aug 05 '22 at 18:07
  • I saw your edit where you said you're using `WebViewExecutionMode.SameThread` - (**why** are you using that option? I can tell right-away that's going to cause issues for no benefit). Also, what happens if you use `WebViewExecutionMode.SeparateProcess` instead? – Dai Aug 05 '22 at 19:45
  • This is a newly revamped app. Our previous was a .jsproj, and the hosted portion still has quite a bit of WinRT in JavaScript that requires the UI thread if the execution mode is not set to SameThread. I'll see what happens if I use SeparateThread. SeparateProcess was a can of worms last I tested that mode. – Joshua Dannemann Aug 05 '22 at 19:56
  • (When I was at Microsoft I used to work on the tooling for `.jsproj` and related... I honestly never thought I'd ever see anyone actually use WinJS+WinRT in production because... well... nevermind... but once _you've seen how the sausage is made_ in person it tends to make one go even more jaded...) - so this is quite the amazement for me, lol. – Dai Aug 05 '22 at 19:59
  • Lol! It was not my call, but I am in the process of abolishing it! – Joshua Dannemann Aug 05 '22 at 20:05
  • _"I am in the process of abolishing it!"_ - I sincerely wish you good luck and godspeed, in that endeavour, sir. – Dai Aug 05 '22 at 20:08
  • @Dai `WebViewExecutionMode.SeparateProcess` worked. You should post this as the answer so that I can give you credit. – Joshua Dannemann Aug 05 '22 at 20:46
  • 1
    Nevermind... hold off one second. Maybe not. – Joshua Dannemann Aug 05 '22 at 20:47
  • 1
    Ah, _snatching defeat from the jaws of victory..._ – Dai Aug 05 '22 at 20:59
  • Heya - I was just checking-in to see if there's been any developments? – Dai Aug 09 '22 at 00:09
  • None yet. I am in touch with Microsoft and awaiting a response. – Joshua Dannemann Aug 09 '22 at 18:00

0 Answers0