Does Roslyn code fix work with resharper

Answered

I created a Roslyn Analyzer with a matching CodeFixProvider: https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/tutorials/how-to-write-csharp-analyzer-code-fix

This works fine as long as i use visual studio 2019 without Resharper. So when I create code that is found by the analyzer, Visual Studio suggests me with the help of the code fix to correct the code.

Once i enable Resharper, the Visual Studio suggestion are gone and the Resharper suggestions are used, e.g. by pressing Alt + Enter. But my code fix is not shown in the list there. Is this not supported by Resharper?

I`m using Resharper 2021.1.2

6 comments
Comment actions Permalink
Official comment

Hello Arne Held,

Thank you for contacting us.
Could you please check the setting Merge Visual Studio Quick Actions into ReSharper action indicator?
For this, go to ReSharper | Options | Environment | Editor | Visual Studio Features | Merge Visual Studio Quick Actions into ReSharper action indicator. This setting should be enabled.
Also, you can enable the setting Show Visual Studio Quick Actions in submenu. In this case, you can see Roslyn actions in a submenu. It might be more convenient for you.
Let me know if you have any questions.


Comment actions Permalink

That woks :) Thank you

Is there a reason why this is disabled by default?

1
Comment actions Permalink

Hello Arne Held,

Thank you for the answer. Glad to hear!
We try to hide VS functionality if ReSharper has a similar feature (which is usually better), in order to avoid duplication and to make it easier and more convenient for the user.
Unfortunately, there are no formal criteria to distinguish custom Roslyn Analyzers not to hide them automatically.

0
Comment actions Permalink

Elena Kurakina Hi, the merge is not working for me like this.   the only way it works is if i don't hide the VS lightbulb.

 

But if i don't hide the lightbulb it only gives me the VS command when i do CTRL.  Is this a known issue with VS 2022 preview?  Its mildly maddening and is making me lean towards turning resharper of since i really need the Roslyn fixes.

0
Comment actions Permalink

Hello Andri Sigurdsson,

Please accept my apologies for the delay in the reply. Could you please download the latest ReSharper 2022.3.2 here and check how it works for you? Is this issue still happens in a new version? Thank you in advance.

0
Comment actions Permalink
  • 2022.3.2 (not sure, but probably was the same even for previous versions)
  • VS PRO 17.4.4 (latest)

When in VS is enabled "Compute Quick Actions asynchronously", the actions does not appears at all. Once unchecked they appears, but they are unusable (it doesn't make difference if VS lightbulb is hidden or not):

I also noticed the same 2-3 seconds delay before the context menu opens as reported here whatever combination of settings I use (included "Force getting VS quick actions"). Is this something expected? Because in this case I think I'm better off to keep both the indicators separately although it would have been really nice to have all actions integrated into one only indicator.

0

Please sign in to leave a comment.