DotNetNuke: Digital Asset Management does not support folders containing more than 2 GB of data

The Digital Asset Management module in the current DotNetNuke version (7.1.2) does not support folders that contain more than 2 GB of data. In detail when trying to view the folder properties the following error occurs:

Error: is currently unavailable. DotNetNuke.Services.Exceptions.ModuleLoadException: Arithmetic operation resulted in an overflow. —> System.OverflowException: Arithmetic operation resulted in an overflow. at System.Linq.Enumerable.Sum(IEnumerable`1 source) at DotNetNuke.Modules.DigitalAssets.Components.Controllers.DigitalAssetsController.GetFolderSizeField(IFolderInfo folder) at DotNetNuke.Modules.DigitalAssets.Components.Controllers.DigitalAssetsController.GetFolderPreviewFields(IFolderInfo folder) at DotNetNuke.Modules.DigitalAssets.Components.Controllers.DigitalAssetsController.GetFolderPreviewInfo(IFolderInfo folder) at DotNetNuke.Modules.DigitalAssets.EditFolder.PrepareFolderPreviewInfo() at DotNetNuke.Modules.DigitalAssets.EditFolder.OnInit(EventArgs e) — End of inner exception stack trace —

The reason for this error is very simple: When calculating the folder size DotNetNuke uses an integer to save the folder size in bytes and the integer’s maximum value is 2,147,483,647. To fix this limitation I’ve download the source code (from here) and replaced the line

var size = FolderManager.Instance.GetFiles(folder, true, false).Sum(f => f.Size);


long size = FolderManager.Instance.GetFiles(folder, true, false).Sum(f => (long)f.Size);

in the method DotNetNuke.Modules.DigitalAssets.Components.Controllers.DigitalAssetsController.GetFolderSizeField(IFolderInfo folder).

You can download the fixed version of the DotNetNuke.Modules.DigitalAssets.dll file for the most recent DotNetNuke version 7.1.2 here. To fix the 2 GB limitation in your environment, just replace the DotNetNuke.Modules.DigitalAssets.dll file in the bin folder of your DotNetNuke website with the downloaded file.

I’ve also reported the bug (see here) and hopefully it’s going to be fixed in the next DotNetNuke release.


Leave a Reply

Your email address will not be published. Required fields are marked *