Bug 27628 - SequentialAccess flag on DataReader causes GetValues to fail with NullReferenceException
Summary: SequentialAccess flag on DataReader causes GetValues to fail with NullReferen...
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Data (show other bugs)
Version: 3.12.0
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-03-04 01:45 UTC by Marc Melvin
Modified: 2017-09-01 09:29 UTC (History)
2 users (show)

See Also:
Is this bug a regression?: ---
Last known good build:


Description Marc Melvin 2015-03-04 01:45:23 UTC
I'm using SQL Server 2008 R2 SP3.

When attempting to use a SqlDataReader with SequentialAccess flag, the call to GetValues fails with a NullReferenceException. Removing SequentialAccess from ExecuteReader call solves the problem.

I discovered this issue while using the Dapper library, and have filed a ticket with them as well at the link below, but it appears this is an issue in the underlying Mono libraries due to it failing on an otherwise simple GetValues call passing in an array of null objects:

Comment 1 CoderPersonGuy 2015-07-07 18:47:06 UTC
I'm getting the following stack with SqlDataReader.  SequentialAccess is not being used but it is also in GetValue() so maybe the same bug:

Exception: NullReferenceException: Object reference not set to an instance of an object
  at System.Data.SqlClient.SqlDataReader.GetValues (System.Object[] values) <0x40984000 + 0x0006d> in <filename unknown>:0 
  at System.Data.ProviderBase.DataReaderContainer+CommonLanguageSubsetDataReader.GetValues (System.Object[] values) <0x40983f90 + 0x00029> in <filename unknown>:0 
  at System.Data.ProviderBase.SchemaMapping.LoadDataRow () <0x40983d90 + 0x00030> in <filename unknown>:0 
  at System.Data.Common.DataAdapter.FillLoadDataRow (System.Data.ProviderBase.SchemaMapping mapping) <0x40983910 + 0x00137> in <filename unknown>:0 
  at System.Data.Common.DataAdapter.FillFromReader (System.Data.DataSet dataset, System.Data.DataTable datatable, System.String srcTable, System.Data.ProviderBase.DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, System.Data.DataColumn parentChapterColumn, System.Object parentChapterValue) <0x4097d300 + 0x0011b> in <filename unknown>:0 
  at System.Data.Common.DataAdapter.Fill (System.Data.DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) <0x4097c920 + 0x00287> in <filename unknown>:0 
  at System.Data.Common.DbDataAdapter.FillInternal (System.Data.DataSet dataset, System.Data.DataTable[] datatables, Int32 startRecord, Int32 maxRecords, System.String srcTable, IDbCommand command, CommandBehavior behavior) <0x4097bcb0 + 0x0011c> in <filename unknown>:0 
  at System.Data.Common.DbDataAdapter.Fill (System.Data.DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) <0x4097b9f0 + 0x00173> in <filename unknown>:0 
  at System.Data.Common.DbDataAdapter.Fill (System.Data.DataTable dataTable) <0x4097b740 + 0x000c2> in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Data.Common.DbDataAdapter:Fill (System.Data.DataTable)
Comment 2 CoderPersonGuy 2015-07-07 18:47:29 UTC
Mono JIT compiler version 4.3.0 (Nightly Mon Jul  6 10:14:31 UTC 2015)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen
Comment 3 CoderPersonGuy 2015-07-07 18:48:59 UTC
Using SQL Server 2012

Note You need to log in before you can comment on or make changes to this bug.