How do I resolve this Xamarin iOS Build Error in Visual Studio 2015, "Xamarin.Messaging.Exceptions.ClientDisconnectedException"?

Henry5110 1 Reputation point
2021-02-02T15:03:51.593+00:00

After moving to a new Windows laptop, I am no longer able to build Xamarin iOS projects in Visual Studio 2015. With the same MacBook, I was able to build Xamarin iOS projects in Visual Studio 2015 on my old Windows laptop.

Due to customer requirements, I need to build a Xamarin iOS project with Xamarin.Forms.2.5.0.77107. I was able to reproduce this build error with the App1.iOS project in the sample Xamarin Cross Platform App generated by Visual Studio 2015, after installing Xamarin.Forms.2.5.0.77107 in the solution (the same issue also happens with Xamarin.Forms.2.3.4.247).

I am getting the following error when trying to build the App1.iOS project, while connected to the MacBook:

1>------ Rebuild All started: Project: App1.iOS, Configuration: Release iPhone ------
1> Connecting to Mac server 192.168.1.233...
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): warning : The client build9304hhuan has been disconnected while waiting a post response to topic xvs/Build/4.6.0.299/copy-item/App1.iOS/80b5892%2FXamarin.Forms.Core.dll
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): warning : The underlying client has been disconnected by the remote host
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): warning : System.ObjectDisposedException: Cannot access a disposed object.
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): warning : Object name: 'System.Net.Mqtt.Client.Client'.
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): warning : at System.Net.Mqtt.Client.Client.<UnsubscribeAsync>d__32.MoveNext() in C:\Git\mqtt\src\Client\Client.cs:line 213
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): warning : --- End of stack trace from previous location where exception was thrown ---
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): warning : at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): warning : at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): warning : at Xamarin.Messaging.Client.TopicObservable1.<<Subscribe>b__5_0>d.MoveNext() in C:\d\lanes\4985\b63523e2\source\xamarinvs\src\Messaging\Xamarin.Messaging.Client\TopicObservable.cs:line 32 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): warning : The client build9304hhuan has been disconnected while waiting a post response to topic xvs/Build/4.6.0.299/copy-item/App1.iOS/80b5892%2FXamarin.Forms.Core.dll 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): warning : at Xamarin.Messaging.Client.MessagingClient.<PostAsync>d__232.MoveNext() in C:\d\lanes\4985\b63523e2\source\xamarinvs\src\Messaging\Xamarin.Messaging.Client\MessagingClient.cs:line 172
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: The "UnpackLibraryResources" task failed unexpectedly.
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: System.AggregateException: One or more errors occurred. ---> Xamarin.Messaging.Exceptions.ClientDisconnectedException: The client build9304hhuan has been disconnected while waiting a post response to topic xvs/Build/4.6.0.299/copy-item/App1.iOS/80b5892%2FXamarin.Forms.Core.dll
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at Xamarin.Messaging.Client.MessagingClient.<PostAsync>d__232.MoveNext() in C:\d\lanes\4985\b63523e2\source\xamarinvs\src\Messaging\Xamarin.Messaging.Client\MessagingClient.cs:line 194 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: --- End of stack trace from previous location where exception was thrown --- 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at Xamarin.Messaging.Client.MessagingClient.<PostAsync>d__272.MoveNext() in C:\d\lanes\4985\b63523e2\source\xamarinvs\src\Messaging\Xamarin.Messaging.Client\MessagingClient.cs:line 0
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: --- End of stack trace from previous location where exception was thrown ---
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at Xamarin.Messaging.Client.MessagingClient.<PostAsync>d__331.MoveNext() in C:\d\lanes\4985\b63523e2\source\xamarinvs\src\Messaging\Xamarin.Messaging.Client\MessagingClient.cs:line 325 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: --- End of stack trace from previous location where exception was thrown --- 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at Xamarin.VisualStudio.Build.BuildClient.<UploadItemAsync>d__22.MoveNext() in C:\d\lanes\4985\b63523e2\source\xamarinvs\src\MSBuild\Xamarin.VisualStudio.Build\BuildClient.cs:line 128 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: --- End of stack trace from previous location where exception was thrown --- 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at Xamarin.VisualStudio.Build.BuildClient.<UploadItemAsync>d__21.MoveNext() in C:\d\lanes\4985\b63523e2\source\xamarinvs\src\MSBuild\Xamarin.VisualStudio.Build\BuildClient.cs:line 115 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: --- End of stack trace from previous location where exception was thrown --- 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at Xamarin.VisualStudio.Build.TaskRunner.<CopyRequiredInputFilesAsync>d__7.MoveNext() in C:\d\lanes\4985\b63523e2\source\xamarinvs\src\MSBuild\Xamarin.VisualStudio.Build\TaskRunner.cs:line 159 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: --- End of inner exception stack trace --- 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions) 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at Xamarin.VisualStudio.Build.TaskRunner.Run(Task task) in C:\d\lanes\4985\b63523e2\source\xamarinvs\src\MSBuild\Xamarin.VisualStudio.Build\TaskRunner.cs:line 45 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at Xamarin.MacDev.Tasks.UnpackLibraryResources.Execute() in C:\d\lanes\4985\b63523e2\source\xamarinvs\src\MSBuild\Xamarin.MacDev.Tasks\Tasks\UnpackLibraryResources.cs:line 14 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: ---> (Inner Exception #0) Xamarin.Messaging.Exceptions.ClientDisconnectedException: The client build9304hhuan has been disconnected while waiting a post response to topic xvs/Build/4.6.0.299/copy-item/App1.iOS/80b5892%2FXamarin.Forms.Core.dll 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at Xamarin.Messaging.Client.MessagingClient.<PostAsync>d__232.MoveNext() in C:\d\lanes\4985\b63523e2\source\xamarinvs\src\Messaging\Xamarin.Messaging.Client\MessagingClient.cs:line 194
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: --- End of stack trace from previous location where exception was thrown ---
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at Xamarin.Messaging.Client.MessagingClient.<PostAsync>d__272.MoveNext() in C:\d\lanes\4985\b63523e2\source\xamarinvs\src\Messaging\Xamarin.Messaging.Client\MessagingClient.cs:line 0 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: --- End of stack trace from previous location where exception was thrown --- 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) 1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at Xamarin.Messaging.Client.MessagingClient.<PostAsync>d__331.MoveNext() in C:\d\lanes\4985\b63523e2\source\xamarinvs\src\Messaging\Xamarin.Messaging.Client\MessagingClient.cs:line 325
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: --- End of stack trace from previous location where exception was thrown ---
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at Xamarin.VisualStudio.Build.BuildClient.<UploadItemAsync>d__22.MoveNext() in C:\d\lanes\4985\b63523e2\source\xamarinvs\src\MSBuild\Xamarin.VisualStudio.Build\BuildClient.cs:line 128
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: --- End of stack trace from previous location where exception was thrown ---
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at Xamarin.VisualStudio.Build.BuildClient.<UploadItemAsync>d__21.MoveNext() in C:\d\lanes\4985\b63523e2\source\xamarinvs\src\MSBuild\Xamarin.VisualStudio.Build\BuildClient.cs:line 115
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: --- End of stack trace from previous location where exception was thrown ---
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018: at Xamarin.VisualStudio.Build.TaskRunner.<CopyRequiredInputFilesAsync>d__7.MoveNext() in C:\d\lanes\4985\b63523e2\source\xamarinvs\src\MSBuild\Xamarin.VisualStudio.Build\TaskRunner.cs:line 159<---
1>C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(573,3): error MSB4018:
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

I am using the following versions of software on my Windows laptop:

Microsoft Visual Studio Professional 2015
14.0.25431.01 Update 3

Microsoft .NET Framework
4.8.04084

Xamarin
4.6.0.299 (b63523e27)

Xamarin.iOS
10.12.0.20 (80b8487)

I am using the following versions of software on my MacBook:

Visual Studio Community 2017 for Mac
7.5.4 build 3

Xamarin.iOS
11.12.0.4

Xcode
8.3.3

I have confirmed that the Xamarin Mac Agent icon in Visual Studio 2015 shows as green, indicating an active connection to the MacBook. The Xamarin Mac Agent dialog shows the MacBook name next to a solid chain link, indicating an active connection. Also, I am able to click the Show iOS Simulator icon to successfully bring up the iOS simulator on the MacBook. The status of the connection to the MacBook remains the same before and after the failed build.

One difference between my new and old Windows laptops is that the new one has both Visual Studio 2015 and 2019 installed, due to the need to build with different versions of Xamarin.Forms. On the other hand, the old laptop did not have Visual Studio 2019 installed. Although Visual Studio 2019 recommends uninstalling Xamarin Components, I have not done so in case I may need it when using Visual Studio 2015.

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,367 questions
0 comments No comments
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.