I got exception when trying to compile my project on latest Xamarin Studio
Update all Nuget packages and compile
Compile successfully
/Fody.1.29.4/build/portable-net+sl+win+wpa+wp/Fody.targets (FodyTarget target) ->
: 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
=== Xamarin Studio Community ===
Version 6.3 (build 863)
Installation UUID: bd0bb861-d6c1-4778-ac44-c31ee64f501b
Runtime:
Mono 4.8.0 (mono-4.8.0-branch/9d74414) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Package version: 408000524
=== NuGet ===
Version: 3.5.0.0
=== Xamarin.Profiler ===
'/Applications/Xamarin Profiler.app' not found
=== Xamarin Inspector ===
Version: 1.2.1
Hash: 0ea0a12
Branch: d15-1
Build date: Thu, 06 Apr 2017 20:24:44 GMT
=== Apple Developer Tools ===
Xcode 8.3 (12169)
Build 8E162
=== Xamarin.iOS ===
Version: 10.8.0.175 (Xamarin Studio Community)
Hash: a04678c2
Branch: d15-1
Build date: 2017-03-28 14:05:38-0400
=== Xamarin.Mac ===
Version: 3.2.0.175 (Xamarin Studio Community)
=== Xamarin.Android ===
Version: 7.2.0.7 (Xamarin Studio Community)
Android SDK: /Users/tuyen/Library/Android/sdk
Supported Android versions:
5.1 (API level 22)
6.0 (API level 23)
7.0 (API level 24)
7.1 (API level 25)
SDK Tools Version: 25.2.5
SDK Platform Tools Version: 25.0.3
SDK Build Tools Version: 25.0.2
Java SDK: /usr
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Build Information ===
Release ID: 603000863
Git revision: a2163670efe259c85cd8f335d95b175068fbbe2a
Build date: 2017-04-03 14:33:15-04
Xamarin addins: 2045d688ea1420e0381b473360ca62a763eb7d04
Build lane: monodevelop-lion-d15-1
=== Operating System ===
Mac OS X 10.12.4
Darwin Tuyens-Mac.local 16.5.0 Darwin Kernel Version 16.5.0
Fri Mar 3 16:52:33 PST 2017
root:xnu-3789.51.2~3/RELEASE_X86_64 x86_64
This is the same error as this one: https://github.com/realm/realm-dotnet/issues/1341
Am I correct in assuming your computer has less than 8 GB of RAM?
If that's the case, it's an issue with Fody and Cecil and there's nothing we can do about it as long as we rely on rewriting the IL.
Yeah. The same issue. My Mac is 16GB of RAM.
No way of workaround?
It shouldn't happen on Macs with that much memory. Can you try restarting it and then making sure there are no memory hungry apps running during compilation?
Just restart the machine then open Xamarin Studio then add package then rebuild. Same error :((
Workaround: Change .NET Runtime to v4.8

It's a Cecil bug with Mono 5.
https://github.com/jbevain/cecil/issues/378
Let's hope this gets fixed or we will not have c# 7 on mono and Fody.
You are right, but it was presumably fixed in Cecil 0.10. Problem is that Fody 1.29.4 still references Cecil 0.9.
You are right, but it was presumably fixed in Cecil 0.10. Problem is that Fody 1.29.4 still references Cecil 0.9.
Fody doesn't actually reference Cecil is the real problem. Instead they use a version they control and that is bundled directly in the Fody package. If it was a package dependency then we could all just update Cecil and nobody would have a problem. That said I might suggest the Realm team put some effort on helping Fody fix this issue, because this is a complete show stopper for anyone who wants to start using Realm. You might also want to reach out to @Redth as he did mention he was going to take an extended look into this.
Workaround: Change .NET Runtime to v4.8
Installing a second Runtime isn't well documented, and from what I've seen the installer just changes your version altogether. Either way relying on v4.8 isn't a good long term solution if you want dev's to start adopting Realm.
I tried to recompile everything with latest Cecil 0.10, problem is that the build breaks using Cecil 0.10 in the Fody PropertyChanged, see https://github.com/Fody/PropertyChanged/issues/226
Most helpful comment
Fody doesn't actually reference Cecil is the real problem. Instead they use a version they control and that is bundled directly in the Fody package. If it was a package dependency then we could all just update Cecil and nobody would have a problem. That said I might suggest the Realm team put some effort on helping Fody fix this issue, because this is a complete show stopper for anyone who wants to start using Realm. You might also want to reach out to @Redth as he did mention he was going to take an extended look into this.
Installing a second Runtime isn't well documented, and from what I've seen the installer just changes your version altogether. Either way relying on v4.8 isn't a good long term solution if you want dev's to start adopting Realm.