Can't connect Profiler to Hololens

Hello,

I’m trying to connect the Profiler to an UWP Application running on a Hololens 2.

I followed all the steps outlined here: Unity - Manual: Connect the profiler to UWP
All required Capabilities are checked. My configuration is set to Release.

After adding firewall in- and outbound rules for both the editor as well as the port range used by the profiler I can now see and select the Hololens in the dropdown menu in the profiler window.
When doing that, I get these errors:

Since I can’t see any messages being sent from the editor in wireshark I assume the error has nothing to do with firewall settings.
I am using Unity 2019.4.5f1.

Thanks in advance!

Can you show a screenshot of the Build Settings window in unity?

Hi,
you’re probably referring to the Capabilities or is there another relevant option?

Well, I meant to look for Autoconnect Profiler in the Build Settings. For me, when it’s OFF, I can manually connect successfully. When it’s ON, I cannot connect! I know it stupid but this is how it worked for me. The rest looks good. Let me know whether it works for you or not.

Another question: are you building/running your HoloLens app directly from the Editor or running it from Visual Studio?

One “gotcha” with the UWP Capabilities in Unity: once you’re generated a VS project the UWP Capabilities are not updated in your project settings. That is, if you check new Capabilities in Unity and the build to an existing VS project, they won’t be applied in you project’s appxmanifest. Instead you need to manually set them in your appxmanifies or build a completely clean UWP project.

So basically, please confirm the “network” Capabilities are checked in the actual VS project.

Interesting!
When I made my build though I had Autoconnect Profiler turned off.
I only checked it afterwards so that I would not forget it for the next build as I thought maybe autoconnecting would help with my connection issues.
I will verify this though (always better to double check).

I will also reconfirm the capabilities - this might in fact be the case as I have been building to the same location and the same project for a while and remember that not all the internet-related capabilities were turned on for my first build.

Thank you both!

By the way since your on 2019 release, you can Build and Run your UWP app directly from Unity via Device Portal: Unity - Manual: Deploy a UWP app with the Windows Device Portal

Takes a little bit to setup, but should help out a lot for this type of workflow.

Did you make it work?

Sorry for the late reply.

I deleted my old build folder and made a new build (with “Autoconnect Profiler” turned off) and checked the manifest file for all internet related capabilities which were there.
I’m happy to say that I can now connect the Profiler by entering the Hololens IP address in the dropdown menu in the Profiler window!
Additionally this also seems to make Debug.Log messages appear in my Unity console window which is great!
I assume that it was indeed a problem of rebuilding into the same folder after changing capabilities.

However I also tried the build and run over Device Portal and couldn’t get it to work.
The Device Portal itself works as expected on the same PC but when trying to build and run to the same IP address with the same credentials I get a connection error.
However, I was unable to look up the IP address and port as described in the guide. The “For Developers” section of my settings shows no more entries after “Turn on remote diagnostics over local area network connections” (which is turned on). Because of this I used the local IP of my Hololens2 (the one I also enter in the browser for the device portal) and tried the port 50080 that was given in the example but that didn’t work. (I also tried not enteing any port)
I’m pretty sure this once again has nothing to do with firewall settings as I allow the UnityEditor.exe to communicate over all ports.

Another thing is: I’m very happy that connecting the profiler made Debug.Log messages appear as for me they never showed up in any Visual studio output window. I am also unable to Attach the Unity Debugger to the Application.

Should I open another thread for these issues?

Thanks again!

Hey,

Glad to hear you got things (mostly) working!

This is odd, according to the Microsoft documentation the option should be there. I don’t have an HL2 device and can only test using the HL2 Emulator, which also doesn’t provide the Device Portal option (but being an emulator that’s not unexpected).

I don’t know why the option isn’t available, but since Device Portal is disabled by default, it definitely won’t work until you manually enable it. For this issue I recommend you join HoloDevelopers Slack channel and post this problem there. In general, I’d recommend using this Slack channel for HL2 or other Microsoft specific questions/issue.

So, just to make sure:

  • Enabled both InternetClientServer and PrivateNetworkClientServer Capabilities

  • Configure the Unity UWP build settings:

  • Development Build

  • Script Debugging

  • Wait for Managed Debugger (optional)

The other thing to check: multicast is enabled on your network. See this forum thread for details. Although, if the Profiler is working then Multicast should be enabled. If everything is setup correctly but you still can’t attach the Unity debugger, then go ahead and start a new thread.

1 Like

Thanks!
I’ve asked about the Device Portal thing in the Slack channel and opened a new thread for the Debugger issue.

Sorry for posting in such an old thread but wanted to chime in. For the Device Portal Address the format should be https://192.168.1.1/ instead of 192.168.1.1. Of course replace 192.168.1.1 with whatever your Hololens IP is.