Cannot link a specific database to source control

Hi,

I am using SQL Source Control 7.4.6.16349 though this was still happening on a previous version before I updated.

My app has a range of databases that are connected and connecting successfully to source control (Git). This included the one I am currently having problems with which I recently unlinked. Now all attempts to either relink or link to a  fresh blank database produce the following error and the exception below is logged. Unsure how exactly to proceed.

Error:


Stacktrace:
2022-10-24 16:17:06.478 +01:00|Error|RedGate.SQLSourceControl.Engine.DatabasePolling.DatabasePolling.DatabasePollingManager|146| Exception thrown during action without poller
System.InvalidOperationException: Sequence contains no elements
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
   at RedGate.SQLSourceControl.Engine.Utils.IO.ProjectFileUtils.GetProjectFilePath(String rootPath, Boolean allowNonExistent)
   at RedGate.SQLSourceControl.Engine.Utils.IO.ProjectFileUtils.GetRelativeProjectFilePath(String rootPath)
   at RedGate.SQLSourceControl.Engine.LinkedDatabaseFactory.CreateLinkedDatabaseFromExistingRepo(ICancellableOperationStatus status, DatabaseId databaseId, IVisitableSrcCLocation projectRoot, IWorkspaceFactory workspaceFactory, DevelopmentModel devModel, String workingBasesUniqueBit, String transientsUniqueBit)
   at RedGate.SQLSourceControl.Engine.LinkedDatabaseFactory.CreateLinkedDatabaseInner(ICancellableOperationStatus status, IDatabaseLinkingDetails databaseLinkingDetails)
   at RedGate.SQLSourceControl.Engine.LinkedDatabaseFactory.Get(IDatabaseLinkingDetails databaseLinkingDetails, ICancellableOperationStatus status)
   at RedGate.SQLSourceControl.Engine.Diff.Controller.LinkDatabaseOperationInner(IDatabaseLinkingDetails databaseLinkingDetails, INotifyUserCallbacks connectionCallbacks, Action`1 completedCallback, DatabaseId databaseId, ICancellableOperationStatus status)
   at RedGate.SQLSourceControl.Engine.Diff.Controller.<>c__DisplayClass30_0.<LinkDatabase>b__0()
   at RedGate.SQLSourceControl.Engine.DatabasePolling.DatabasePolling.DatabasePollingManager.<>c__DisplayClass12_0.<RunWithoutBackgroundPolling>b__0()
   at RedGate.SQLSourceControl.Engine.DatabasePolling.DatabasePolling.DatabasePollingManager.RunWithoutBackgroundPolling[T](Func`1 func)
2022-10-24 16:17:06.481 +01:00|Error|RedGate.SQLSourceControl.CommonUI.ErrorHandling.SaErrorReporter|146| Reporting error originally thrown
   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo)
   at System.Environment.get_StackTrace()
   at RedGate.SQLSourceControl.Engine.Utils.ErrorReporting.ErrorReporterBase.Do(Action toDo, Predicate`1 isFatalPredicate, Boolean rethrow)
   at RedGate.SQLSourceControl.CommonUI.ErrorHandling.SaErrorReporter.DoWithObviousExceptionsRethrowAll(Action action)
   at RedGate.SQLSourceControl.CommonUI.WinformsUiTaskRunner.<>c.<WrapOperationAsTask>b__13_0(Action action)
   at RedGate.SQLSourceControl.Engine.Utils.Task.CancellableOperation.<>c__DisplayClass8_0.<WrapAsProgressTask>b__0()
   at RedGate.Shared.Controls.ProgressDialogEx.<>c__DisplayClass82_1.<DoTasks>b__0(Object q)
   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
   at System.Threading.ThreadPoolWorkQueue.Dispatch()
   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
System.InvalidOperationException: Sequence contains no elements
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
   at RedGate.SQLSourceControl.Engine.Utils.IO.ProjectFileUtils.GetProjectFilePath(String rootPath, Boolean allowNonExistent)
   at RedGate.SQLSourceControl.Engine.Utils.IO.ProjectFileUtils.GetRelativeProjectFilePath(String rootPath)
   at RedGate.SQLSourceControl.Engine.LinkedDatabaseFactory.CreateLinkedDatabaseFromExistingRepo(ICancellableOperationStatus status, DatabaseId databaseId, IVisitableSrcCLocation projectRoot, IWorkspaceFactory workspaceFactory, DevelopmentModel devModel, String workingBasesUniqueBit, String transientsUniqueBit)
   at RedGate.SQLSourceControl.Engine.LinkedDatabaseFactory.CreateLinkedDatabaseInner(ICancellableOperationStatus status, IDatabaseLinkingDetails databaseLinkingDetails)
   at RedGate.SQLSourceControl.Engine.LinkedDatabaseFactory.Get(IDatabaseLinkingDetails databaseLinkingDetails, ICancellableOperationStatus status)
   at RedGate.SQLSourceControl.Engine.Diff.Controller.LinkDatabaseOperationInner(IDatabaseLinkingDetails databaseLinkingDetails, INotifyUserCallbacks connectionCallbacks, Action`1 completedCallback, DatabaseId databaseId, ICancellableOperationStatus status)
   at RedGate.SQLSourceControl.Engine.Diff.Controller.<>c__DisplayClass30_0.<LinkDatabase>b__0()
   at RedGate.SQLSourceControl.Engine.DatabasePolling.DatabasePolling.DatabasePollingManager.<>c__DisplayClass12_0.<RunWithoutBackgroundPolling>b__0()
   at RedGate.SQLSourceControl.Engine.DatabasePolling.DatabasePolling.DatabasePollingManager.RunWithoutBackgroundPolling[T](Func`1 func)
   at RedGate.SQLSourceControl.Engine.DatabasePolling.DatabasePolling.DatabasePollingManager.RunWithoutBackgroundPolling(Action action)
   at RedGate.SQLSourceControl.Engine.Diff.Controller.LinkDatabase(IDatabaseLinkingDetails databaseLinkingDetails, Action`1 completedCallback, ICancellableOperationStatus status)
   at RedGate.SQLSourceControl.CommonUI.ViewController.LinkDatabaseAndRefreshBlobs(IDatabaseLinkingDetails databaseLinkingDetails, Action`1 linkingCompleteCallback, ICancellableOperationStatus status)
   at RedGate.SQLSourceControl.CommonUI.ViewController.<>c__DisplayClass44_0.<LinkDatabaseToSourceControl>b__1(ICancellableOperationStatus status)
   at RedGate.SQLSourceControl.Engine.Utils.Task.CancellableOperation.<Invoke>b__9_0()
   at RedGate.SQLSourceControl.Engine.Utils.Task.CancellableOperationBase.PerformAction(Action action)
   at RedGate.SQLSourceControl.Engine.Utils.Task.CancellableOperationBase.InvokeWithTracker(Action action)
   at RedGate.SQLSourceControl.Engine.Utils.Task.CancellableOperation.Invoke()
   at RedGate.SQLSourceControl.Engine.Utils.ErrorReporting.ErrorReporterBase.Do(Action toDo, Predicate`1 isFatalPredicate, Boolean rethrow)
2022-10-24 16:18:48.373 +01:00|Error|RedGate.SQLSourceControl.CommonUI.WinformsUiTaskRunner|1| An exception occurred whilst connecting the database to source control
System.InvalidOperationException: Sequence contains no elements
   at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
   at RedGate.SQLSourceControl.Engine.Utils.IO.ProjectFileUtils.GetProjectFilePath(String rootPath, Boolean allowNonExistent)
   at RedGate.SQLSourceControl.Engine.Utils.IO.ProjectFileUtils.GetRelativeProjectFilePath(String rootPath)
   at RedGate.SQLSourceControl.Engine.LinkedDatabaseFactory.CreateLinkedDatabaseFromExistingRepo(ICancellableOperationStatus status, DatabaseId databaseId, IVisitableSrcCLocation projectRoot, IWorkspaceFactory workspaceFactory, DevelopmentModel devModel, String workingBasesUniqueBit, String transientsUniqueBit)
   at RedGate.SQLSourceControl.Engine.LinkedDatabaseFactory.CreateLinkedDatabaseInner(ICancellableOperationStatus status, IDatabaseLinkingDetails databaseLinkingDetails)
   at RedGate.SQLSourceControl.Engine.LinkedDatabaseFactory.Get(IDatabaseLinkingDetails databaseLinkingDetails, ICancellableOperationStatus status)
   at RedGate.SQLSourceControl.Engine.Diff.Controller.LinkDatabaseOperationInner(IDatabaseLinkingDetails databaseLinkingDetails, INotifyUserCallbacks connectionCallbacks, Action`1 completedCallback, DatabaseId databaseId, ICancellableOperationStatus status)
   at RedGate.SQLSourceControl.Engine.Diff.Controller.<>c__DisplayClass30_0.<LinkDatabase>b__0()
   at RedGate.SQLSourceControl.Engine.DatabasePolling.DatabasePolling.DatabasePollingManager.<>c__DisplayClass12_0.<RunWithoutBackgroundPolling>b__0()
   at RedGate.SQLSourceControl.Engine.DatabasePolling.DatabasePolling.DatabasePollingManager.RunWithoutBackgroundPolling[T](Func`1 func)
   at RedGate.SQLSourceControl.Engine.DatabasePolling.DatabasePolling.DatabasePollingManager.RunWithoutBackgroundPolling(Action action)
   at RedGate.SQLSourceControl.Engine.Diff.Controller.LinkDatabase(IDatabaseLinkingDetails databaseLinkingDetails, Action`1 completedCallback, ICancellableOperationStatus status)
   at RedGate.SQLSourceControl.CommonUI.ViewController.LinkDatabaseAndRefreshBlobs(IDatabaseLinkingDetails databaseLinkingDetails, Action`1 linkingCompleteCallback, ICancellableOperationStatus status)
   at RedGate.SQLSourceControl.CommonUI.ViewController.<>c__DisplayClass44_0.<LinkDatabaseToSourceControl>b__1(ICancellableOperationStatus status)
   at RedGate.SQLSourceControl.Engine.Utils.Task.CancellableOperation.<Invoke>b__9_0()
   at RedGate.SQLSourceControl.Engine.Utils.Task.CancellableOperationBase.PerformAction(Action action)
   at RedGate.SQLSourceControl.Engine.Utils.Task.CancellableOperationBase.InvokeWithTracker(Action action)
   at RedGate.SQLSourceControl.Engine.Utils.Task.CancellableOperation.Invoke()
   at RedGate.SQLSourceControl.Engine.Utils.ErrorReporting.ErrorReporterBase.Do(Action toDo, Predicate`1 isFatalPredicate, Boolean rethrow)
   at RedGate.SQLSourceControl.CommonUI.ErrorHandling.SaErrorReporter.DoWithObviousExceptionsRethrowAll(Action action)
   at RedGate.SQLSourceControl.CommonUI.WinformsUiTaskRunner.<>c.<WrapOperationAsTask>b__13_0(Action action)
   at RedGate.SQLSourceControl.Engine.Utils.Task.CancellableOperation.<>c__DisplayClass8_0.<WrapAsProgressTask>b__0()
   at RedGate.Shared.Controls.ProgressDialogEx.<>c__DisplayClass82_1.<DoTasks>b__0(Object q)

Sign In or Register to comment.