roslyn: "Unexpected Null" dialog (and consequences) in Visual Studio when using Refactor, Extract Method
Repro in VS2015 Update 1 (not sure if others are affected):
In src\Compilers\CSharp\Portable\Binder\Binder_Symbols.cs
, add the following on line 1835:
void Foo(
Now select the ternary expression just above it (between return
and ;
). Do Refactor, Extract Method.
An error dialog appears, stating ‘Unexpected Null’.
Close the dialog, and open another a file. This file’s editor is now seemingly readonly (till you close and re-open again).
Not sure if this is caused by Roslyn.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Reactions: 16
- Comments: 35 (9 by maintainers)
Commits related to this issue
- Add null check for textSnapshot Fixes #7364 — committed to chborl/roslyn by chborl 6 years ago
- Add null check for textSnapshot (#24693) * Add null check for textSnapshot Fixes #7364 * Respond to feedback Changed from return to continue and added a non fatal exception * respond to f... — committed to dotnet/roslyn by chborl 6 years ago
+1 for VS 15.2 (26430.15). Same as above: break seems to be related to non-compiling intermediate code-state, reboot fixes. Not noted above: workaround editing the name and then using “Show potential fixes” (Ctrl-.) and selecting “rename ‘old’ to ‘new’” keeps working.
+1 v15.4.2, happens consistently several times per day, VS restart required.
I can close the solution and re-open the solution and get it working again.
Mondo escrow triage: keeping this in 15.3, given the number of reports.
I have gotten this error in VS 2015 Enterprise and now in VS 2017 Enterprise. It appears to be after other changes have been made to the code. Exiting and restarting VS resolves the issue but it should be fixed.