Search Unity

Exception thrown System.TypeInitializationException at WinRTBridge on Windows phone device.

Discussion in 'Windows' started by natekem, Apr 14, 2017.

  1. natekem

    natekem

    Joined:
    Mar 17, 2017
    Posts:
    4
    Hi

    I'm recently upgrading to Unity 5.3.8f1 and recently I got the issue of the app crash during the startup on Windows phone device.
    -------
    Code
    -------
    _bridge = new WinRTBridge.WinRTBridge();
    appCallbacks.SetBridge(_bridge); <----- Exception at this.

    Here is the error log I got from Visual Studio:
    'FVCE.exe' (CoreCLR: DefaultDomain): Loaded 'C:\windows\system32\mscorlib.ni.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\D52A8D61.BarnStormerVS.Debug_ARM.nahirsch\FVCE.exe'. Symbols loaded.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\windows\system32\SYSTEM.RUNTIME.NI.DLL'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\windows\system32\WinMetadata\Windows.winmd'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\D52A8D61.BarnStormerVS.Debug_ARM.nahirsch\UnityPlayer.winmd'. Module was built without symbols.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\windows\system32\SYSTEM.RUNTIME.INTEROPSERVICES.WINDOWSRUNTIME.NI.DLL'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\windows\system32\System.Runtime.WindowsRuntime.NI.DLL'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\D52A8D61.BarnStormerVS.Debug_ARM.nahirsch\WinRTBridge.winmd'. Cannot find or open the PDB file.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\D52A8D61.BarnStormerVS.Debug_ARM.nahirsch\BridgeInterface.winmd'. Module was built without symbols.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\data\ProgramData\Microsoft\Windows\AppRepository\Packages\D52A8D61.BarnStormer_0.9.1000.0_arm__jwbwg6xx0377a\NI\Assembly-CSharp-firstpass.ni.DLL'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\windows\system32\SYSTEM.NI.DLL'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\D52A8D61.BarnStormerVS.Debug_ARM.nahirsch\MarkerMetro.Unity.WinIntegration.DLL'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\windows\system32\SYSTEM.COLLECTIONS.NI.DLL'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\windows\system32\SYSTEM.THREADING.TASKS.NI.DLL'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\windows\system32\SYSTEM.RUNTIME.EXTENSIONS.NI.DLL'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\windows\system32\en-US\mscorlib.debug.resources.dll'. Module was built without symbols.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\D52A8D61.BarnStormerVS.Debug_ARM.nahirsch\UnityEngine.DLL'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\D52A8D61.BarnStormerVS.Debug_ARM.nahirsch\Assembly-CSharp.DLL'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\windows\system32\SYSTEM.IO.NI.DLL'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\windows\system32\SYSTEM.TEXT.ENCODING.NI.DLL'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\Data\SharedData\PhoneTools\AppxLayouts\D52A8D61.BarnStormerVS.Debug_ARM.nahirsch\protobuf-net.DLL'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    'FVCE.exe' (CoreCLR: .): Loaded 'C:\windows\system32\SYSTEM.OBJECTMODEL.NI.DLL'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
    Exception thrown: 'System.TypeInitializationException' in FVCE.exe

    I found the (sort-of) similar thread https://forum.unity3d.com/threads/s...ion-at-appcallbacks-setbridge-_bridge.376591/. However it doesn't actually pinpoint the exact cause and it looked like the issue was resolved with 5.3.5p2, but I'm already on 5.3.8f1. Isn't the fix being ported over?
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    That doesn't look like a crash. What happens when you just hit continue in the break popup dialog?
     
  3. natekem

    natekem

    Joined:
    Mar 17, 2017
    Posts:
    4
    If I hit continue in the breakpoint then I'd get the break popup dialog in Visual Studio and the game will crash.

    In short, after I've debugged a little bit more, it turns out there are InnerExceptions related to 'cannot reduce access' under System.InitializationException and it is related to abstract method defined as 'protected'.

    I'm still perplexed why it becomes the issue in Unity 5.3.8f1. The previous version of Unity I used 5.3.1p3 has no issue with it.

    I've also filed the ticket with Unity.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Is the method it is complaining about located in a nested class by any chance?