G
Guest
Here is a bug that Microsoft should address:
In the System.Data.Common.WeakReferenceCollection.Close(boolean) method, it makes an unconditional check on a System.WeakReference.Target property. It does this to see if it is "alive", so it can null it out. The problem is, if the Target is invalid, the get_Target() method throws an "System.InvalidOperationException: Handle is not initialized" exception.
Either, the get_Target() method should NOT throw exceptions and return null if the handle is invalid OR WeakReferenceCollection.Close(boolean) method should try/catch the querying of the System.WeakReference.Target property.
The bug only appears when the system is under heavy CPU load. It is
The stack trace:
System.InvalidOperationException: Handle is not initialized.
at System.WeakReference.get_Target()
at System.Data.Common.WeakReferenceCollection.Close(Boolean flag)
at System.Data.OleDb.OleDbConnection.CloseReferences(Boolean canceling)
at System.Data.OleDb.OleDbConnection.DisposeManaged()
at System.Data.OleDb.OleDbConnection.Close()
at System.Data.Common.DbDataAdapter.QuietClose(IDbConnection connection, ConnectionState originalState)
at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
.....
Thoughts, suggestions, validations are welcome.
-Michael Briggs
In the System.Data.Common.WeakReferenceCollection.Close(boolean) method, it makes an unconditional check on a System.WeakReference.Target property. It does this to see if it is "alive", so it can null it out. The problem is, if the Target is invalid, the get_Target() method throws an "System.InvalidOperationException: Handle is not initialized" exception.
Either, the get_Target() method should NOT throw exceptions and return null if the handle is invalid OR WeakReferenceCollection.Close(boolean) method should try/catch the querying of the System.WeakReference.Target property.
The bug only appears when the system is under heavy CPU load. It is
The stack trace:
System.InvalidOperationException: Handle is not initialized.
at System.WeakReference.get_Target()
at System.Data.Common.WeakReferenceCollection.Close(Boolean flag)
at System.Data.OleDb.OleDbConnection.CloseReferences(Boolean canceling)
at System.Data.OleDb.OleDbConnection.DisposeManaged()
at System.Data.OleDb.OleDbConnection.Close()
at System.Data.Common.DbDataAdapter.QuietClose(IDbConnection connection, ConnectionState originalState)
at System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)
.....
Thoughts, suggestions, validations are welcome.
-Michael Briggs