“Out of Memory” Exception When Building Documentation


Some users may receive an error message about an 'OutOfMemory' exception while building documentation.  The error message will be similar to the following:

Unable to build documentation.  An error was encountered while merging XML documenation.  Exception of type 'System.OutOfMemoryException' was thrown.

This error is typical when large projects (or solutions with multiple projects) are being documented and the XML file that is generated for the documenter contains too much information.  To prevent the error, the size of the merged XML file must be reduced.


The primary solution is to remove source code from the generated document.  The inclusion of source code can cause signficant bloat to the size of the XML file used for documenting.

The Default setting is to include source code, so you will need to use the Custom setting to turn off the source code.  When using the Documenter Wizard, you will need to select 'Custom settings' on the 'Configuration Style' page.  On the 'General Options' page, you will then need to clear the box labeled 'Include source code' under the 'Other Settings' section.  This option is also available on the 'Documenter' tab of the Property Pages for the project.

Comments are closed