Exception has been thrown by the target of an invocation.


I am getting an error when trying to connect my database to Source Control for both local and remote database servers.
Exception has been thrown by the target of an invocation.

Microsoft SQL Server Management Studio v17.9.1 
Build  14.0.17289.0
SQL Source Control 7.0.41


  • Do you get the option to submit an error report at all?
    Have you visited our Help Centre?
  • joncrowelljoncrowell Posts: 2 New member
    I'm getting the same thing. The error submission modal pops up and I've submitted the issue.
  • joncrowelljoncrowell Posts: 2 New member
    edited April 23, 2021 6:01PM
    I gave up on the tool because of this but needed to try again when a new team at work began using it. Kept running into the same error. People have been reporting this since 2012 at least.

    I submitted the error report at least 10 times. I never heard back from Red Gate.

    I had version 7.2.20 installed on a Windows 10 laptop.

    I noticed a "fix" in the release notes for version 7.0 (see below) that mentioned this error occurring when SQL Prompt is installed. I had installed a trial of SQL Prompt at some point, so my spider sense kicked in.

    I was able to fix the issue. I don't think all of my steps were necessary but don't know for sure. Here is what I did.

    1. Search for any file with the words "SQL Prompt" or "sqlprompt" in them. There were about 70 of these.
    2. Delete them all. Many require admin to force delete them. (still failing)
    3. Downgrade to version 7.1. (still failing)
    4. Upgrade to current version 7.2.20. (Success! I am now able to link databases to source control without the error.)

    https://documentation.red-gate.com/soc7/release-notes-and-other-versions/sql-source-control-7-0-release-notes - December 11th, 2018


    • Fixed issue when linking a new database results in an error 'Exception has been thrown by the target of an invocation' on Windows 8 and earlier, when SQL Prompt is installed and Git is not accessible.
  • lukastolukasto Posts: 2 New member
    I am having the same problem when connecting a database to Git.
    I've already reinstalled SQL Source Control and that didn't fix the problem.
    Deleting the above-mentioned files didn't help either, before that this database worked fine with Source Control but suddenly something broke.
    I was unable to get the current code from Git and I found information on some forum to disconnect the Git base and reconnect it. Disconnection was successful, but not connected anymore.
    The above solution does not work for me.

Sign In or Register to comment.