The given key was not present in the dictionary.

StormRiderStormRider Posts: 26
I'm attempting to link a backup of my live database, and ran into this error:
The given key was not present in the dictionary.
Stack Trace:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at #GWeb.#XXM.#NHdb(DatabaseObjectId , IEnumerable`1 )
at #GWeb.#XXM.#Fvi.#iz2b(DatabaseObjectId )
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at RedGate.Shared.Utils.Collections.Set`1..ctor(IEnumerable`1 src, IEqualityComparer`1 comparer)
at #GWeb.#XXM.#Xt3(DatabaseObjectIdSet )
at #GWeb.#XXM.#tYM()
at #GWeb.#WXM.#qYM()
at #GWeb.#XXM.#iS()
at #qlhb.#0heb.#l36(String , #1heb , ICancellableOperationStatus )
at #qlhb.#K3c.#83c(String , #O9U , ICancellableOperationStatus , IReadOnlySourceControlServerCallBacks )
at #qlhb.#0heb.#wieb(#L3c , #ZZ7 , #A57 , #tEc , IObjectExplorerStateService , #xHR , #9ynb , #4Ec , #j3l , Options , #quBb , ICancellableOperationStatus , IReadOnlySourceControlServerCallBacks )
at #GWeb.#VXM.#mYM[#NrPb](Func`2 , ICancellableOperationStatus , IReadOnlySourceControlServerCallBacks , IDifferenceSelector )
at #GWeb.#VXM.#kYM(ICancellableOperationStatus , IReadOnlySourceControlServerCallBacks , IDifferenceSelector )
at #GWeb.#4Ec.#8Jc(ICancellableOperationStatus , IReadOnlySourceControlServerCallBacks , IDifferenceSelector )
at #GWeb.#4Ec.#izb1.#SB7b(ICancellableOperationStatus )
at RedGate.SQLSourceControl.Engine.Cancellables.MutexedCancellableOperation`1.#u36.#k5f()
at RedGate.SQLSourceControl.Engine.Cancellables.CancellableOperationBase.InvokeWithTracker(Action action)
at RedGate.SQLSourceControl.Engine.Cancellables.MutexedCancellableOperation`1.Invoke()
at #eEc.#Qlg.Invoke()
at #JLc.#PLc.#Jfb.#EJf()
at RedGate.SQLSourceControl.Engine.SmartAssembly.ExceptionReporting.ErrorReporterBase.Do(Action , Predicate`1 , Boolean )
at RedGate.SQLSourceControl.Engine.SmartAssembly.ExceptionReporting.ErrorReporterBase.DoWithObviousExceptionsRethrowAll(Action action)
at RedGate.SQLSourceControl.CommonUI.Forms.ErrorDialog.DoWithObviousExceptionsRethrowAll(Action action)
at #JLc.#PLc.#CTc(ICancellableOperation`1 , Object )

version: 3.0.4.40

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello,

    Sorry this error message is so vague.

    What you can try for starters is to connect to the database as a sysadmin user. If, for instance, you have access to a table, but not the definition of a dependent schema object, you'll get this error because Source Control knows about some object but can't have access to the metadata about it.

    If that works, it's a permissions issue.

    If not, please let me know and we'll go through the debugging to try to find the offending object name and work from there.
  • It doesn't appear to be a permissions issue, I've tried connecting with my windows account and as SA, and verified that both have sysadmin access.

    What's the next step?
  • Brian contacted me directly, and with some additional support, I was able to find and fix my problem:

    When you link an existing database to source control, and linked static data is defined where there's no records in the database AND in source control, it throws the error I encountered.
Sign In or Register to comment.