What exactly does this error mean?

During a recent deployment, we came across this error which failed the build

##[error]Error connecting to database: The given key was not present in the dictionary.

[##[debug]Migration metadata header found: <Migration ID="2d0d85e1-2865-48b9-ad30-10d3d5cedb09" />
##[warning]RedGate.Versioning.Engine.Shared.DatabaseUtils.Exceptions.DatabaseConnectionException: Error connecting to database: The given key was not present in the dictionary. ---> 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)]

Is there any additional information you can give regarding this error?  Google search brings back no results


Answers

  • Hi @andybomberger

    This was a recent bug with the Microsoft.Data.SqlClient dll in SQL Change Automation. A new version with an upgraded version was released yesterday and should resolve the issue:

    4.5.22292 - October 19th, 2022

    Improvements:

    • Updated SQL Compare Engine to 14.10.6.22110

    Changes:

    • SQL Change Automation is now using version 5.0.1 of Microsoft.Data.SqlClient library.

    Could you re-run your deployment on the latest and let me know if that works?

    Kind regards

    Dan Calver | Redgate Software
    Have you visited our 
    Help Center?

  • Thanks for the response.  It actually ended up that the user we were using in PROD had slightly different permissions and wasn't allowed to access system tables.  Once we removed the code that was trying to access those system tables, the migration worked
Sign In or Register to comment.