UWP - Managed debugging with IL2CPP issue

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: Managed debugging with Unity - Mixed Reality | Microsoft Learn

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?

Make sure the internet server and private networks capabilities are enabled in the app manifest.

Is this debugging on local or remote machine?

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?

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.

The build is a debug build. The AppxManifest.xml looks like this:

I think I know what’s happening… For the debugger to be able to multicast to Visual Studio on local machine, the app must be granted loopback limitations exemption (see this: c# - UWP Enable local network loopback - Stack Overflow). When you run via Visual Studio OR Build & Run in Unity, it is done for you, but I guess device portal doesn’t do it.

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.

Does the debugger work if you deploy it via Build & Run OR via Visual Studio?

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):

The build & run log is truncated :frowning: 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>” (Communicating with Localhost - Windows IoT | Microsoft Learn) 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?

1 Like

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! :slight_smile: