这是我的32位.net应用程序在连接到sql server时偶然发生的随机错误。
System.ApplicationException: A device attached to the system is not functioning. (Exception from HRESULT: 0x8007001F)
at System.Threading.TimerBase.AddTimerNative(Object state, UInt32 dueTime, UInt32 period, StackCrawlMark& stackMark)
at System.Threading.TimerBase.AddTimer(TimerCallback callback, Object state, UInt32 dueTime, UInt32 period, StackCrawlMark& stackMark)
at System.Threading.Timer..ctor(TimerCallback callback, Object state, Int32 dueTime, Int32 period)
at System.Data.ProviderBase.DbConnectionPool.CreateCleanupTimer()
at System.Data.ProviderBase.DbConnectionPool.Startup()
at System.Data.ProviderBase.DbConnectionPoolGroup.GetConnectionPool(DbConnectionFactory connectionFactory)
at System.Data.ProviderBase.DbConnectionFactory.GetConnectionPool(DbConnection owningObject, DbConnectionPoolGroup connectionPoolGroup)
at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
at System.Data.SqlClient.SqlConnection.Open()
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(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)
at System.Data.Common.DbDataAdapter.Fill(DataSet dataSet)
System.Threading.TimerBase.AddTimerNative()
方法是内部通话,请参阅Microsoft source code.
我在网上发现了另一个关于CLR的链接 Does CLR internally spawns a thread to respond to timer events?
由于我不知道如何实现AddTimerNative
,我不知道解决此错误的原因。