Error in XML document. Hexadecimal value 0x1F, is an invalid character

Published Jan 15 2019 04:35 PM 6,049 Views
Microsoft
First published on MSDN on Jun 03, 2015
I worked on an issue recently where we were noticing that a large majority of the out of the box System Center Configuration manager (SCCM) reports were throwing the same error. Very odd! I would expect to see an error from a custom report but not an out of the box report! Here is the error the reports were throwing

From SQL Server Reporting Services (SSRS):

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, 21726).
'¬', hexadecimal value 0x1F, is an invalid character. Line 1, position 1869.



From SCCM:

System.InvalidOperationException
There is an error in XML document (1, 21726).

Stack Trace:
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Microsoft.ConfigurationManagement.Reporting.Internal.Proxy.ReportingService2005.GetReportParameters(String Report, String HistoryID, Boolean ForRendering, ParameterValue[] Values, DataSourceCredentials[] Credentials)
at Microsoft.ConfigurationManagement.Reporting.Internal.SrsReportServer.GetReportParameters(String path, Dictionary`2 parameterValues, Boolean getValues)

-------------------------------

System.Xml.XmlException
'­', hexadecimal value 0x1F, is an invalid character. Line 1, position 21726.

Stack Trace:
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle)
at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at Microsoft.ConfigurationManagement.Reporting.Internal.Proxy.ReportingService2005.GetReportParameters(String Report, String HistoryID, Boolean ForRendering, ParameterValue[] Values, DataSourceCredentials[] Credentials)
at Microsoft.ConfigurationManagement.Reporting.Internal.SrsReportServer.GetReportParameters(String path, Dictionary`2 parameterValues, Boolean getValues)



Taking a look at the stack I can see that it appears to be failing to read one of the parameters (GetReportParameters)

I opened up a few of the reports in Report Builder and saw that each had a few parameters that are in every SCCM report but each had one parameter which was common to just the failing reports. The parameter was CollID. When taking a look at the query for the dataset (Parameter_DataSet_CollectionID)

select CollectionID, CollectionName=Name, NameSort=CollectionID+' - '+Name
from fn_rbac_Collection(@UserSIDs)
order by 2



I then opened up the Function fn_rbac_Collection in the SCCM database to see what table it was pulling from. It is getting its parameters from v_Collection

I used the following SQL query to search through the parameters to find which one(s) contain the 1F hex value

SELECT Name
FROM v_Collection
WHERE CONVERT(varchar(max),convert(varbinary(max),convert(nvarchar(max),Name)),2) LIKE '%1F%'



Here is what we got:

Name
Uni-InternetExplorer_11.0¬_R01



Nothing seemed off about that name so I pasted it into notepad and started keying through the letters. I noticed that going from left to right, when I key past the zero in 11.0, I had to click the arrow key twice on my keyboard! Opening the string in a hex editor I could see that right between that zero and the underscore is that 1F hex.

Knowing now that it was the culprit, we went into SCCM, found that collection, and then retyped it so that it would no longer have that hidden character.

Kicked off the report and we had a successful render!

In other cases, I also came across reports that had the same issue, but were pulling from Assignments. This is the query I used to pull the corrupt assignment parameters

SELECT AssignmentName
FROM CI_CIAssignments
WHERE CONVERT(varchar(max),convert(varbinary(max),convert(nvarchar(max),AssignmentName)),2) LIKE '%1F%'

Mark Hughes
Microsoft Business Intelligence Support – Escalation

%3CLINGO-SUB%20id%3D%22lingo-sub-318573%22%20slang%3D%22en-US%22%3EError%20in%20XML%20document.%20Hexadecimal%20value%200x1F%2C%20is%20an%20invalid%20character%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-318573%22%20slang%3D%22en-US%22%3E%0A%20%26lt%3Bmeta%20http-equiv%3D%22Content-Type%22%20content%3D%22text%2Fhtml%3B%20charset%3DUTF-8%22%20%2F%26gt%3B%3CSTRONG%3EFirst%20published%20on%20MSDN%20on%20Jun%2003%2C%202015%20%3C%2FSTRONG%3E%20%3CBR%20%2F%3E%20I%20worked%20on%20an%20issue%20recently%20where%20we%20were%20noticing%20that%20a%20large%20majority%20of%20the%20out%20of%20the%20box%20System%20Center%20Configuration%20manager%20(SCCM)%20reports%20were%20throwing%20the%20same%20error.%20Very%20odd!%20I%20would%20expect%20to%20see%20an%20error%20from%20a%20custom%20report%20but%20not%20an%20out%20of%20the%20box%20report!%20Here%20is%20the%20error%20the%20reports%20were%20throwing%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20From%20SQL%20Server%20Reporting%20Services%20(SSRS)%3A%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CBLOCKQUOTE%3EThe%20attempt%20to%20connect%20to%20the%20report%20server%20failed.%20Check%20your%20connection%20information%20and%20that%20the%20report%20server%20is%20a%20compatible%20version.%20%3CBR%20%2F%3E%20There%20is%20an%20error%20in%20XML%20document%20(1%2C%2021726).%20%3CBR%20%2F%3E%20'%C2%AC'%2C%20hexadecimal%20value%200x1F%2C%20is%20an%20invalid%20character.%20Line%201%2C%20position%201869.%3CP%3E%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CP%3EFrom%20SCCM%3A%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3ESystem.InvalidOperationException%20%3CBR%20%2F%3E%20There%20is%20an%20error%20in%20XML%20document%20(1%2C%2021726).%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Stack%20Trace%3A%20%3CBR%20%2F%3E%20at%20System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader%20xmlReader%2C%20String%20encodingStyle%2C%20XmlDeserializationEvents%20events)%20%3CBR%20%2F%3E%20at%20System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader%20xmlReader%2C%20String%20encodingStyle)%20%3CBR%20%2F%3E%20at%20System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage%20message%2C%20WebResponse%20response%2C%20Stream%20responseStream%2C%20Boolean%20asyncCall)%20%3CBR%20%2F%3E%20at%20System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String%20methodName%2C%20Object%5B%5D%20parameters)%20%3CBR%20%2F%3E%20at%20Microsoft.ConfigurationManagement.Reporting.Internal.Proxy.ReportingService2005.GetReportParameters(String%20Report%2C%20String%20HistoryID%2C%20Boolean%20ForRendering%2C%20ParameterValue%5B%5D%20Values%2C%20DataSourceCredentials%5B%5D%20Credentials)%20%3CBR%20%2F%3E%20at%20Microsoft.ConfigurationManagement.Reporting.Internal.SrsReportServer.GetReportParameters(String%20path%2C%20Dictionary%602%20parameterValues%2C%20Boolean%20getValues)%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20-------------------------------%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20System.Xml.XmlException%20%3CBR%20%2F%3E%20'%C2%AD'%2C%20hexadecimal%20value%200x1F%2C%20is%20an%20invalid%20character.%20Line%201%2C%20position%2021726.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Stack%20Trace%3A%20%3CBR%20%2F%3E%20at%20System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader%20xmlReader%2C%20String%20encodingStyle%2C%20XmlDeserializationEvents%20events)%20%3CBR%20%2F%3E%20at%20System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader%20xmlReader%2C%20String%20encodingStyle)%20%3CBR%20%2F%3E%20at%20System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage%20message%2C%20WebResponse%20response%2C%20Stream%20responseStream%2C%20Boolean%20asyncCall)%20%3CBR%20%2F%3E%20at%20System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String%20methodName%2C%20Object%5B%5D%20parameters)%20%3CBR%20%2F%3E%20at%20Microsoft.ConfigurationManagement.Reporting.Internal.Proxy.ReportingService2005.GetReportParameters(String%20Report%2C%20String%20HistoryID%2C%20Boolean%20ForRendering%2C%20ParameterValue%5B%5D%20Values%2C%20DataSourceCredentials%5B%5D%20Credentials)%20%3CBR%20%2F%3E%20at%20Microsoft.ConfigurationManagement.Reporting.Internal.SrsReportServer.GetReportParameters(String%20path%2C%20Dictionary%602%20parameterValues%2C%20Boolean%20getValues)%3CP%3E%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CP%3ETaking%20a%20look%20at%20the%20stack%20I%20can%20see%20that%20it%20appears%20to%20be%20failing%20to%20read%20one%20of%20the%20parameters%20(GetReportParameters)%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20I%20opened%20up%20a%20few%20of%20the%20reports%20in%20Report%20Builder%20and%20saw%20that%20each%20had%20a%20few%20parameters%20that%20are%20in%20every%20SCCM%20report%20but%20each%20had%20one%20parameter%20which%20was%20common%20to%20just%20the%20failing%20reports.%20The%20parameter%20was%20CollID.%20When%20taking%20a%20look%20at%20the%20query%20for%20the%20dataset%20(Parameter_DataSet_CollectionID)%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3Eselect%20CollectionID%2C%20CollectionName%3DName%2C%20NameSort%3DCollectionID%2B'%20-%20'%2BName%20%3CBR%20%2F%3E%20from%20fn_rbac_Collection(%40UserSIDs)%20%3CBR%20%2F%3E%20order%20by%202%3CP%3E%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CP%3EI%20then%20opened%20up%20the%20Function%20fn_rbac_Collection%20in%20the%20SCCM%20database%20to%20see%20what%20table%20it%20was%20pulling%20from.%20It%20is%20getting%20its%20parameters%20from%20v_Collection%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20I%20used%20the%20following%20SQL%20query%20to%20search%20through%20the%20parameters%20to%20find%20which%20one(s)%20contain%20the%201F%20hex%20value%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3ESELECT%20Name%20%3CBR%20%2F%3E%20FROM%20v_Collection%20%3CBR%20%2F%3E%20WHERE%20CONVERT(varchar(max)%2Cconvert(varbinary(max)%2Cconvert(nvarchar(max)%2CName))%2C2)%20LIKE%20'%251F%25'%3CP%3E%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CP%3EHere%20is%20what%20we%20got%3A%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3EName%20%3CBR%20%2F%3E%20Uni-InternetExplorer_11.0%C2%AC_R01%3CP%3E%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3CP%3ENothing%20seemed%20off%20about%20that%20name%20so%20I%20pasted%20it%20into%20notepad%20and%20started%20keying%20through%20the%20letters.%20I%20noticed%20that%20going%20from%20left%20to%20right%2C%20when%20I%20key%20past%20the%20zero%20in%2011.0%2C%20I%20had%20to%20click%20the%20arrow%20key%20twice%20on%20my%20keyboard!%20Opening%20the%20string%20in%20a%20hex%20editor%20I%20could%20see%20that%20right%20between%20that%20zero%20and%20the%20underscore%20is%20that%201F%20hex.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Knowing%20now%20that%20it%20was%20the%20culprit%2C%20we%20went%20into%20SCCM%2C%20found%20that%20collection%2C%20and%20then%20retyped%20it%20so%20that%20it%20would%20no%20longer%20have%20that%20hidden%20character.%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%20Kicked%20off%20the%20report%20and%20we%20had%20a%20successful%20render!%20%3CBR%20%2F%3E%20%3CBR%20%2F%3E%3C%2FP%3E%0A%20%20%3CP%3EIn%20other%20cases%2C%20I%20also%20came%20across%20reports%20that%20had%20the%20same%20issue%2C%20but%20were%20pulling%20from%20Assignments.%20This%20is%20the%20query%20I%20used%20to%20pull%20the%20corrupt%20assignment%20parameters%3C%2FP%3E%0A%20%20%3CBLOCKQUOTE%3E%0A%20%20%20%3CP%3ESELECT%20AssignmentName%20%3CBR%20%2F%3E%20FROM%20CI_CIAssignments%20%3CBR%20%2F%3E%20WHERE%20CONVERT(varchar(max)%2Cconvert(varbinary(max)%2Cconvert(nvarchar(max)%2CAssignmentName))%2C2)%20LIKE%20'%251F%25'%20%3CBR%20%2F%3E%3C%2FP%3E%0A%20%20%3C%2FBLOCKQUOTE%3E%0A%20%20%3CP%3EMark%20Hughes%20%3CBR%20%2F%3E%20Microsoft%20Business%20Intelligence%20Support%20%E2%80%93%20Escalation%3C%2FP%3E%0A%20%0A%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-318573%22%20slang%3D%22en-US%22%3EFirst%20published%20on%20MSDN%20on%20Jun%2003%2C%202015%20I%20worked%20on%20an%20issue%20recently%20where%20we%20were%20noticing%20that%20a%20large%20majority%20of%20the%20out%20of%20the%20box%20System%20Center%20Configuration%20manager%20(SCCM)%20reports%20were%20throwing%20the%20same%20error.%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-318573%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EReporting%20Services(SSRS)%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Version history
Last update:
‎Jan 15 2019 04:35 PM
Updated by: