SQL Clone throws "Could not get list of clones" error due to Newtonsoft.Json.JsonSerializationException


If SQL Clone fails to create images or clones with a "Could not get list of clones" error, you may see an error like the following in the SQL Clone log files:

018-07-30 11:16:38.037 -06:00 [Error] Could not get list of clones
Newtonsoft.Json.JsonSerializationException: Cannot create and populate list type System.Collections.Generic.IReadOnlyCollection`1[RedGate.SqlClone.Api.Clones.Expanded.CloneExpanded]. Path '', line 1, position 1.

This error can occur when an incompatible version of Newtonsoft.Json has been loaded into the Global Assembly Cache (typically by another application). For example, the version in the GAC may be for .NET 4, whereas SQL Clone uses a version for .NET 4.5. .NET will preferentially load the version in the GAC, and in the case of Newtonsoft.Json is unable to distinguish between incompatible versions, causing this issue. Ideally, no application would load Newtonsoft.Json into the GAC, as this potential incompatibility is well known.

The problem can be solved by replacing the .dll file in the GAC with the .dll shipped with SQL Clone, or removing the .dll from the GAC entirely. (However, the latter solution may cause other applications - likely the one which loaded the .dll into the GAC in the first place - to malfunction.)


1. The GAC is located in C:\Windows\Microsoft.NET\assembly. You can locate the currently installed Newtonsoft.Json.dll and store a backup of this version if needed.
2. To uninstall that version from the GAC, launch a command prompt as administrator and run the following command: 
gacutil -u Newtonsoft.Json
3. Then if you'd like to install the version of Newtonsoft.Json.dll that SQL Clone requires, run the following command:
gacutil -i "C:\Program Files\Red Gate\SQL Clone Agent\<version>\Newtonsoft.Json.dll"
4. Test from SQL Clone to confirm the error is resolved

Was this article helpful?

0 out of 0 found this helpful
Have more questions? Submit a request