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.73k stars 3.99k forks source link

Edit and Continue does not pick up null conditional operator on return #17324

Open miloush opened 7 years ago

miloush commented 7 years ago

Version Used: 2.0.0.61413

Steps to Reproduce:

static void Main(string[] args)
{
    string[] tokens = ReturnNull().Split();
}

static string ReturnNull() => null;
  1. Start debugging.
  2. Hit F11 3 times so that you end up in the Main method after ReturnNull has evaluated.
  3. Change the line to ReturnNull()?.Split();
  4. Hit F10

Expected Behavior: the null conditional operator to be applied and the execution continues without exception with tokens being null

Actual Behavior: NullReferenceException

tmat commented 7 years ago

This should rather report a rude edit that a partially evaluated statement can't be updated.

miloush commented 7 years ago

Well, that would kind of make the experience worse, because currently you can set next statement before it and run it again after the edit...