rid00z
rid00z

Reputation: 1616

Fody Exception in Release Mode Symbol file .dll.mdb does not match assembly .dll

I'm having a problems building a PCL in Xamarin Studio on the Mac. It works fine in debug mode but fody throws an exception in Release Mode.

Exception during build is listed below.

Error: Fody: An unhandled exception occurred:
Exception:
Symbol file `XXX/obj/Release/XXX.dll.mdb' does not match assembly `XXX/obj/Release/XXX.dll'
StackTrace:
at Mono.CompilerServices.SymbolWriter.MonoSymbolFile.CheckGuidMatch (Guid other, System.String filename, System.String assembly) [0x00000] in <filename unknown>:0 
  at Mono.CompilerServices.SymbolWriter.MonoSymbolFile..ctor (System.String filename, Mono.Cecil.ModuleDefinition module) [0x00000] in <filename unknown>:0 
  at Mono.CompilerServices.SymbolWriter.MonoSymbolFile.ReadSymbolFile (Mono.Cecil.ModuleDefinition module, System.String filename) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.Mdb.MdbReaderProvider.GetSymbolReader (Mono.Cecil.ModuleDefinition module, System.String fileName) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleReader.ReadSymbols (Mono.Cecil.ModuleDefinition module, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleReader.CreateModuleFrom (Mono.Cecil.PE.Image image, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.IO.Stream stream, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00000] in <filename unknown>:0 
  at InnerWeaver.ReadModule () [0x00000] in <filename unknown>:0 
  at InnerWeaver.Execute () [0x00000] in <filename unknown>:0 
Source:
Mono.Cecil.Mdb
TargetSite:
Void CheckGuidMatch(System.Guid, System.String, System.String)

Upvotes: 8

Views: 2581

Answers (2)

matthewrdev
matthewrdev

Reputation: 12180

Fody needs the debug information (*.mdb file) associated with the outputted assembly to perform the weaving step. Release builds by default turn off the Debug Information field within Build -> Compiler in a projects settings.

Having this build option set to None disables debug symbolication and results in the mdb file getting out of sync, hence the Symbol file 'XXX/obj/Release/XXX.dll.mdb' does not match assembly XXX/obj/Release/XXX.dll exception.

Therefore you need to enable Symbols Only or Full when you build projects in release mode when Fody is integrated into the build process:

enter image description here

Upvotes: 16

TeamTam
TeamTam

Reputation: 1608

You may have already, but I'd start with this if it was me:

  • Right click on your solution
  • Properties
  • Configuration Properties / Configuration

In the "Configuration" drop down in the top left, check that the "Debug" configuration (re: Platform | Build | Deploy) matches "Release".

Upvotes: 1

Related Questions