LinkReplaceTimerJob threw an exception after running Update-SPInfoPathUserFileUrl

Repro steps:  

- A .rsds file is a shared data source file published to SharePoint by users to allow SQL reports to run properly in SSRS integrated mode with SharePoint. Often, customers deploy the shared data source file to a Data Connection library since the file defines a data connection to a data source.

Reference: https://msdn.microsoft.com/en-us/library/bb326288.aspx

- Publish a shared Data source file to a data connection library (or simply upload an existing .rsds file if you dont have SSRS running)

- Run the following powershell command: 

Get-SPWebApplication https://sp2010 | Update-SPInfoPathUserFileUrl -find "https://sp2007" -replace "https://sp2010"

- From the event viewer on the server, you will see the following error:

"The Execute method of job definition Microsoft.SharePoint.Utilities.LinkReplaceTimerJob threw an exception. Object reference not set to an instance of an object." 

Below is what I have gathered from Reflector and ULS logs:

  • From Microsoft.SharePoint.Utilities.SharePointLinkReplace
    • SharePoint will call FixList on all the lists
    • If the list is a Data connection library, call FixUDCFileon every file if the file is not .aspx
    • FixUDCFile will process the file (ULS log: "Processing data connection file" was called before exception was thrown), then call FixUdcXML and then FixXML, which will then call PerformChecksOnXMLDocument
    • Once in PerformChecksOnXMLDocument, because the .rsds file has a different xml structure than both XSN and UDCX files, the code looks for nodes that cannot be found, hence resulting in an Object reference not set to an instance of an object exception.

Resolution:

  • Before running the powershell command, remove or rename the .rsds file to aspx so that the timer job will skip processing rsds files