Search Unity

Debugging UWP crash on certain PCs

Discussion in 'Windows' started by tonemcbride, Jun 24, 2017.

  1. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    Hi,

    We've released a UWP game which works well on the majority of PC's but we've had some bad reviews because it crashes on certain devices. Unfortunately it seems to crash before any logs can be output - the window just opens briefly and then closes. If no logs are being created does that indicate that it would be a Unity issue rather than a scripting one? Does anyone have any ideas on the best way to track that down?

    Thanks!

    p.s. The app was built with 5.6.1p1 but the crashes were also occurring on older builds like 5.4 etc..
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Is the Windows Store giving you any crash data like stack traces?
     
  3. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    There are a few stack traces but they don't seem very helpful - I've put them below for you (have replaced our app name with AppName). Is there a way I can do a different type of build that will be easier to find crash issues in?

    Crash 1
    0 unityplayer _lambda_70c2c01b1524f9d8f1500c494cb652c4_::eek:perator 0x8D


    Crash 2
    SharedLibrary $8_System::Runtime::InteropServices::McgModuleManager.GetInterface 0x109
    1 AppName RHBinder__ShimExeMain 0x10134A
    2 AppName RHBinder__ShimExeMain 0x1012FD
    3 AppName RHBinder__ShimExeMain 0x101210
    4 AppName RHBinder__ShimExeMain 0x1011D8
    5 AppName RHBinder__ShimExeMain 0x6F26E
    6 AppName RHBinder__ShimExeMain 0x174F39


    Crash 3
    SharedLibrary $8_System::Runtime::InteropServices::McgModuleManager.GetInterface 0xED
    1 AppName
    0x8AD6CD
    2 AppName
    0x8AD6A2
    3 AppName
    0x8AD5E5
    4 AppName
    0x8AD5B4
    5 AppName
    0x86F69C
    6 AppName
    0x8FC07D


    Thanks
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Yeah that is not much information to work with at all.

    Is that what your users said, or is that what you witnessed yourself?
     
  5. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    It's what the users reported but our publisher has also managed to replicate it happening on one of their laptops. Unfortunately we aren't able to debug on that laptop so I was relying on the log file but it never gets written for them. I'll try doing a build with the latest patch version and see if that makes any difference.
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    I don't think updating unity blindly will fix it, as this is not one of the issues we've heard about. Are you in contact with the person who is able to replicate this on his laptop? The best course of action would be to capture a crash dump:

    https://msdn.microsoft.com/en-us/library/windows/desktop/bb787181(v=vs.85).aspx

    Adding this registry key will make the system create dumps for every process that crashes on the system. Make sure the dump type is set to "full" (value of 2). The dump can then be sent over to a dev machine and inspected in Visual Studio.
     
  7. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    Thanks for the info, I've asked the publisher to do that and they've now sent me a crash dump file (around 110mb).

    Loading it into VS gives me this info:

    Code (CSharp):
    1.  
    2. Dump Summary
    3. ------------
    4. Dump File:    MyAppName.exe.5988.dmp : C:\Users\Me\Desktop\MyAppName.exe.5988.dmp
    5. Last Write Time:    29/06/2017 15:11:34
    6. Process Name:    MyAppName.exe : C:\Program Files\WindowsApps\StudioName.MyAppName_1.1.27.0_x86__2bbdy7rfnx6tr\MyAppName.exe
    7. Process Architecture:    x86
    8. Exception Code:    0xC000027B
    9. Exception Information:
    10. Heap Information:    Present
    11.  
    12. System Information
    13. ------------------
    14. OS Version:    10.0.10586
    15. CLR Version(s):
    16.  
    17. Modules
    18. -------
    19. Module Name    Module Path    Module Version
    20. -----------    -----------    --------------
    21. MyAppName.exe    C:\Program Files\WindowsApps\StudioName.MyAppName_1.1.27.0_x86__2bbdy7rfnx6tr\MyAppName.exe    0.0.0.0
    22. ntdll.dll    C:\Windows\System32\ntdll.dll    10.0.10586.672
    23. kernel32.dll    C:\Windows\System32\kernel32.dll    10.0.10586.589
    24. KERNELBASE.dll    C:\Windows\System32\KERNELBASE.dll    10.0.10586.916
    25. MyAppName.dll    C:\Program Files\WindowsApps\StudioName.MyAppName_1.1.27.0_x86__2bbdy7rfnx6tr\MyAppName.dll    0.0.0.0
    26. combase.dll    C:\Windows\System32\combase.dll    10.0.10586.916
    27. SharedLibrary.dll    C:\Program Files\WindowsApps\Microsoft.NET.Native.Framework.1.3_1.3.24201.0_x86__8wekyb3d8bbwe\SharedLibrary.dll    1.4.24201.0
    28. msvcrt.dll    C:\Windows\System32\msvcrt.dll    7.0.10586.0
    29. rpcrt4.dll    C:\Windows\System32\rpcrt4.dll    10.0.10586.306
    30. sspicli.dll    C:\Windows\System32\sspicli.dll    10.0.10586.589
    31. CRYPTBASE.dll    C:\Windows\System32\CRYPTBASE.dll    10.0.10586.0
    32. bcryptPrimitives.dll    C:\Windows\System32\bcryptPrimitives.dll    10.0.10586.589
    33. mrt100_app.dll    C:\Program Files\WindowsApps\Microsoft.NET.Native.Runtime.1.4_1.4.24201.0_x86__8wekyb3d8bbwe\mrt100_app.dll    1.4.24201.0
    34. sechost.dll    C:\Windows\System32\sechost.dll    10.0.10586.0
    35. UnityEngineDelegates.dll    C:\Program Files\WindowsApps\StudioName.MyAppName_1.1.27.0_x86__2bbdy7rfnx6tr\UnityEngineDelegates.dll    0.0.0.0
    36. oleaut32.dll    C:\Windows\System32\oleaut32.dll    10.0.10586.916
    37. clrcompression.dll    C:\Program Files\WindowsApps\StudioName.MyAppName_1.1.27.0_x86__2bbdy7rfnx6tr\clrcompression.dll    1.0.23123.0
    38. WinTypes.dll    C:\Windows\System32\WinTypes.dll    10.0.10586.103
    39. vcruntime140_app.DLL    C:\Program Files\WindowsApps\Microsoft.VCLibs.140.00_14.0.24123.0_x86__8wekyb3d8bbwe\vcruntime140_app.DLL    14.0.24123.0
    40. ucrtbase.dll    C:\Windows\System32\ucrtbase.dll    10.0.10586.839
    41. vccorlib140_app.DLL    C:\Program Files\WindowsApps\Microsoft.VCLibs.140.00_14.0.24123.0_x86__8wekyb3d8bbwe\vccorlib140_app.DLL    14.0.24123.0
    42. MSVCP140_APP.dll    C:\Program Files\WindowsApps\Microsoft.VCLibs.140.00_14.0.24123.0_x86__8wekyb3d8bbwe\MSVCP140_APP.dll    14.0.24123.0
    43. mrt100.dll    C:\Windows\System32\mrt100.dll    1.0.22929.0
    44. kernel.appcore.dll    C:\Windows\System32\kernel.appcore.dll    10.0.10586.0
    45. user32.dll    C:\Windows\System32\user32.dll    10.0.10586.713
    46. gdi32.dll    C:\Windows\System32\gdi32.dll    10.0.10586.962
    47. imm32.dll    C:\Windows\System32\imm32.dll    10.0.10586.0
    48. twinapi.appcore.dll    C:\Windows\System32\twinapi.appcore.dll    10.0.10586.839
    49. bcrypt.dll    C:\Windows\System32\bcrypt.dll    10.0.10586.713
    50. Windows.UI.Xaml.dll    C:\Windows\System32\Windows.UI.Xaml.dll    10.0.10586.916
    51. CoreMessaging.dll    C:\Windows\System32\CoreMessaging.dll    10.0.10586.962
    52. Bcp47Langs.dll    C:\Windows\System32\Bcp47Langs.dll    10.0.10586.589
    53. iertutil.dll    C:\Windows\System32\iertutil.dll    11.0.10586.916
    54. SHCore.dll    C:\Windows\System32\SHCore.dll    10.0.10586.839
    55. windows.storage.dll    C:\Windows\System32\windows.storage.dll    10.0.10586.916
    56. cfgmgr32.dll    C:\Windows\System32\cfgmgr32.dll    10.0.10586.0
    57. advapi32.dll    C:\Windows\System32\advapi32.dll    10.0.10586.63
    58. shlwapi.dll    C:\Windows\System32\shlwapi.dll    10.0.10586.0
    59. powrprof.dll    C:\Windows\System32\powrprof.dll    10.0.10586.0
    60. profapi.dll    C:\Windows\System32\profapi.dll    10.0.10586.0
    61. actxprxy.dll    C:\Windows\System32\actxprxy.dll    10.0.10586.306
    62. CoreUIComponents.dll    C:\Windows\System32\CoreUIComponents.dll    0.0.0.0
    63. uxtheme.dll    C:\Windows\System32\uxtheme.dll    10.0.10586.0
    64. tiptsf.dll    C:\Program Files (x86)\Common Files\Microsoft Shared\Ink\tiptsf.dll    10.0.10586.589
    65. dwmapi.dll    C:\Windows\System32\dwmapi.dll    10.0.10586.0
    66. dxgi.dll    C:\Windows\System32\dxgi.dll    10.0.10586.494
    67. d3d11.dll    C:\Windows\System32\d3d11.dll    10.0.10586.839
    68. igd10iumd32.dll    C:\Windows\System32\igd10iumd32.dll    10.18.10.4358
    69. ncrypt.dll    C:\Windows\System32\ncrypt.dll    10.0.10586.0
    70. ntasn1.dll    C:\Windows\System32\ntasn1.dll    10.0.10586.0
    71. ole32.dll    C:\Windows\System32\ole32.dll    10.0.10586.916
    72. igdusc32.dll    C:\Windows\System32\igdusc32.dll    10.18.10.4358
    73. d2d1.dll    C:\Windows\System32\d2d1.dll    10.0.10586.672
    74. dcomp.dll    C:\Windows\System32\dcomp.dll    10.0.10586.494
    75.  

    Running it gives a crash here:

    Code (CSharp):
    1. Unhandled exception at 0x775B3D1E (combase.dll) in MyAppName.exe.5988.dmp: 0xC000027B: An application-internal exception has occurred (parameters: 0x01328498, 0x00000002).
    This is happening on the SHCore.dll thread and the call stack is:

    Code (CSharp):
    1.  
    2.      combase.dll!RoFailFastWithErrorContextInternal2(HRESULT hrError, unsigned long cStowedExceptions, _STOWED_EXCEPTION_INFORMATION_V2 * * aStowedExceptionPointers) Line 1034   C++
    3.      combase.dll!RoFailFastWithErrorContextInternal(HRESULT hrError, unsigned long cStowedExceptions, _STOWED_EXCEPTION_INFORMATION_V1 * * aStowedExceptionPointers) Line 947   C++
    4.      Windows.UI.Xaml.dll!DirectUI::FrameworkView::Initialize(Windows::ApplicationModel::Core::ICoreApplicationView * pCoreApplicationView) Line 74   C++
    5.      twinapi.appcore.dll!Windows::ApplicationModel::Core::CoreApplicationView::CreateAndInitializeFrameworkView(class Microsoft::WRL::ComPtr<struct Windows::ApplicationModel::Core::IFrameworkViewSource> &)   Unknown
    6.      twinapi.appcore.dll!Windows::Internal::GitPtrImpl<class Windows::Internal::GitPtr>::Register<struct Windows::ApplicationModel::Core::ICoreApplicationView>(struct Windows::ApplicationModel::Core::ICoreApplicationView *)   Unknown
    7.      SHCore.dll!CallerIdentity::GetCallingProcessHandle(unsigned long,enum RUNTIMEBROKER_CALLERIDENTITY_CHECK,void * *)   Unknown
    8. >   kernel32.dll!@BaseThreadInitThunk@12()   Unknown
    9.      ntdll.dll!77915de3()   Unknown
    10.      [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]  
    11.      [External Code]  
    12.  
    13.  
    14.  
    Here's the disassembly with the crash instruction marked - not sure how useful that would be for you though:

    Code (CSharp):
    1. 775B3B60  js          775B3BAB
    2. 775B3B62  push        50h
    3. 775B3B64  xor         ebx,ebx
    4. 775B3B66  lea         eax,[esp+44h]
    5. 775B3B6A  push        ebx
    6. 775B3B6B  push        eax
    7. 775B3B6C  call        77535DA2
    8. 775B3B71  mov         eax,dword ptr [ebp+4]
    9. 775B3B74  add         esp,0Ch
    10. 775B3B77  mov         dword ptr [esp+4Ch],eax
    11. 775B3B7B  mov         dword ptr [esp+40h],0C000027Bh
    12. 775B3B83  mov         dword ptr [esp+44h],1
    13. 775B3B8B  push        2
    14. 775B3B8D  pop         eax
    15. 775B3B8E  push        eax
    16. 775B3B8F  mov         dword ptr [esp+54h],eax
    17. 775B3B93  lea         eax,[esp+44h]
    18. 775B3B97  push        ebx
    19. 775B3B98  push        eax
    20. 775B3B99  mov         dword ptr [esp+54h],ebx
    21. 775B3B9D  mov         dword ptr [esp+60h],esi
    22. 775B3BA1  mov         dword ptr [esp+64h],edi
    23. 775B3BA5  call        dword ptr ds:[775D81ECh]
    24. CRASHES HERE ALTHOUGH LIKELY TO BE THE CALL ABOVE---->775B3BAB  push        3
    25. 775B3BAD  push        0
    26. 775B3BAF  push        0
    27. 775B3BB1  call        dword ptr ds:[775D81ECh]
    28. 775B3BB7  mov         ecx,dword ptr [esp+94h]
    29. 775B3BBE  pop         edi
    30. 775B3BBF  pop         esi
    31. 775B3BC0  pop         ebx
    32. 775B3BC1  xor         ecx,esp
    33. 775B3BC3  call        77533D00
    34. 775B3BC8  mov         esp,ebp
    35. 775B3BCA  pop         ebp
    36. 775B3BCB  ret         0Ch
    37.  
     
    Last edited: Jun 29, 2017
  8. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    It looks like I've finally found the issue. Because our app is also on XBox we were told by Microsoft to add 2 lines of code to App.xaml.cs - these seem to work fine on most PC's but obviously there's a problem on certain ones.

    The lines are:

    // Hide mouse pointer on xbox
    this.RequiresPointerMode = Windows.UI.Xaml.ApplicationRequiresPointerMode.WhenRequested;
    (In App() constructor after this.InitializeComponent())


    // Make fullscreen - don't have borders on xbox ApplicationView.GetForCurrentView().SetDesiredBoundsMode(Windows.UI.ViewManagement.ApplicationViewBoundsMode.UseCoreWindow);
    (In InitialiseUnity() function)
     
  9. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Can you send me that crash dump via PM? I'd like to look at it.
     
  10. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Thanks for the dump, it helped. You were right, RequiresPointerMode is causing the crash. Here's the original callstack:

    Code (csharp):
    1. Unable to cast object of type '__APP_NAME__.App' to type 'Windows.UI.Xaml.IApplication2'.
    2.    at System.StubHelpers.StubHelpers.GetCOMIPFromRCW_WinRT(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget)
    3.    at Windows.UI.Xaml.Application.put_RequiresPointerMode(ApplicationRequiresPointerMode value)
    4.    at __APP_NAME__.App..ctor()
    5.    at __APP_NAME__.Program.<>c.<Main>b__0_0(ApplicationInitializationCallbackParams p)
    This is happening because the application was run on Windows 10 build 10586, while RequiresPointerMode property was added in Windows 10 build 14393. You need to wrap this in a try/catch statement.
     
  11. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    That's great - out of interest how did you get that info from the dump file? I loaded it into Visual Studio but never got that level of detail.

    I'll put a try/catch around both my xbox changes so hopefully that'll fix it. Thanks for looking into it for me, I realise it ended up not being a Unity specific issue so I appreciate you looking at it anyway.
     
  12. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    In the locals window you can see "Stowed exception" object, which contains inner InvalidCastException.
     
  13. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,089
    Thanks, that's handy to know - I haven't worked with dump files much so that'll come in handy with any future issues.