The "XamlCTask" task failed unexpectedly on visual studio for xamarin

Nirav Shah picture Nirav Shah · May 8, 2015 · Viewed 26.7k times · Source

When I am trying to run application on Xamarin on visual studio, I am getting error as mentioned below and not able to run the application on device or emulator:

The "XamlCTask" task failed unexpectedly.
Microsoft.Cci.Pdb.PdbDebugException: Unknown custom metadata item kind: 6
   at Microsoft.Cci.Pdb.PdbFunction.ReadCustomMetadata(BitAccess bits)
   at Microsoft.Cci.Pdb.PdbFunction..ctor(ManProcSym proc, BitAccess bits)
   at Microsoft.Cci.Pdb.PdbFunction.LoadManagedFunctions(BitAccess bits, UInt32 limit, Boolean readStrings)
   at Microsoft.Cci.Pdb.PdbFile.LoadFuncsFromDbiModule(BitAccess bits, DbiModuleInfo info, IntHashTable names, ArrayList funcList, Boolean readStrings, MsfDirectory dir, Dictionary`2 nameIndex, PdbReader reader)
   at Microsoft.Cci.Pdb.PdbFile.LoadFunctions(Stream read, Dictionary`2& tokenToSourceMapping, String& sourceServerData)
   at Mono.Cecil.Pdb.PdbReader.PopulateFunctions()
   at Mono.Cecil.Pdb.PdbReader.ProcessDebugHeader(ImageDebugDirectory directory, Byte[] header)
   at Mono.Cecil.ModuleDefinition.ProcessDebugHeader()
   at Mono.Cecil.ModuleDefinition.ReadSymbols(ISymbolReader reader)
   at Mono.Cecil.ModuleReader.ReadSymbols(ModuleDefinition module, ReaderParameters parameters)
   at Mono.Cecil.ModuleReader.CreateModuleFrom(Image image, ReaderParameters parameters)
   at Mono.Cecil.ModuleDefinition.ReadModule(Stream stream, ReaderParameters parameters)
   at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
   at Xamarin.Forms.Build.Tasks.XamlCTask.Compile()
   at Xamarin.Forms.Build.Tasks.XamlCTask.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__1.MoveNext()  MyFirstProject      

Before adding this "Xamarin.Forms.Maps" NuGet package, my application working but as I have added this suddenly application stops running and getting error.

Anybody could help me what causes this type of issue?

Answer

Nirav Shah picture Nirav Shah · May 11, 2015

This issue arise, if your Xamarin.Form version is not compatible/matching with your NuGet package which you have installed.

So, I have just updated Xamarin.Forms for both xx.Droid and PCL and make the match the dependencies with NuGet package.

Now it is working fine. Hope so this will work for you.