0

I'll start off by saying I'm doing this on a school computer (high school), I have full permission to do this and my teacher enters her admin credentials when needed but I can't figure out why it's throwing this error. I followed Microsoft's guide on installing the android emulator for Xamarin in Visual Studio and should have all the prerequisites installed correctly but when I attempt to create a device in android device manager it gets stuck on creating, and when I close it and visit the log I get this at the error:

[20-03-10 19:17:23.90] [SaveInner] CreateAvdAsync failure: System.InvalidOperationException: Cannot change ObservableCollection during a CollectionChanged event.
   at System.Collections.ObjectModel.ObservableCollection`1.CheckReentrancy()
   at System.Collections.ObjectModel.ObservableCollection`1.InsertItem(Int32 index, T item)
   at Xamarin.DeviceManager.Common.ViewModels.MainWindowViewModel.<>c__DisplayClass9_0.<AvdManager_AvdAdded>b__0()
   at System.Windows.Threading.DispatcherOperation.InvokeDelegateCore()
   at System.Windows.Threading.DispatcherOperation.InvokeImpl()

Any ideas as to how to fix this? I'm unsure what I should do but am very eager to get this completely installed.

Edit: Came back to the same class 2 days later and it fixed itself. Not sure what was wrong.

David
  • 25
  • 1
  • 5
  • can you show the code of your CollectionChanged event handler? – Sven-Michael Stübe Mar 10 '20 at 20:34
  • 1
    @Sven-MichaelStübe it doesn't seem like it is their code, but rather some internal code in the AVD manager in Visual Studio. Which version of Visual Studio are you running? Have you tried creating the AVD using the CLI? There is a post about it here: https://stackoverflow.com/a/42798993/368379 – Cheesebaron Mar 10 '20 at 23:42
  • It seems not a stramge error for android emulator. Check the Android emulator setup again. https://learn.microsoft.com/en-us/xamarin/android/get-started/installation/android-emulator/ And try to reinstall the Android SDK. – Wendy Zang - MSFT Mar 11 '20 at 02:25

1 Answers1

0

I had the same issue. I was able to work around this problem by first starting the ADM from Visual Studio, then selecting "+ New" in the ADM, rather than from the Visual Studio menu item "Create Android Emulator...".

In my case, it may be related to the need to download a new image for running a device type for Android TV and maybe for any case where a new image must be downloaded.

Microsoft: this is a bug that should be resolved.