5

In Visual Studio 2017, while attempting to archive a Xamarin android project i get the following error after succesfull build:

Failed to create App archive "MyArchive". This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread.

Anyone else who have seen this error?

René AD
  • 343
  • 3
  • 11
  • https://stackoverflow.com/questions/18331723/this-type-of-collectionview-does-not-support-changes-to-its-sourcecollection-fro – SushiHangover Jan 19 '19 at 09:36
  • 1
    You only get this error when archiving? In somewhere in your application, you are doing manipulations that must be in the UI Thread. – Bruno Caceiro Jan 19 '19 at 16:27
  • 1
    Yes, I only get this error while i'm using the Build | Archive function in Visual studio. The program compiles, builds and runs vel in both debug and release mode. – René AD Jan 20 '19 at 17:41
  • in my case if check MultiDex option in compile configuration it's return to works... try and good luck – raBinn Feb 07 '19 at 15:14
  • In my case restarting Visual Studio worked... – sql_dru Feb 28 '19 at 15:16

5 Answers5

3

Deleting the Bin and Obj folders also worked for me.

Liviu-IC
  • 49
  • 6
2

I encountered the same issue. The only way I could get around it was to uncheck "Enable Multi-Dex" in Android Options. I think something might be broke in the latest version of visual studio 2017.

Scott
  • 306
  • 3
  • 8
  • Multi-Dex is not enabled, so that's not the problem in my case. I agree, it could look as it is a problem in Visual Studio 2017. – René AD Jan 22 '19 at 22:42
  • pfff i just got this error, then just archieved again and it just worked... somethings wrong alright... – axa Mar 15 '19 at 12:24
2

I finally found that the solution for me, was to uninstall all the Xamarin.Android NuGet Packages from my solution, and then reinstall them.

René AD
  • 343
  • 3
  • 11
2

I had the same problem and I managed to solve it. Try removing the Support.v7 NuGet Packages and installing them again. Make sure to install the correct package versions as you do it. Good luck!

sandeepani
  • 353
  • 3
  • 12
2

In addition to the other answers I'd like to add that deleting all the bin and obj folders from my project worked for me.

Paul Kertscher
  • 9,416
  • 5
  • 32
  • 57