Skip to content

XmlSqlBinaryReader is not working in .Net6 #74852

@WaynePaiMS

Description

@WaynePaiMS

Description

XmlSqlBinaryReader is not working in .NET6 but working in .NET5. Below is callstack

Microsoft.AnalysisServices.ResponseFormatException: The server sent an unrecognizable response.
---> System.Xml.XmlException: '', hexadecimal value 0x06, is an invalid character.
at System.Xml.XmlSqlBinaryReader.CheckText(Boolean attr)
at System.Xml.XmlSqlBinaryReader.ScanOverValue(BinXmlToken token, Boolean attr, Boolean checkChars)
at System.Xml.XmlSqlBinaryReader.ScanOverAnyValue(BinXmlToken token, Boolean attr, Boolean checkChars)
at System.Xml.XmlSqlBinaryReader.ScanOverValue(BinXmlToken token, Boolean attr, Boolean checkChars)
at System.Xml.XmlSqlBinaryReader.ScanAttributes()
at System.Xml.XmlSqlBinaryReader.ImplReadElement()
at System.Xml.XmlSqlBinaryReader.ReadDoc()
at System.Xml.XmlSqlBinaryReader.Read()

I found there is a bug in CheckText of XmlSqlBinaryReader, which introduced by this commit, https://github.com/dotnet/runtime/pull/43379/files?diff=split&w=0.
The original end is _pos, which is next token position, and CheckText will just check to that position. Now, _data.AsSpan takes _end, which is end position of entire buffer(_data). Hence, CheckText will scan and validate for entire buffer and then encounter unexpected char.

Reproduction Steps

Please ping [email protected] for repro steps

Expected behavior

XmlSqlBinaryReader should work in .NET6

Actual behavior

XmlSqlBinaryReader is not working in .NET6

Regression?

Yes, it's due to https://github.com/dotnet/runtime/pull/43379/files?diff=split&w=0

Known Workarounds

No workaround

Configuration

.NET6

Other information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions