If you can not extract method - here is a solution!

Are you selecting the code within an existing method before right-clicking?

Yes. I mean clicking ‘Quick Actions and Refactorings’ does not lead to any result. Like it simply does not work.

Any chance you can record a short video of the issue and upload it?

Yes, Rob, here it is

hmmm, quite odd…

Some things to try below, in order of severity, but please make a backup of your work before trying them;


  • Close all files
  • Under Solution Explorer, right-click on the Solution and choose Clean solution
  • Repeat, and choose Rebuild solution
  • Close Visual Studio
  • Re-open Visual Studio by double-clicking on a script within Unity
  • Re-test the Extract Method functionality

  • Close all open files and then Visual Studio
  • Re-open Visual Studio
  • Click Tools / Options / Debugging / Symbols / Empty Symbol Cache
    image
  • Close Visual Studio
  • Re-open Visual Studio by double-clicking on a script within Unity
  • Re-test the Extract Method functionality

  • Close Visual Studio
  • Open Console and navigate to Visual installation folder, on my PC this is C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE
  • run devenv.exe /resetsettings
  • Visual Studio will now launch, it may take longer to launch than normal
  • Close Visual Studio
  • Re-open Visual Studio by double-clicking on a script file from within Unity
  • Re-test the Extract Method functionality

Did any of the above help?

I never saw the entire switch statement selected… the video ends before that… you can’t refactor anything less than a complete statement.

all the results are same, JackDraak, even if the whole statement in case :slight_smile:

Rob, thank you! Will try to do it during the day… well if the work traffic lets me get a window. If not, that plan moves to evening, Thank you for detailed instructions!

1 Like

No problem, hope one of these works.

My feeling is that Visual Studio has got itself a little confused with the symbols, as such, what you select and what it thinks is selected are possibly not the same. I think the dialogue window you see that mentions about the caret position is an indication of this. Regarding the Quick Actions and Refactorings, if you look at the bottom left of the screen, on the blue bar it advises you that “No quick actions are available here” - it states this all the way through your video, regardless of what you select.

I’m hoping the more straightforward cleaning/rebuilding approach will resolve this but if not, the other two approaches may work.

Just as a little note on the /resetuserdata, this is a little more destructive and will affect any IDE configuration you’ve made, including plugins, you may want to read up on this specifically before trying it.

I was about to provide you a link but discovered that the above was for the 2015 version of Visual Studio, the parameter to use is actually, /resetsettings, as such, I’ve updated my earlier post and there’s a link below for you.


See also;

Rob I tried 2 methods. But there is one that is not clear. I need screen to screen instructions.
Please understand, I’m not very skilled computer user. I spent some time to recall how to run ‘RUN’ and there run ‘cmd’ and from the 3rd attempt I recalled command cd.

So here is solution that I can not perform.

  • Close all files
  • Under Solution Explorer, right-click on the Solution and choose Clean solution
  • Repeat, and choose Rebuild solution
  • Close Visual Studio
  • Re-open Visual Studio by double-clicking on a script within Unity
  • Re-test the Extract Method functionality

The problem is on stage of 2nd dot.

I found ‘Solution Explorer’ with no problem.
But where to click RMB and choose ‘Clean solution’?

Thank you.

I found alternative way to settle.

Thank you all, guys!

1 Like

Hi,

You need to right click on the actual solution itself, the context menu then displays options to both Clean and Rebuild. Cleaning clears all of the temporary and cached files that are generated, so if any of the debugging information has become corrupted, this is a good way to get rid of it.

Here’s a little video showing how to do it. At the start I show how to view the solution as opposed to the directory in which the solution lives. I’ve only recorded the corner of the screen, but if you watch the console when you first Clean and subsequently Rebuild you will see it outputs some information and tells you whether it was successful or not.

Glad you have got this working, although the other menu should launch the same process, rather than you having to add a specific button yourself. Perhaps the issue has cleared and if you try the original method again it will work?

Will try but seems it does not work… only in matter I discovered, Thanks, Rob! Keep going ahead!

That seems quite strange.

Does the keyboard short-cut work if you use that, I think its CTRL + M?

Rob, unfortunately it does not work. As you may guess I permanently switch between 2 languages. Russian and English. Not all the software can react the same way on short-cuts. Well, Adobe Creative Cloud apps yes. Other apps are not so ‘clever’.

By the way thank you for cleaning up my code pages in this forum. I don’t know why it causes break when copy-paste action applied.

I wonder if perhaps the languages differences have anything to do with it? Would seem odd, I assume the keyboard short-cuts would simply re-map, alas I have no knowledge of the Russian language so wouldn’t be able to help much on that one.

No worries with regards to tidying up the code, as a heads-up, insert three ``` characters before and after the code you paste in and the forum will apply code formatting for you, it’s really easy and it makes it a lot easier to read, both for yourself and for other :slight_smile:


See also;

Will do my best, Rob!
Thank you. Now it’s time to spread attention on some other things. Need to fix some issues in re-topology of living hub module for alpha-version that we develop :slight_smile:

1 Like

Enjoy :slight_smile:

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms