Skip to content

Adding new C# file should result in a new startup file #9

Description

@kzu

Currently, when adding a new C# file to the project, an infobar error shows up and the file does not become the new startup file.

Both may be related, since a non-startup file would be marked as None content and by the time the text buffer is being initialized, it might already have assumed the item would be a Compile item, failing to initialize intellisense properly for it since it was turned into a non-compile item under the editor's feet.

This seems to also cause more or less random disablement of intellisense from that point on, making things less predictable.

So we should just fix our logic and welcome the new file as the new startup file instead :)

Editor exception from VS log
System.ArgumentNullException: Value cannot be null.
Parameter name: filePath

   at Microsoft.VisualStudio.CodeSense.Editor.Roslyn.CodeElementTag..ctor(SyntaxNodeInfo syntaxNodeInfo, String filePath, DocumentId documentId, Workspace workspace, Guid projectGuid)
      at Microsoft.VisualStudio.CodeSense.Editor.Roslyn.CodeElementTagger.GetTag(Int32 lineNumber)
         at Microsoft.VisualStudio.CodeSense.Editor.Tagger`1.<GetTagsCore>d__28.MoveNext()
            at Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.<GetTagsForBuffer>d__47.MoveNext()
            --- End of stack trace from previous location where exception was thrown ---
               at Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions