internal static bool ResetRenameTrackingStateWorker(Workspace workspace, DocumentId documentId, bool visible)
        {
            if (workspace.IsDocumentOpen(documentId))
            {
                var         document = workspace.CurrentSolution.GetDocument(documentId);
                ITextBuffer textBuffer;
                if (document != null &&
                    document.TryGetText(out var text))
                {
                    textBuffer = text.Container.TryGetTextBuffer();
                    if (textBuffer == null)
                    {
                        FailFast.Fail(string.Format("document with name {0} is open but textBuffer is null. Textcontainer is of type {1}. SourceText is: {2}",
                                                    document.Name, text.Container.GetType().FullName, text.ToString()));
                    }

                    if (textBuffer.Properties.TryGetProperty(typeof(StateMachine), out StateMachine stateMachine))
                    {
                        if (visible)
                        {
                            return(stateMachine.ClearVisibleTrackingSession());
                        }
                        else
                        {
                            return(stateMachine.ClearTrackingSession());
                        }
                    }
                }
            }

            return(false);
        }
 internal void WaitUntilCompletion()
 {
     // this shouldn't happen. would like to get some diagnostic
     while (_lowPriorityProcessor._workItemQueue.HasAnyWork)
     {
         FailFast.Fail("How?");
     }
 }
 internal void WaitUntilCompletion_ForTestingPurposesOnly()
 {
     // this shouldn't happen. would like to get some diagnostic
     while (_workItemQueue.HasAnyWork)
     {
         FailFast.Fail("How?");
     }
 }
Exemple #4
0
        public bool WaitIfBlocked(TimeSpan timeout)
        {
            if (_disposed)
            {
                FailFast.Fail("Badness");
            }

            return(_waitHandle.WaitOne(timeout));
        }