Search Unity

UWP - Managed debugging with IL2CPP issue

Discussion in 'Windows' started by MikeGDev, Nov 15, 2019.

  1. MikeGDev

    MikeGDev

    Joined:
    Dec 19, 2017
    Posts:
    53
    I have encountered an issue while trying to connect a managed debugger to a UWP IL2CPP build. The build is not visible when trying to connect through Debug -> Attach Unity Debugger.

    The setup is like this: https://docs.microsoft.com/en-us/windows/mixed-reality/managed-debugging-with-unity-il2cpp

    With the difference that the build is installed locally through Windows Device Portal.

    My Visual Studio version is Professional 2017 (15.9.17). Unity tools are installed and I can connect the debugger for other platforms just fine.

    Unity version is 2019.2.12f.

    Are there any steps or configuration I could have missed?
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Make sure the internet server and private networks capabilities are enabled in the app manifest.

    Is this debugging on local or remote machine?
     
  3. MikeGDev

    MikeGDev

    Joined:
    Dec 19, 2017
    Posts:
    53
    The capabilities are enabled.

    I am debugging on local machine. Does the configuration need to be set as remote when the build is installed through Windows Device Portal? If so then what configuration should I be using for the remote debugger?
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    No, you don't need to change remote debugger configuration at all.

    Which build (debug/release/master) do you have deployed via the device portal? Can you attach AppxManifest.xml that is located next to the executable that runs when you run the app? You can find the location of the executable through task manager.
     
  5. MikeGDev

    MikeGDev

    Joined:
    Dec 19, 2017
    Posts:
    53
    The build is a debug build. The AppxManifest.xml looks like this:

     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
  7. MikeGDev

    MikeGDev

    Joined:
    Dec 19, 2017
    Posts:
    53
    I tried granting the loopback limitations exemption, however it didn't work. I also did notice that when checking the package details through "CheckNetIsolation LoopbackExempt -s" it says "IsDevelopementMode : false". Can this be an indication of an issue? The build configuration is set to debug in VS and it is a development build in Unity.

    I tried both setting the debugger to local machine and remote but I couldn't connect to the build with either of them.
     
  8. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    Does the debugger work if you deploy it via Build & Run OR via Visual Studio?
     
  9. MikeGDev

    MikeGDev

    Joined:
    Dec 19, 2017
    Posts:
    53
    If I run the build through the generated Visual Studio project, it does attach its debugger, however the project is in C++ due to the IL2CPP backend. I cannot connect the C# project I use for scripting through the Attach Unity Debugger command.

    The Build And Run command generates the project, but it fails to automatically build it through Unity with the following error (I have to manually open and build it):

     
  10. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,674
    The build & run log is truncated :( I can't see the error.

    Anyway, this is so bizarre... it's almost as if something is blocking the debugger connection. Are you able to test debugging on a remote machine?

    Could you perhaps try enabling "inbound connection loopback exempt" using "CheckNetIsolation.exe LoopbackExempt -is -n=<PACKAGE_NAME>" (https://docs.microsoft.com/en-us/windows/iot-core/develop-your-app/loopback) and see if you can connect to the application via IP (127.0.0.1 if running on local machine) and port (that can be found in the player log)?

    Lastly... just to make sure this wasn't missed: do you have this checkbox checked when building from Unity?
    upload_2019-11-27_11-39-15.png
     
    MikeGDev likes this.
  11. MikeGDev

    MikeGDev

    Joined:
    Dec 19, 2017
    Posts:
    53
    Yes! enabling the "inbound connection loopback exempt" worked. While I have this running I can make a connection through the local IP. Thanks for your help! :)