Bug 61134 - Xamarin Simulator fails to support multiple users
Summary: Xamarin Simulator fails to support multiple users
Status: NEW
Alias: None
Product: Windows iOS Simulator
Classification: Xamarin
Component: Simulator ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2018-01-03 05:27 UTC by Brendt
Modified: 2018-01-03 06:32 UTC (History)
3 users (show)

Is this bug a regression?: ---
Last known good build:

System Details (2.53 KB, text/plain)
2018-01-03 05:27 UTC, Brendt

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 61134 on Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.
Related Links:

Description Brendt 2018-01-03 05:27:06 UTC
Created attachment 26060 [details]
System Details

We have a team of developers (4) all running on PC hardware with Windows 10 and Microsoft Visual Studio Community 2017 
Version 15.5.2 (see attachment for more details). To avoid having to have 1 x Mac for each developer it would instead be ideal to share a single (high powered) Mac. Certainly, this is a common scenario.

We are able to get multiple instances of the iOS Simulator running simultaneously on the same system (detailed below). However, we are unable to get multiple instances of the `Remoted iOS Simulator` running simultaneously.

What works:
Using the Mac Agent we can have two developers connect to the Mac on separate Mac user accounts. e.g. Jason connects the `Jason` user and Robert connects to `Robert` user on the Mac. Both Jason and Robert can successfully build and deploy the app to the iOS Simulator simultaneously and interact with the iOS Simulator via VNC. We have in fact been working this way for some time. However, the `Remoted iOS Simulator` is more performant and a better UX than remoting into the Mac Desktop.

What doesn't:
If both Jason and Robert switch on `Remoted iOS Simulator` then Jason can build and deploy successfully. However, when Robert attempts he gets the error message `Xamarin Simulator - The device {guid} was not found`. 

We've tried to resolve this:
- `sudo xcode-select -switch /Applications/Xcode.app`
- selecting the same `iOS Simlator` on both systems (e.g. iPhone 6S iOS 11.1.2)
- selecting the different `iOS Simlator` on each system (e.g. iPhone 6S iOS 11.1.2 on one and iPhone X iOS 11.1.2 on the other)

The only resolution is to reboot the Mac. Robert can then build and deploy successfully to the `Remoted iOS Simulator`. However, attempts by Jason to do the same results in him being presented with the same error message.

It appears from the error message that the iOS Simulator cannot be found on the system. The resolutions presented on the web (and above) are along these lines. However, given our experimentation, rather the issue is a result that simultaneous access from two separate accounts leaves Visual Studio or the Mac Agent confused and unable to find any iOS Simulator instances on the Mac.

We also tried connecting simultaneously from both Jason & Roberts PC to a single user account on the Mac. We are no longer presented with the error message. But it is not possible to connect simultaneously to the `Remoted iOS Simulator`. The following is from the logs on the second PC trying to connnect. 

Unhandled Exception: System.InvalidOperationException: The stream is currently in use by a previous operation on the stream.
   at System.IO.StreamWriter.CheckAsyncTaskInProgress()
   at System.IO.StreamWriter.Write(String value)
   at Xamarin.Simulator.Core.StreamMetricSystem.Track(String eventId, IReadOnlyDictionary`2 data) in E:\A\_work\97\s\Xamarin.Simulator.Core\StreamMetricSystem.cs:line 76
   at Xamarin.Simulator.Core.CombinedMetricSystem.Track(String eventId, IReadOnlyDictionary`2 data) in E:\A\_work\97\s\Xamarin.Simulator.Core\CombinedMetricSystem.cs:line 54
   at Xamarin.Simulator.Windows.App.<OnConnectionStateChanged>d__14.MoveNext() in E:\A\_work\97\s\Xamarin.Simulator.Windows\App.xaml.cs:line 223
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<>c.<ThrowAsync>b__6_1(Object state)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
. Please check the logs for more details.
The app has been terminated.

It's certainly easier to switch back and forth between developers using the `Remoted iOS Simulator` using the one account but it doesn't achieve our goal using the `Remoted iOS Simulator` across multiple developers.