mono/ikvm-fork — pull request #1 by martinpotter (2012-12-07 22:28:27+00:00)
Title: Always using 16 as the number of DataDirectory entries in the PE header.

Using the value read into NumberOfRvaAndSizes can result in an assembly failing to load with IKVM.Reflection that loads successfully with System.Reflection on Microsoft's and Mono's implementation of .NET.

Inside Microsoft .NET IL Assembler p51 describes NumberOfRvaAndSizes as "Number of entries in the DataDirectory array; at least 16. Although it is theoretically possible to emit more than 16 data directories, all existing managed compilers emit exactly 16 data directories, with the sixteenth (last) data directory never used (reserved)." The implementation of Mono's System.Reflection assumes, and memcpy's, 16 DataDirectory entries when loading an assembly.