SqlDependency.Start - Getting intermittent KeyNotFoundException

G

Guest

I'm working heavily with query notifications in SQL Server 2005 and I
intermittently get the following exception:

System.Collections.Generic.KeyNotFoundException: The given key was not
present in the dictionary.

No one on the Internet seems to have ever encountered this.

A partial stack trace appears below. It's partial in that I've ommitted a
long set of calls from our interal app framework that are orthogonal to the
problem.

The NT user making these calls is a local administrator on the database
server. The calls work a lot of the time, but break and seemingly random
moments.

We use a preconfigured SQL Server Service Broker Queue named
QueryChangeMessages and a service called QueryChangeNotifications.

Please help.

Server stack trace:
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at
SqlDependencyProcessDispatcher.SqlConnectionContainer.ProcessNotificationResults(SqlDataReader reader)
at
SqlDependencyProcessDispatcher.SqlConnectionContainer.SynchronouslyQueryServiceBrokerQueue()
at
SqlDependencyProcessDispatcher.SqlConnectionContainer..ctor(SqlConnectionContainerHashHelper hashHelper, String appDomainKey, Boolean useDefaults)
at SqlDependencyProcessDispatcher.Start(String connectionString, String&
server, DbConnectionPoolIdentity& identity, String& user, String& database,
String& queueService, String appDomainKey,
SqlDependencyPerAppDomainDispatcher dispatcher, Boolean& errorOccurred,
Boolean& appDomainStart, Boolean useDefaults)
at SqlDependencyProcessDispatcher.Start(String connectionString, String
queue, String appDomainKey, SqlDependencyPerAppDomainDispatcher dispatcher)
at
System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr
md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext,
Object[]& outArgs)
at
System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle
md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext,
Object[]& outArgs)
at
System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at SqlDependencyProcessDispatcher.Start(String connectionString, String
queue, String appDomainKey, SqlDependencyPerAppDomainDispatcher dispatcher)
at System.Data.SqlClient.SqlDependency.Start(String connectionString,
String queue, Boolean useDefaults)
at System.Data.SqlClient.SqlDependency.Start(String connectionString,
String queue)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top