Search code examples
razorblazorresharperblazor-webassemblyref

Blazor: @ref usage confuses visual studio. How to ignore?


Whenever I use the @ref syntax in blazor, visual studio gives me a ton of green underlines on my blazor components that use @ref.

Is there a way to disable this warning? Is it resharper maybe?

Example image here: https://i.sstatic.net/EKkdo.jpg


Solution

  • The cause is your _tableRef is non-nullable. Try adding a ? :

    
    @code {
        ProjectUserJobRolesTable? _tableRef;
    }
    

    Before:

    enter image description here

    After:

    enter image description here