-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"Unexpected Null" dialog (and consequences) in Visual Studio when using Refactor, Extract Method #7364
Comments
Closing, cant repro after restarting VS. |
I get this all the time. It seems to happen only when the code is in a broken state. Once this does happen, only a VS restart will fix it.. I will try and nail down a concrete reproduction. |
Seconded. Appears to occur when you have the code in a broken state. Even if fixing the compilation error prior to doing the rename, this often occurs as a result. Difficult to say if the 'previous bad state' is a principle cause though. This also frequently occurs on Refactor Rename. |
I can close the solution and re-open the solution and get it working again. |
Same thing is happening to me. I'm using the following version of Visual Studio: Microsoft Visual Studio Community 2015 |
Same here. |
Some more details, don't know if this helps... Microsoft Visual Studio Professional 2015 Opened a WinForms control designer, started changing some lambda expressions in the codebehind - at that point, the intellisense was already starting to act strangely (probably not working at all). I pressed F2 to rename a variable that was in non-lambda procedural code. Got the "Unexpected null" dialog. I managed to catch the original exception that results in this dialog, see the stack trace below. When I closed the codebehind file and reopened it, I got the file as read-only. But - when I closed both the winforms designer and the codebehind file and opened the codebehind, it resumed working... So no need to restart VS this time. Here's the stack trace:
|
@dpoeschl can you take a look here? |
Happened for me when trying refactor - rename on a local function (winforms app, currently in a non-compiling state). Had to restart to fix (making it compile without a restart didn't fix). |
+1 Irritating as hell. |
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. |
Mondo escrow triage: keeping this in 15.3, given the number of reports. |
+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 |
That last submission on Developer Community was mine. In answer to your comment, paradoxically I can't give you steps for repro or a solution that exhibits the problem though it does happen to me reliably. By reliably I mean it will fail precisely when I need to use it in a real-world work situation but never when I'm testing to see if it the function is broken. |
+1 v15.4.2, happens consistently several times per day, VS restart required. |
Getting this multiple times a day - 15.4.2. Large .net core project, fresh install. Have to restart visual studio. Also get the IDE exiting rename mode by itself while typing. |
15.4.5 on Ctrl+R,Ctrl+R Restarted VS and no issues. |
I'm getting this problem in VS 2017 15.4.5 when attempting to rename variables (F2 / Ctrl+R,Ctrl+R). Restarting Visual Studio does NOT solve the problem for me. I'm using CodeRush for Roslyn. Disabling that extension is the only consistent way to regain F2 rename functionality. Rename capability occasionally returns while CodeRush is enabled, but it is never linked to a VS restart. |
Ever since the latest update (15.5.2) I've been getting this error more frequently. |
15.5.4 and up (15.5.6 now) has been the first ever occurrences of this error for me. It's quite frequent, actually. |
* Add null check for textSnapshot Fixes #7364 * Respond to feedback Changed from return to continue and added a non fatal exception * respond to feedback Moved NullTextBufferException to InlineRenameSession and added SourceText.
Fix available in 15.6. Preview6 + |
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: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.
The text was updated successfully, but these errors were encountered: