dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
18.74k stars 3.99k forks source link

ENC tests failed: BreakMode_ModuleDisallowsEditAndContinue and GetDocumentTextChangesAsync #39696

Open dpoeschl opened 4 years ago

dpoeschl commented 4 years ago

Test results here: https://dev.azure.com/dnceng/public/_build/results?buildId=416558&view=ms.vss-test-web.build-test-results-tab&runId=13087564&resultId=131526&paneView=debug

BreakMode_ModuleDisallowsEditAndContinue

Expected:
[17..19): ENC2123: Changes made in project 'Test' will prevent the debug session from continuing: *message*,
[66..67): ENC2123: Changes made in project 'Test' will prevent the debug session from continuing: *message*,
[101..101): ENC2123: Changes made in project 'Test' will prevent the debug session from continuing: *message*,
[136..137): ENC2123: Changes made in project 'Test' will prevent the debug session from continuing: *message*

Actual:
[17..19): ENC2123: Changes made in project 'Test' will prevent the debug session from continuing: *message*,
[37..37): ENC2123: Changes made in project 'Test' will prevent the debug session from continuing: *message*,
[66..67): ENC2123: Changes made in project 'Test' will prevent the debug session from continuing: *message*,
[72..142): ENC2123: Changes made in project 'Test' will prevent the debug session from continuing: *message*
Differences:
    [17..19): ENC2123: Changes made in project 'Test' will prevent the debug session from continuing: *message*,
++> [37..37): ENC2123: Changes made in project 'Test' will prevent the debug session from continuing: *message*,
    [66..67): ENC2123: Changes made in project 'Test' will prevent the debug session from continuing: *message*,
++> [72..142): ENC2123: Changes made in project 'Test' will prevent the debug session from continuing: *message*,
--> [101..101): ENC2123: Changes made in project 'Test' will prevent the debug session from continuing: *message*,
--> [136..137): ENC2123: Changes made in project 'Test' will prevent the debug session from continuing: *message*

Expected: True

Actual: False

GetDocumentTextChangesAsync

Expected:
[17..17) '
',
[64..65) '9',
[98..99) '',
[133..133) '0'

Actual:
[17..17) '
',
[35..103) '',
[132..133) '9',
[137..137) ' System.Console.WriteLine();
 System.Console.WriteLine(30);
'
Differences:
 [17..17) '
',
++> [35..103) '',
++> [132..133) '9',
++> [137..137) ' System.Console.WriteLine();
 System.Console.WriteLine(30);
',
--> [64..65) '9',
--> [98..99) '',
--> [133..133) '0'

Expected: True
Actual: False
tmat commented 4 years ago

Both failures have the same root cause. GetDocumentTextChangesAsync is a trivial test - it just calls SyntaxTree.GetChanges. From the output it seems that this compiler API sometimes returns a different result, which is very odd - I briefly looked at the implementation and don't see any obvious non-determinism. Both the expected and the actual results are valid edit scripts, but it's not clear why we get the "expected" most of the time and "actual" this time around.

@agocke @jcouv Any ideas?

tmat commented 4 years ago

I don't see how this test could fail this way. Moving to backlog in case we see it again.