Repository: TypeScript
Issue: VS 2019 can't rename anything exported.
Labels: Visual Studio,Needs Investigation

# Bug Report

<!--
  Please fill in each section completely. Thank you!
-->

### 🔎 Search Terms
InlineRename, can't rename.
<!--
  What search terms did you use when trying to find an existing bug report?
  List them here so people in the future can find this one more easily.
-->

### 🕗 Version & Regression Information

Visual Studio Version: 16.8.3
TypeScript Tools: 16.0.21016.2001
TypeScript Version (installed in npm): 3.9.7
Project type GUIDs: {3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{349c5851-65df-11da-9384-00065b846f21};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}
 
I noticed this bug when I created a new project in VS2019. It doesn't appear to happen in my old project.

- This is *not* a crash
- This changed between versions vs2017 and vs2019
- I tried updating vs2019 - the problem was not fixed.
- I was unable to test this on prior versions because I don't think I can download older versions of vs2019.

### 💻 The problem:
Trying to rename any class, interface or variable that is exported from one file and used in any other file works (in that you can type out the new name) but fails to apply. An error shows at the top of the window and the edited property reverts to it's original name with an extra newline inserted where the cursor was.

<!-- Please post the relevant code sample here as well-->
e.g.
```ts
export class RenderOrganiser {
    //... other code
}
```
When I try to use rename to edit it to be:
```ts
export class RenderOrganiserABAB {
    //... other code
}
```
It instead becomes:
```ts
export class RenderOrganiser
 {
    //... other code
}
```
And the following error occurs in the log:



> System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.InvisibleEditor..ctor(IServiceProvider serviceProvider, String filePath, IVsHierarchy hierarchy, Boolean needsSave, Boolean needsUndoDisabled)   at Microsoft.VisualStudio.LanguageServices.RoslynVisualStudioWorkspace.OpenInvisibleEditor(DocumentId documentId)   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.VisualStudioWorkspaceImpl.ApplyTextDocumentChange(DocumentId documentId, SourceText newText)   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.VisualStudioWorkspaceImpl.ApplyDocumentTextChanged(DocumentId documentId, SourceText newText)   at Microsoft.CodeAnalysis.Workspace.ApplyChangedDocument(ProjectChanges projectChanges, DocumentId documentId)   at Microsoft.CodeAnalysis.Workspace.ApplyProjectChanges(ProjectChanges projectChanges)   at Microsoft.CodeAnalysis.Workspace.TryApplyChanges(Solution newSolution, IProgressTracker progressTracker)   at Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem.VisualStudioWorkspaceImpl.TryApplyChanges(Solution newSolution, IProgressTracker progressTracker)   at Microsoft.CodeAnalysis.Workspace.TryApplyChanges(Solution newSolution)   at Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.InlineRenameSession.ApplyRename(Solution newSolution, IWaitContext waitContext)   at Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.InlineRenameSession.CommitCore(IWaitContext waitContext, Boolean previewChanges)   at Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.InlineRenameSession.<>c__DisplayClass78_0.<CommitWorker>b__0(IWaitContext waitContext)   at Microsoft.VisualStudio.LanguageServices.Implementation.Utilities.VisualStudioWaitIndicator.Wait(String title, String message, Boolean allowCancel, Boolean showProgress, Action\`1 action)   at Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.InlineRenameSession.CommitWorker(Boolean previewChanges)   at Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.RenameCommandHandler.ExecuteCommand(ReturnKeyCommandArgs args, CommandExecutionContext context)   at Microsoft.VisualStudio.UI.Text.Commanding.Implementation.EditorCommandHandlerService.<>c__DisplayClass14_1\`1.<ExecuteStartingAtIndex>b__0()   at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.CallExtensionPoint(Object errorSource, Action call, Predicate\`1 exceptionFilter) --- End of stack trace from previous location where exception was thrown ---    at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)