Fody: Out of Memory in Xamarin Studio and Visual Studio for Mac

When building a Xamarin Forms project:

Error: Fody: An unhandled exception occurred:
Exception:
Out of memory
StackTrace:
  at (wrapper alloc) System.Object:AllocVector (intptr,intptr)
  at Microsoft.Cci.Pdb.MsfDirectory..ctor (Microsoft.Cci.Pdb.PdbReader reader, Microsoft.Cci.Pdb.PdbFileHeader head, Microsoft.Cci.Pdb.BitAccess bits) [0x000a5] in <d39e61ae2787473a851567b860d13696>:0 
  at Microsoft.Cci.Pdb.PdbFile.LoadFunctions (System.IO.Stream read, System.Collections.Generic.Dictionary`2[System.UInt32,Microsoft.Cci.Pdb.PdbTokenLine]& tokenToSourceMapping, System.String& sourceServerData, System.Int32& age, System.Guid& guid) [0x00027] in <d39e61ae2787473a851567b860d13696>:0 
  at Mono.Cecil.Pdb.PdbReader.PopulateFunctions () [0x00008] in <d39e61ae2787473a851567b860d13696>:0 
  at Mono.Cecil.Pdb.PdbReader.ProcessDebugHeader (Mono.Cecil.Cil.ImageDebugDirectory directory, System.Byte[] header) [0x00048] in <d39e61ae2787473a851567b860d13696>:0 
  at Mono.Cecil.ModuleDefinition.ProcessDebugHeader () [0x00012] in <b5a52cab1f0046ce9f68342127787868>:0 
  at Mono.Cecil.ModuleDefinition.ReadSymbols (Mono.Cecil.Cil.ISymbolReader reader) [0x00015] in <b5a52cab1f0046ce9f68342127787868>:0 
  at Mono.Cecil.ModuleReader.ReadSymbols (Mono.Cecil.ModuleDefinition module, Mono.Cecil.ReaderParameters parameters) [0x00047] in <b5a52cab1f0046ce9f68342127787868>:0 
  at Mono.Cecil.ModuleReader.CreateModuleFrom (Mono.Cecil.PE.Image image, Mono.Cecil.ReaderParameters parameters) [0x00076] in <b5a52cab1f0046ce9f68342127787868>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.IO.Stream stream, Mono.Cecil.ReaderParameters parameters) [0x00028] in <b5a52cab1f0046ce9f68342127787868>:0 
  at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x0000a] in <b5a52cab1f0046ce9f68342127787868>:0 
  at InnerWeaver.ReadModule () [0x00052] in <f6f9069078364b4db60945017a527c4a>:0 
  at InnerWeaver.Execute () [0x00019] in <f6f9069078364b4db60945017a527c4a>:0 
 ([Solution's Name])

It takes less than 2 seconds to crash. There is plenty of memory available:

Hardware Overview:

  Model Name:	iMac
  Model Identifier:	iMac14,2
  Processor Name:	Intel Core i7
  Processor Speed:	4,01 GHz
  Number of Processors:	1
  Total Number of Cores:	4
  L2 Cache (per Core):	256 KB
  L3 Cache:	8 MB
  Memory:	32 GB

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 24 (3 by maintainers)

Most upvoted comments

Change .NET Runtime to v4.8 in Xamarin Studio/VS for Mac Preference will be a workaroud screen shot 2017-04-09 at 6 30 43 pm

This is going to break any Xamarin dev using Fody very soon. It looks unfortunately like this project is a bit dead. I took a quick look at merging in the upstream Cecil changes back into Fody’s fork, and it looks like maybe Cecil now includes the functionality Fody had added to their fork, so perhaps it’s possible to use Cecil as a true dependency. I may have an extended look at this over the next few days.

So I checked the latest nuget packages for Fody. 1.29.4 en 1.30.0-beta01 are coming with Mono.Cecil.dll version 0.9.6.0; so this is the problem (according to Mono.Cecil).

However, in https://github.com/Fody/Fody/tree/master/Lib/Cecil I see the that the version is 0.10.0 …

Is it possible to create a new update for fody packaging this latest version? @SimonCropp ?

It seems like this is causing major havoc for a lot of dev’s… so glad it’s not just me. It seems that the root of this is Cecil, however it is also a Fody problem due to the way in which Fody ships with no dependencies by including Cecil as part of the package. Supposedly the issue should be fixed in 0.10-beta5, however Fody would need to release an updated package with the new Cecil binaries.

Well, on Windows, there is not such configuration, is there a mono somewhere?

@Lenndev nobody is “pointing”, people just try to find the cause and get it logged into a proper issue tracker.