Search Unity

UWP Game Crashes upon Loading a New Scene. in Master Configuration.

Discussion in 'Windows' started by Onotseike, Apr 30, 2016.

  1. Onotseike

    Onotseike

    Joined:
    May 26, 2015
    Posts:
    23
    Hi All,
    I have an issue. Every time I build for Master Configuration ad run my game, It crashes once i try to load a new scene after launching the game. the build file errors are attached and also a screenshot of my Visual Studio Editor is shown below.
     

    Attached Files:

  2. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    Can you try enabling .NET Native in Debug configuration, code optimization too. See if it crashes there as well. Debug should give more information.
     
  3. Onotseike

    Onotseike

    Joined:
    May 26, 2015
    Posts:
    23
    Hi Aurimas,
    I did as you suggested and this is the result
     

    Attached Files:

  4. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    How does it crash? Can you obtain a stack trace from the moment it happens?
     
  5. Onotseike

    Onotseike

    Joined:
    May 26, 2015
    Posts:
    23
    Hi Aurimas,
    Once I get the game going in debug or master's configuration mode, with the .NET Native and code optimization checked, it works and I begin to see numerous " Skipped loading symbols. Module is native, and native debugging is currently disabled." prior to the Splash Screen of Unity showing. The first scene gets loaded, I click a button to Load the next level. It begins the loading process then crashes. The Screenshot attached shows the error.
     

    Attached Files:

  6. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    In Visual Studio you have the output tab open at the bottom (your screenshot). There is "Call Stack" tab in that same pane, can you provide the contents of it?
     
  7. Onotseike

    Onotseike

    Joined:
    May 26, 2015
    Posts:
    23
    Hi Aurimas,
    The Details of the Call Stack are as follow:
    Code (CSharp):
    1. >    System.Private.CoreLib.dll!System.RuntimeExceptionHelpers.FailFast(string message, System.Exception exception, System.RuntimeExceptionHelpers.RhFailFastReason reason, System.IntPtr pExContext) Line 206    C#
    2.      System.Private.CoreLib.dll!System.RuntimeExceptionHelpers.RuntimeFailFast(System.RuntimeExceptionHelpers.RhFailFastReason reason, System.Exception exception, System.IntPtr pExContext) Line 173    C#
    3.      [Native to Managed Transition]  
    4.      [Managed to Native Transition]  
    5.      ColorEscape.McgInterop.dll!McgInterop.UnityEngineDelegates_dll.TerrainData_CUSTOM_GetAlphamaps(System.IntPtr param_0, int param_1, int param_2, int param_3, int param_4) Line 68318    C#
    6.      UnityEngineProxy.dll!UnityEngineProxy.InternalCalls.TerrainData_CUSTOM_GetAlphamaps(object self, int x, int y, int width, int height) Line 36731    C#
    7.      Assembly-CSharp.dll!Footsteps.SurfaceManager.GetTerrainTextureMix(UnityEngine.Vector3 worldPos, UnityEngine.TerrainData terrainData, UnityEngine.Vector3 terrainPos)    Unknown
    8.      Assembly-CSharp.dll!Footsteps.SurfaceManager.GetSurfaceIndex(UnityEngine.Collider col, UnityEngine.Vector3 worldPos)    Unknown
    9.      Assembly-CSharp.dll!Footsteps.SurfaceManager.GetFootstep(UnityEngine.Collider groundCollider, UnityEngine.Vector3 worldPosition)    Unknown
    10.      Assembly-CSharp.dll!Footsteps.CharacterFootsteps.PlayLandSound()    Unknown
    11.      Assembly-CSharp.dll!Footsteps.CharacterFootsteps.CheckGround()    Unknown
    12.      Assembly-CSharp.dll!Footsteps.CharacterFootsteps.Update()    Unknown
    13.      Assembly-CSharp.dll!Footsteps.CharacterFootsteps.$Invoke12Update(long instance, long* args)    Unknown
    14.      UnityEngine.dll!UnityEngine.Internal.$MethodUtility.InvokeMethod(long instance, long* args, System.IntPtr method)    Unknown
    15.      WinRTBridge.dll!WinRTBridge.MethodTools.CreateInstanceAndInvokeDefaultConstructorDelegate.InvokeOpenStaticThunk(System.IntPtr managedHandle, System.UIntPtr argument, long* exception)    C#
    16.      ColorEscape.McgInterop.dll!WinRTBridge.MethodTools_InvokeMethodDelegate__WinRTBridge__Impl.ReverseDelegateStub(long unsafe_instance, long* unsafe_args, System.IntPtr unsafe_methodPtr) Line 76919    C#
    17.      [Native to Managed Transition]  
    18.  
     

    Attached Files:

  8. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    I am sorry to say, but this is a known bug, but sadly it's on Microsoft side. The game will probably runs fine if you disable .NET compilation in VS project settings. If this is really true... You need to wait until MS fixes this, hopefully with VS 2015 Update 3. At the current day, there's no known workarounds for this bug.
     
  9. Onotseike

    Onotseike

    Joined:
    May 26, 2015
    Posts:
    23
    Hi Tomas1856,
    this is a real bummer. Is it possible to build the game as an exe file and convert it using Microsoft Project Centennial??
     
  10. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    No idea actually, you can try. Alternatively, you could try using il2cpp if your target is UWP.
     
  11. Onotseike

    Onotseike

    Joined:
    May 26, 2015
    Posts:
    23
    Thanks I will try the il2cpp. any pointers for that??
     
  12. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
  13. TheRykrsmith

    TheRykrsmith

    Joined:
    Dec 5, 2013
    Posts:
    1
    I encountered a similar error over the past week. I thought it was being caused when the Scene Manager loaded a new level. This turned out to be and not be the case.

    After the SceneManager loads the new level, but before it displays the new level it Destroys all the game objects in the scene it is leaving. However it appears the .Net Native does not properly Destroy the Gameobjects.

    In my case I had 2 Tweens on 2 Buttons under the Canvas. I removed the scenemanager and performed a destroy on the Canvas object and the same error occurred.

    So my first attempt was to Manually destroy each object in the canvas/Panel. This caused the error to go away. Even after I re-added the Scenemanager.

    Upon further inspection I saw the Tween and manually killed the tween prior to the Scenemanager load. I then removed all of the manual destroy calls, but kept the Tween Kill calls prior to the scene manager load and I did not encounter the error.

    A side note I have had tweens that were effecting the scale of the objects that did not cause the problem.

    The error for me appears to happen when I was effecting the "fade"/Transparency of the object.

    **UPDATE** The errors root cause appears to have came from creating the Tween(Component) in the START() function of a script. When I placed the same Component on the game Object in the Unity Editor the .Net Native was able to properly Destroy them, however if it was created/added in the script .Net native was not able to handle it **ENDUPDATE**

    So to recap. To help debug this issue Comment out the SceneManager, Then you need to go each item and manually destroy each game object to find out which object is causing the issue. Once you find it beak the object down to fine out which sub gameobject is causing the issue. if you can find the specific object you can usually manually destroy the object to "work around" the issue.

    Hope this helps for anyone who encounters this issue.
     
    Last edited: May 31, 2016
    Onotseike likes this.
  14. sevensails

    sevensails

    Joined:
    Aug 22, 2013
    Posts:
    483
    Yes... I have the exact same problem, and it happens because of DOTween.

    It seems DOTween uses some kind of Try Except to Kill Active Tweens when the Current Scene Change, but this seems to be ignored when using .NET Master Configuration.

    To solve this problem, You can do everything you said, or to make it more easy, just ADD an OnDisabled event to any GameObject on Scene with DOTween.KillAll(true).
     
  15. Onotseike

    Onotseike

    Joined:
    May 26, 2015
    Posts:
    23
    Hi Tomas,
    I was checking through the release notes for VS2015 Update 3 and I did not see anything relating to the issue. Do you know if they have addressed the issue.
     
  16. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    I'm affraid Microsoft considers this "by design". We're trying to get the idea, how widespread the issue is, because the fix on Unity side is non-trivial and would probably affect performance a bit.
     
  17. Onotseike

    Onotseike

    Joined:
    May 26, 2015
    Posts:
    23
    So, does that mean Unity will carry out the fix and warn developers on it. Or has Unity already carried out the fix??
     
  18. Aurimas-Cernius

    Aurimas-Cernius

    Unity Technologies

    Joined:
    Jul 31, 2013
    Posts:
    3,736
    The issue occurs when you have managed code calling into native code calling back to managed code and the latter throwing exception out through native land. Currently we are investigating how widespread the issue is and how hard to avoid. So far we only got a couple of complaints about it and it tends to be possible avoid this crash by preventing exceptions from being thrown (they often are indication that something is not entirely correct with your project).

    Simply put, we will only fix this bug if it's obvious we have to, because like I said, it's not easy and will probably have negative affect on general scripting performance.
     
  19. AncientLotus

    AncientLotus

    Joined:
    Feb 20, 2015
    Posts:
    13
    We are hitting this as well. It seems to have started happening only recently for our project.
    Is there a known workaround for this?
     
  20. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Got the callstack?
     
  21. AncientLotus

    AncientLotus

    Joined:
    Feb 20, 2015
    Posts:
    13
    Sure.
     

    Attached Files:

  22. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Do you have source code for dottween.dll? It's calling .alpha property on a null CanvasGroup. The workaround would be to check if it's not null before calling it.
     
  23. AncientLotus

    AncientLotus

    Joined:
    Feb 20, 2015
    Posts:
    13
    No, we don't have the source code for this DLL.
    It also doesn't sound reasonable that we can avoid all exceptions entirely, something is always bound to fail. We always need to be able to catch the exceptions to get useful telemetry and crash reports that help us fix the problems.

    Why has this only started happening recently? Is it due to the latest Unity build in particular?
     
  24. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    It is always been a problem since introduction of .NET native (that means UWP apps). It does not allow throwing exceptions from native code for managed code to catch. So while normal exceptions are okay and they work, as soon as the engine needs to throw from native side, it will produce a crash when .NET Native is enabled.
     
  25. Maisey

    Maisey

    Joined:
    Feb 17, 2014
    Posts:
    302
    Actually the source is available on GitHub (by the creator), see: https://github.com/Demigiant/dotween.

    I'm actually using the source to try to build using .NET Native, but with no luck so far. The errors are..."hard-interpreted". Hopefully someone can get this to work?
     
  26. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    165
    I just ran into this, is there a fix or workaround?
     
  27. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Yeah we fixed it. What version are you on?
     
  28. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    165
    Oh thank god, I am currently on 2017.2.1 what version should I upgrade too?
     
  29. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    I don't think you are facing the same issue then. It has been fixed in Unity 5.5 back in October, 2016. Please create a new thread so we could discuss your issue there.
     
  30. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    165
    Oh that is too bad, my issue behaves the same, it works in Debug mode but in Master one of my scenes crashes on load. There are no errors in the Editor or in Debug mode. Having a hard time identifying the problem :(
     
  31. Ogien

    Ogien

    Joined:
    Nov 21, 2012
    Posts:
    165
    I was able to get my game to work by updating Unity to 2017.3 and then choosing il2cpp instead of .NET. That solved the issue, not sure if it was the newest version of or the il2cpp but it works either way.
     
  32. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    IL2CPP doesn't suffer from .NET issues, since it's a totally different runtime.