0

My CodeFix returns a Document and I can trace it through Roslyn until GetChangeSolutionAsync. When I view in debugger ChangedDocument has a Document with the correct text. But the next line compares ChangedDocument == null and it is null and exits the routine returning null instead of my document.

I have stepped through GetChangedSoultionAsync and see it returning the correct value in the debugger but then see it return with null

       protected async virtual Task<Solution> GetChangedSolutionAsync(CancellationToken cancellationToken)
        {
            var changedDocument = await GetChangedDocumentAsync(cancellationToken).ConfigureAwait(false);
            if (changedDocument == null)
            {
                return null;
            }

            return changedDocument.Project.Solution;
        }

In debugger changedDocument after the await is shown below

?changedDocument Test0.vb DocumentState: {Microsoft.CodeAnalysis.DocumentState} FilePath: null Id: (DocumentId, #860a1da9-991f-4262-9428-c50c7a9a912e - Test0.vb) Name: "Test0.vb" Project: TestProject Services: {Microsoft.CodeAnalysis.DefaultTextDocumentServiceProvider} SourceCodeKind: Regular State: {Microsoft.CodeAnalysis.DocumentState} But the if statement is true and the function returns null

Paul Cohen
  • 241
  • 4
  • 14
  • After a lot more debugging found what leads to above issue – Paul Cohen Apr 15 '19 at 01:15
  • I rolled back to a working version and when I upgrade Roslyn from 2.4 to 2.9 it breaks without changing any of my code. Is there a list of breaking changes for Roslyn CodeAnalysis? – Paul Cohen Apr 17 '19 at 03:27

0 Answers0