Collection was modified; enumeration operation may not execute.
---------------------------------------------------------------
Key: DNET-745
URL: http://tracker.firebirdsql.org/browse/DNET-745
Project: .NET Data provider
Issue Type: Bug
Affects Versions: 5.8.0.0
Environment: .Net 4 and4.5
Reporter: Paul Reeves
Assignee: Jiri Cincura
We have a client that have found what appears to be a bug in v5.8.0.0
The code and the stack trace are attached below.
The same code works fine with all versions between 4.1 and 5.7
They've also tested with .Net framework 4 and 4.5
They are happy to run a debug build to help fix this, but have not been able to
create a test case.
#if DEBUG
var cmd = "select s.S_SHOPID, s.S_VALUE as FOO, s1.S_VALUE as BAR,
s2.S_VALUE as SNAFU " +
"from SYSTEMSETTING s " +
"left join SYSTEMSETTING s1 on s.S_SHOPID = s1.S_SHOPID " +
"left join SYSTEMSETTING s2 on s.S_SHOPID = s2.S_SHOPID " +
"where s.S_SYSTEM_ID = 9202 " +
"and s1.S_SYSTEM_ID = 9200 " +
"and s2.S_SYSTEM_ID = 9201 " +
"and s.S_VALUE = 'Y' " +
"and s1.S_VALUE <> '' " +
"and s2.S_VALUE <> ''";
using (FbCommand fbCmd = new FbCommand(cmd)) {
using (DataTable myDT = new DataTable()) {
using (FbDataAdapter da = new FbDataAdapter()) {
da.SelectCommand = fbCmd;
fbCmd.Connection = DbConnection;
try {
LogFile.Log("Before Data Adapter.Fill() call. Managed Thread ID:
" + System.Threading.Thread.CurrentThread.ManagedThreadId.ToString(), true);
da.Fill(myDT);
LogFile.Log("After Data Adapter.Fill() call. Managed Thread ID: "
+ System.Threading.Thread.CurrentThread.ManagedThreadId.ToString(), true);
foreach (DataRow row in myDT.Rows) {
LogFile.Log("Row Logged");
}
}
catch (Exception e) {
LogFile.Log("******--- ERROR ---******", true);
LogFile.Log("Managed Thread ID: " +
System.Threading.Thread.CurrentThread.ManagedThreadId.ToString());
LogFile.Log("Error Message: " + e.Message);
LogFile.Log("Error Message: " + e.StackTrace);
}
}
}
}
LogFile.Log("After Select via SQL Test. Managed Thread ID: " +
System.Threading.Thread.CurrentThread.ManagedThreadId.ToString(), true);
#endif
--------------------------------------------------------------------------------
Tuesday 21 March 2017 01:20:07.308 PM
--------------------------------------------------------------------------------
:Before Select via SQL Test. Managed Thread ID: 4
:FirebirdSql.Data.FirebirdClient version: 5.8.0.0
--------------------------------------------------------------------------------
Tuesday 21 March 2017 01:20:07.308 PM
--------------------------------------------------------------------------------
:Before Data Adapter.Fill() call. Managed Thread ID: 4
--------------------------------------------------------------------------------
Tuesday 21 March 2017 01:20:07.313 PM
--------------------------------------------------------------------------------
:******--- ERROR ---******
:Managed Thread ID: 4
:Error Message: Collection was modified; enumeration operation may not
execute.
:Error Message: at
System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
at System.Linq.Enumerable.<TakeIterator>d__24`1.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at FirebirdSql.Data.Client.Managed.XdrStream.Read(Byte[] buffer, Int32
offset, Int32 count) in
C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\Client\Managed\XdrStream.cs:line
249
at FirebirdSql.Data.Client.Managed.XdrStream.ReadBytes(Int32 count) in
C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\Client\Managed\XdrStream.cs:line
336
at FirebirdSql.Data.Client.Managed.XdrStream.ReadOpaque(Int32 length) in
C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\Client\Managed\XdrStream.cs:line
348
at FirebirdSql.Data.Client.Managed.GdsConnection.ProcessOperation(Int32
operation, XdrStream xdr) in
C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\Client\Managed\GdsConnection.cs:line
362
at
FirebirdSql.Data.Client.Managed.Version10.GdsDatabase.ReadSingleResponse() in
C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\Client\Managed\Version10\GdsDatabase.cs:line
638
at FirebirdSql.Data.Client.Managed.Version10.GdsDatabase.ReadResponse() in
C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\Client\Managed\Version10\GdsDatabase.cs:line
593
at
FirebirdSql.Data.Client.Managed.Version10.GdsDatabase.ReadGenericResponse() in
C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\Client\Managed\Version10\GdsDatabase.cs:line
605
at FirebirdSql.Data.Client.Managed.Version11.GdsStatement.Prepare(String
commandText) in
C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\Client\Managed\Version11\GdsStatement.cs:line
77
at FirebirdSql.Data.FirebirdClient.FbCommand.Prepare(Boolean returnsSet) in
C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:line
1148
at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteCommand(CommandBehavior
behavior, Boolean returnsSet) in
C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:line
1171
at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader(CommandBehavior
behavior) in
C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:line
523
at System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset,
DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable,
IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32
startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
at PNDataService.DbConnectionManager.InitializeEvents(String errorstatus,
Boolean resumedFromDownTime) in C:\Dev
VS\PNDATASERVICEVS4.5\DbConnectionManager.cs:line 987
--------------------------------------------------------------------------------
Tuesday 21 March 2017 01:20:07.329 PM
--------------------------------------------------------------------------------
:After Select via SQL Test. Managed Thread ID: 4
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Firebird-net-provider mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider