Serialization exception when saving dxp file with a large number of columns

Serialization exception when saving dxp file with a large number of columns

book

Article ID: KB0070713

calendar_today

Updated On:

Products Versions
Spotfire Analyst 11.4 and Higher

Description

While working on Spotfire Client, you may face the below error while opening, modifying, or saving the analysis file/s.
 SerializationException at Spotfire.Dxp.Framework: The internal array cannot expand to greater than Int32.MaxValue elements.


This is a known issue caused by the .NET Framework limitation. To address this limitation, there is an option that was introduced with .NET Framework 4.7.2 that controls whether the System.Runtime.Serialization.ObjectManager uses a larger array size during object serialization and deserialization. If you are using an earlier version of the .NET Framework, then you need to upgrade/switch to 4.7.2 or higher .Net version and follow the resolution mentioned below.

Issue/Introduction

Due to a limitation with .Net Framework, we may get exceptions like SerializationException while working with analysis on a Spotfire Client (Web / Analyst). This article provides the solution to this problem.

Environment

All

Resolution

You may follow any of the below three options to solve the issue:

Option 1: Updating Spotfire.Dxp.exe.config file:
This issue has been addressed by adding the following to the Spotfire.Dxp.exe.config (file under Spotfire analyst installation directory) in the configuration block after the startup tag:

 <runtime>     <!-- Use this switch to make BinaryFormatter fast with large object graphs starting with .NET 4.7.2 -->       <AppContextSwitchOverrides value="Switch.System.Runtime.Serialization.UseNewMaxArraySize=true" />   </runtime>
 

Please close and Relaunch the Analyst client after updating the above. You may have to restart the machine as well.

Option 2: Making changes at the registry level:
If you follow option 1, then you would have to update the "Spotfire.Dxp.exe.config" file every time you update your analyst client or install a new one. Therefore, it would be better to make the changes at the registry level itself on the analyst machine/s and Node Manager machines so that the solution persists even if there are any changes/updates made to the Spotfire clients. 

You can set this switch by adding a registry key under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft>.NETFramework\AppContext with the name Switch.System.Runtime.Serialization.UseNewMaxArraySize, and set the value to True. See below:
User-added image


Option 3: Download and Run the attached SetAppContext.reg to automatically set this key.

Note: Please take a backup of the registry before making a change. Please get in touch with your Windows/Admin team for assistance here.

Attachments

Serialization exception when saving dxp file with a large number of columns get_app