Rider suggests making functions static even though they use @injected instance data

When for instance using @inject NavigationManager navMgr in a .razor page
and using that instance in a function in the .razor.cs file like

private void SomeFunction()
{
    navMgr.NavigateTo(someUrl);
}

Rider wants to make that function static.

2 comments
Comment actions Permalink

Hi Roland Schoofs

Thank you for contacting us. I'm not sure I was able to reproduce the issue. What Rider version do you use? 

Could you please provide a small sample solution with repro? 

Thank you in advance! 

0
Comment actions Permalink

JetBrains Rider 2021.2
Build #RD-212.4746.113, built on July 30, 2021
Runtime version: 11.0.11+9-b1504.13 amd64
VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
.NET Framework 4.0.30319.42000

I'll see about that repo. Maybe later today.

0

Please sign in to leave a comment.