Search code examples
realmfody

The realm dot net base example does not compile


I am having trouble at getting the example "QuickJournal" to compile on iOS. The code compiles OK, but fails during the Fody step.

Goals

Try out the example application for .NET through the following - Pull the repository - Open the solution in examples/QuickJournal - Compile and test

Expected Results

Smooth compilation & testing experience

Actual Results

Fody out of memory exception

Steps to Reproduce

See the setup, follow steps I am using the latest Xamarin/Visual Studio Mac/XCode

Code Sample

The regular realm source code

Version of Realm and Tooling

git clone https://github.com/realm/realm-dotnet.git

git checkout 8f5e36ffd91e06b9c60b91f9de3fb312b411a4a4

The exception I am getting is
Fody: Found debug symbols at '~/realm-dotnet/examples/QuickJournal/QuickJournal/obj/Debug/QuickJournal.pdb'. MSBUILD : error : Fody: An unhandled exception occurred: MSBUILD : error : Exception: MSBUILD : error : Out of memory MSBUILD : error : StackTrace: MSBUILD : error : at (wrapper alloc) System.Object:AllocVector (intptr,intptr) MSBUILD : error : at Microsoft.Cci.Pdb.MsfDirectory..ctor (Microsoft.Cci.Pdb.PdbReader reader,

See log file RealmCompilelog.txt


Solution

  • Realm 1.2.1 addresses that by using an updated version of Fody.

    Answer for older Realm versions: This is caused by a Cecil bug with Mono 5.0. As Realm depends on Fody, which uses Cecil, compilation will fail for project referencing it. Until new Cecil and Fody versions are released, the workaround is to revert to Mono 4.8:

    enter image description here