Add custom refactoring pattern using Resharper
Hello :)
I have hundreds occurences of this kind of lines in my app :
public ICommand MyCommandName => ReactiveCommand.Create(TriggerCommand);
I tried without luck to add a Custom Pattern in resharper to change it to :
private ICommand _MyCommandName;
public ICommand MyCommandName => _MyCommandName ??= ReactiveCommand.Create(TriggerCommand);
Here is my pattern :

the pattern is ambiguous and can't be saved. Here are the placeholders :




And if there is a way to do that, how to name the private var without the first capital letter ?
I asked the same question yesterday in StackOverflow :
https://stackoverflow.com/questions/78994506/add-custom-refactoring-pattern-using-resharper
Thanks :)
Please sign in to leave a comment.
Hello Patrick Tellier, I see that you have already found a solution, although without using ReSharper. This looks like a bug,I've submitted a new isue to our bug tracker: RSRP-499375 Unclear "Pattern is ambiguous" error when creating search/replace pattern. Unfortunately, I have not found any workarounds. Please let me know if you have any questions. Thank you!
Hello Maria Pleskunina , Yes I had a workaround in VS. But I subscribe to the bug for the future :)