How to overcome "Please select a valid device before running the application." on a paired with Mac Visual Studio on Windows 10

Viewed 4958

I have a Win10 computer paired with Mac. Until today all things were okay, but today I start getting the message:

Please select a valid device before running the application

when I try to debug an iOS Xamarin application on a selected iPhone simulator.

My configurations:

Mac:
  OS: Mac OS Catalina, version 10.15.7
  XCode Vesion: version 12.2
  Visual Studio 2019: version 8.8.4 (build 30)

Win 10:
  OS: Win10 version 10.0.19042.685
  Visual Studio 2019: version 16.8.3

Simulator names are available on my Win10 computer, but when I select one and try to debug an iOS application I get the message I reported above.

If I launch debug on the Mac directly it runs and starts debugging on the selected iPhone simulator. But when I do the same on the paired Win10 computer in Visual Studio I get this message.

I searched google and SO for this issue and according to advises downgraded XCode to the most possible version 12.2 that is supported by Visual Studio. But it does not change anything.

I want to debug application only on simulator on the paired Win10 computer.

Is there a way to fix this issue?

3 Answers

Looks like the problem was related to the connection between my Win and Mac computers.

My steps to resolve this issue:

I opened Tools - Options - Xamarin - iOS Settings on Visual Studio on my Windows computer. On the Pair to Mac dialog window I selected "Forget this connection" (right click context menu on the connection).

Next, on my Mac, I turned off Sharing (System - Preferences - Sharing). Then I restarted my Mac computer. And then turned On sharing again, specifying my username as allowed users.

Next on my Windows computer, in the Visual Studio, on the Tools - Options - Xamarin - iOS Settings section I paired my Mac again.

Voila. All things work as expected!

If anyone else runs into this question today, I found this GitHub issue for XCode 13 issues with Xamarin.ios

https://github.com/xamarin/xamarin-macios/issues/12778

I fixed the issue by manually installing xamarin.ios-15.0.0.6.pkg on my mac (linked in the GitHub issue)

When connecting to mac through visual studio it showed the error "The Xamarin.iOS SDK version '15.0.0.6' that is installed on the Mac is not compatible with this version of Visual Studio. Would you like us to install Xamarin.iOS '14.20.0.25' for you? This will overwrite any other existing Xamarin.iOS installation on your Mac."

But, if you hit cancel it should still connect successfully.

Same issue diff version. VS MAC stand-alone also had some issue as VS WIN connected to VS MAC. Started at some early today. Suspected an update somewhere. Traced issues to auto update of XCode to 13. Solution was to download and reinstall XCode 12.5.1 from Apple Dev site. With XCode 12.5.1 things worked. So, something changed with the API in XCode and Xamarin was not prepared for it.

Related