[Mono-dev] ReferenceSource of System.Text.UnicodeEncoding breaks System.Data.Odbc.OdbcDataReader.GetColumn(int)

Markus Beth markus.beth at zkrd.de
Mon May 4 11:22:21 UTC 2015


Hi all,

System.Data.Odbc.OdbcDataReader.GetColumn(int) works fine for us 
(linux x86_64, unixODBC) in Mono 3.12.1, but it is broken in Mono 
4.0.1. The reason for this is that the ReferenceSource implementation 
of System.Text.UnicodeEncoding.GetString(byte[]) behaves differently 
when you call it with a byte[] of odd length.

mono 3.12.1:
csharp> System.Text.Encoding.Unicode.GetString(new byte[3]);
""
Which is a string of length 1 containing one '\x0' character.


mono 4.0.1:
csharp> System.Text.Encoding.Unicode.GetString(new byte[3]);
"?"
Which is a string of length 2 containing one '\x0' character followed
by a '?' (question mark)


We use the attached patch for Mono 4.0.1 which changes the
implementation of System.Data.Odbc.OdbcDataReader.GetColumn(int) to make
it work with either implementation of
System.Text.UnicodeEncoding.GetString.

Does it make sense to bring in patches like this or will
System.Data.Odbc be replaced by ReferenceSource in the (near) future?

Regards,
Markus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OdbcDataReader.GetColumn.patch
Type: text/x-patch
Size: 1205 bytes
Desc: not available
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20150504/e6c44d79/attachment.bin>


More information about the Mono-devel-list mailing list