Feb 27, 2017

SSRS error - The attempt to connect to the report server failed. Check your connection information and that the report server is a compatible version. There is an error in XML document (1,xxxxx).

The attempt to connect to the report server failed. Check your connection information and that the report server is a compatible version. There is an error in XML document (1, NNNNN).

'#',hexadecimal value 0x1A is an invalid character. Line 1, position NNNNN.

This weird error appeared when trying to populate an SSRS parameter drop-down list with a list of names of organizations from a query.

In order to populate the drop-down list, SSRS runs the query to retrieve the list of values, then stores it temporarily as XML. The problem is, if there are any characters in the returned values which are invalid in the XML, then the report chokes, and throws this error.

To fix the problem, you need to figure out which record(s) that appear in the drop-down contain the unusual character and correct it.

The error includes the hex representation of the invalid character, so you can search for it in the database with some variation on this query...
SELECT TheID, TheString
FROM SomeTable
WHERE CONVERT(VARCHAR(MAX), CONVERT( VARBINARY(MAX),CONVERT(NVARCHAR(MAX),theString)),2) LIKE '%1A%'

I would have hoped that Microsoft would fix this issue by doing something to address the underlying cause, such as escaping the invalid characters when generating the XML, but they don't seem to have any interest. Even their own devs had to manually retype text to address the issue when it affected SCCM.

No comments:

Post a Comment