Jo Jo
Jo Jo

Reputation: 67

Fody compile error after upgrading Visual Studio

My program used to compile just fine in VS2013. After upgrading to VS2015 enterprise edition, when I try to compile the program, it says:

Severity    Code    Description Project File    Line
Error       Fody: An unhandled exception occurred:
Exception:
Unknown custom metadata item kind: 6
StackTrace:
   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, Int32& age, Guid& guid)
   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 InnerWeaver.ReadModule() in c:\TeamCity\buildAgent\work\7495521761d392b9\FodyIsolated\ModuleReader.cs:line 14
   at InnerWeaver.Execute() in c:\TeamCity\buildAgent\work\7495521761d392b9\FodyIsolated\InnerWeaver.cs:line 28
Source:
Mono.Cecil.Pdb
TargetSite:
Void ReadCustomMetadata(Microsoft.Cci.Pdb.BitAccess)    ChampionsGG     

I have never used fody before and never heard of it before, so i'm not sure why it would be using this. After checking the packages file there was 2 packages, Fody and Costura.Fody but I don't remember putting it there. I removed both lines and recompiled but the error still occurs.

Does anyone know why this is happening?

Upvotes: 1

Views: 2857

Answers (2)

sebgur
sebgur

Reputation: 31

I had the same problem after upgrading from VS 2012 with an old version of Fody (1.26) to VS 2015 with the latest Fody (1.29.4).

So I uninstalled Fody entirely but then I got a build error from my old Fody, which should no longer have been there.

I looked in the csproj file and saw that 2 lines about my old Fody were left. I commented them out, then re-installed the latest Fody, and then everything worked again.

Upvotes: 1

Alois Kraus
Alois Kraus

Reputation: 13535

Seems to be a known issue of Fody. You seem to use TeamCity to build your solution. I am no TeamCity expert but the exception comes from a MS pdb parser which is used by Mono Cecil which is used by TeamCity to do ... things.

Check out this issue of Fody: https://github.com/Fody/Fody/issues/187

Either wait for TeamCity to update Fody or update it by yourself or remove the custom MSBuild task which triggers the TeamCity activity.

Upvotes: 0

Related Questions