'System.ArgumentNullException' occurred in Newtonsoft.Json.dll

  • Updated

This article describes a cryptic error that can be thrown from any Episerver API and how to troubleshoot it.

The complete error message can be seen below.

An exception of type 'System.ArgumentNullException' occurred in Newtonsoft.Json.dll but was not handled in user code
Additional information: The provided content link does not have a value.

This issue occurs because of missing or mismatched assembly from a migration or update.

Here are the steps to troubleshoot the issue:

  • Examine the code that is failing. For example:
      var searchResult = SearchClient.Instance.Search<SiteProductVariation>().For(searchTerm).GetContentResult();
  • In this example the namespace for GetContentResult is in Episerver.Find
  • Reinstall the Nuget Package that the code is failing from, in this instance Episerver.Find.
  • Rebuild and retest the site and the API failure should be gone.
  • If there are additional errors repeat the steps above for any other APIs and their respective Nuget packages.