Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Broker Problem with connect to Mac from Visual Studio 2019 Xamarin.iOS

After updated mac OS to Catalina 10.15.4 and XCode 11.4 and VS 2019 16.5.1
I can't pairing to mac from VS, there is getting the error in VS:
"An error occurred while trying to start Broker ...".

Info at log file:
"Broker could not be installed.
A connection is established to "192.168.233.1" ...
Server changes from ConnectingState to DisconnectingState to 192.168.233.1 (192.168.233.1).
Disconnecting from 192.168.233.1 ...
Server changes from DisconnectingState to DisconnectedState to 192.168.233.1 (192.168.233.1).
Connection to "192.168.233.1" is established.
An error occurred while trying to start Broker ...
Client vs - No packet has been sent in 30 seconds.
Sending Ping to Server to maintain Keep Alive"

I think the problem with connecting to macOS, because
Apple replaced bash with zsh as the default shell in macOS Catalina.

I tried to do next steps to resolve it:
1) Remove XMA folder on Mac and Windows:
On MacOs: open "$HOME/Library/Caches/Xamarin"
On Win: %localappdata%\Temp\Xamarin\XMA

2) I accepted XCode agreement on MacOS:

sudo xcodebuild -license accept

3) Then I tried connect to MacOS and I got the error:
"An unexpected error occurred while checking the SSH configuration "192.168.233.1". An item with the same key has already been added."

I fix it by deleted the hosts.key file in this directory:

 %LOCALAPPDATA%\Xamarin\MonoTouch

And again I got the same error: "An error occurred while trying to start Broker ..."

4) I checked ping with Mac ping 192.168.233.1 - works ,

ssh [email protected] 

This command gave the message:
"The default interactive shell is now zsh. To update your account to use zsh, please run chsh -s /bin/zsh. For more details, please visit https://support.apple.com/kb/HT208050."

Please give any advice how to fix problem with Broker to pair Visual Studio to MacOS with Catalina.

like image 482
Polyariz Avatar asked Mar 28 '20 11:03

Polyariz


People also ask

Do I need a Mac to develop iOS Xamarin?

From May 2017, you can develop app without MAC. Microsoft Xamarin introduce a Live Player. With Live Player, iOS apps can be deployed directly onto an iPhone or other iDevice from a PC running Visual Studio, where the code can then be tested and debugged.

Does Xamarin support macOS?

Xamarin. Mac exposes the complete macOS SDK for . NET developers to build native Mac applications using C#.

How do I use Xamarin on my Mac?

In Visual Studio for Mac, right-click on the existing Xamarin. Forms solution and choose Add > Add New Project... In the New Project window choose Mac > App > Cocoa App and press Next. Type an App Name (and optionally choose a different name for the Dock Item), then press Next.


Video Answer


3 Answers

I found the solution:

  1. Copy the content from id_rsa.pub, it location here:

    %LOCALAPPDATA%\Xamarin\MonoTouch\

  2. Paste it into mac ~/.ssh/authorized_keys in a New Line.

  3. Download the attached scp.zip binary to Download folder on Mac and decompress it.

  4. Need temporarily disable the System Integrity Protection (SIP):

  • Reboot the system and hold down Command+R (⌘+R) keys simultaneously when you hear the startup chime; this will boot macOS into Recovery Mode

  • Once in Recovery mode, open a Terminal window from the Utilities drop-down menu at the top of the screen. Type command in the Terminal and execute it:
    csrutil disable

  • Type in the Terminal reboot

  1. When Mac will restart, executed in the Terminal next commands:

    sudo mount -uw /

Backup old SCP:

sudo cp /usr/bin/scp /usr/bin/scp.bak

Replace SCP:

sudo cp ~/Downloads/scp /usr/bin/scp

Try now connection and it should work.

  1. Re-enable SIP after installation:
    Reboot into Recovery Mode again (⌘+R at system chime).
    Open a Terminal and enter:
    csrutil enable

    Reboot

like image 198
Polyariz Avatar answered Oct 10 '22 10:10

Polyariz


Delete or rename folder %LOCALAPPDATA%\Xamarin\MonoTouch\ on windows pc

Delete or rename folder ~/.ssh/authorized_keys on mac

Delete connection for mac in visual studio and add new connection again

like image 31
Alex Avatar answered Oct 10 '22 11:10

Alex


I am adding to Alex's answer as I cannot comment yet.

After deleting %LOCALAPPDATA%\Xamarin\MonoTouch\, I also deleted %LOCALAPPDATA%\Temp\Xamarin\XMA and then deleted the authorized keys from my Mac's .ssh folder.

That worked for me and I was able to get it to build to my Mac again from my Windows machine.

like image 44
Daniel Mamnev Avatar answered Oct 10 '22 11:10

Daniel Mamnev