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:
- The crash affects Xbox Series X consoles
- Does not affect Xbox One consoles
- I am uncertain if Xbox Series S consoles are affected
- All consoles affected have an early manufacturing date (circa 2019)
- 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:
- Run the memory diagnostic tool in Visual Studio
- Change the execution mode of the WebView
Results:
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.
Execution mode =
WebViewExecutionMode.SeparateThread
- Behaves just how it does as if it were on the same thread.
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.