Can't Attach Visual Studio to iOS device

Hello everyone,
I’ve got a problem with iOS managed debugging in VS Community for Mac.
I’m using Unity 2018.2.6f1 and Visual Studio Community for Mac 7.4.3 (build 10).
I’ve checked all the settings for building my app and debugging, i can build without any problems and on startup the application on the iPhone shows a pop up saying: “Debug - You can attach a managed debugger now if you want”.
3861706--327208--Schermata 2018-11-06 alle 14.35.34.png
But on the VS side, I can’t select anything except “Unity Editor” as debug target.
I could not find a way to attach another target.
Does someone have any tips?
Thank you.

Try to use the Run > Attach to Process menu, and make sure the “Debugger:” option at the bottom of the dialog is set to “Unity Debugger”.

Also, if the iOS device is a phone, make sure the Wifi connection is the only active connection. You can do this by putting the phone in airplane mode, then enabling Wifi.

Wow, thanks!
You’re a life saver, i didn’t know that setting was there.
I would have never got it without your help.
Thanks alot!

I’m glad to help. In the past, we’ve not had great documentation for managed code debugging, but we’ve just added some which might be helpful in the future:

I could attach the debugger, but it doesn’t break on breakpoints.
macOS, Unity 2019.2.18
iOS 12, iPhone 5

Are you trying to break in script code from the Unity project (e.g. in Assembly-CSharp.dll)? Or are you trying to break in code in a pre-compiled assembly in the project?

A Unity script. Not a pre-compiled assembly.

Ok, thanks for the information. Can you submit this project with a bug report? It sounds like something we should investigate then.

@JoshPeterson As a quick aside, for us connecting VSCode to the editor or to an iOS device has been a no go for years - the debuggers don’t connect, or they connect and disconnect immediately, or they beachball, or if they do magically connect they either don’t break, or if they break they don’t step in or step out correctly. I’ve filed bugs in the past but nothing seems to come of it. Prior to that, old MonoDevelop connecting to old Unity was an instant beachball on Mac as well, so Debug.Log has been my trusty friend for about 10 years.

I haven’t checked the latest Unity so I’d be pleasantly surprised if it’s working, but the last time I checked an iOS debug connection to an IL2CPP project it instantly failed (yes, the phone cellular was turned off, etc). In addition, the VSCode v1.1.4 verified package is currently broken on Mac (bug reported). I don’t know how your devs using Macs don’t hit the same problems everyone else seems to hit. I think the VSCode stuff is technically unsupported by Unity so fair enough it might break a bit, but as a verified package it breaks in a fresh project.

I can’t speak to VSCode, as I’ve not used it myself, and I don’t believe it is officially supported by Unity. With 2018.4, 2019.2, 2019.3, and 2020.1 Unity versions though, iOS debugging with VS for Mac and JetBrains Rider work internally (modulo bugs).

hi Josh, yep that’s right, the VSCode debugger extension says it’s unsupported in the extension description / docs which is a shame because VSCode as a C# and general purpose editor is great. I’ve not used Rider but always heard good things (tested their pre-release version for a few weeks but not tried it since). I’ll reinstall Visual Studio Code for Mac and test an iOS connection/debug in 2019.2 sometime.

No doubt it’s hard trying to keep all these tools working and improving as the .Net flavours and IL2CPP change under the hood. Thanks for your hard work and for being active in the forums too. Looking forward to seeing if and when all the new C#/.Net stuff makes it over the Unity fence.

I am attempting to debug a Unity (2018.4) project running on an up-to-date iPad from the latest Mac Visual Studio. I am able to see, from the Mac, the iPad open port that the Xcode debugger reports (Multi-casting "[IP] 192.168.1.9 [Port] 55000 …snip…) but when I start debugging and try to attach to the process I see only Unity Editor in the attachment options in VS.

My build settings are:
5503030--564364--upload_2020-2-20_14-50-22.png

The profiler pops up but nothing ever appears in it even when I turn off script debugging.

Any ideas on how to get beyond these blocker would be greatly appreciated.

I am able to attach to an Android device running the same Unity source, though.

@JackGrayBrain
You have to check ‘Symlink Unity Libraries’. Please check my blog post.

2 Likes

Exact same issue, it’s says "This request is not supported by the protocol version implemented by the debuggee” when the break point hits… when is this going to be fixed?

Which IDE are you using to attached to the Unity player?

Like JackGrayBrain I’m not seeing my IPad in the Mac Visual Studio dropdown:

5883116--626732--Screen Shot 2020-05-21 at 5.08.04 PM.png

My Unity build settings:

5883116--626735--Screen Shot 2020-05-21 at 5.09.54 PM.png

My Unity version is: 2019.2.21f1

My Visual Studio Version is: 8.6 (build 4520)

When I select “Build and run” from Unity and have my IPad plugged in the app launches and the profiler connects.

I’ve tried unplugging the usb cable and the airplane mode wifi trick.

Any ideas?

1 Like

Looks like I was missing a key step. From Visual Studio instead of the dropdown I was using (pic in previous comment) I needed to:

Run > Attach to Process > Select my IPad

Works like a charm. My IPad is not plugged in to my Mac.

1 Like

Hello i am also facing the same issue, cannot see my ios device in the attach the process. What can be the issue?

Felixmann can you please guide me how to resolve this issue.

3 Likes

Unity docs say that need to disable firewall on router, but it doesn’t help.

I still wonder why do I have to put my iPhone into airplane mode to debug it?!? Every time I forget about this and I cannot debug it (I do not do Unity3D as full time). This is a unity thing that is super annoying. Xamarin VS, xCode doesn’t need this. Any plan on removing this particular needs one day?