© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3mo ago•
34 replies
Keyde

Rider - Custom Roslyn Analyzer

Hello!

I wrote a custom Analyzer for Roslyn to show some errors on Rider which works quite well. The goal is to "simply" detect if a method called
EventManager.Attach(EventHook.MyEvent)
EventManager.Attach(EventHook.MyEvent)
was called and if it is : we look for a
EventManager.TriggerEvent(EventHook.MyEvent)
EventManager.TriggerEvent(EventHook.MyEvent)
to check if the generic version was properly used or not (because there is a non-generic version and a generic one)

It works properly to check cross-files and show errors on Rider. However, this line triggers a warning (RS1030 :

var model = compilation.GetSemanticModel(tree);
var model = compilation.GetSemanticModel(tree);


so I tried migrating to a "shared" version with
RegisterCompilationStartAction
RegisterCompilationStartAction
,
RegisterOperationAction
RegisterOperationAction
with 2 pass (to collects
TriggerEvent
TriggerEvent
functions and
Attach
Attach
functions) then displaying the error using
RegisterCompilationEndAction
RegisterCompilationEndAction


While it works well on build, it doesn't show anything on Rider (Rider 2025). Shouldn't Roslyn in Rider do multiple pass to trigger it once a while and then showing errors?
GitHub
roslyn-analyzers/src/Microsoft.CodeAnalysis.Analyzers/Core/CodeAnal...
Contribute to dotnet/roslyn-analyzers development by creating an account on GitHub.
roslyn-analyzers/src/Microsoft.CodeAnalysis.Analyzers/Core/CodeAnal...
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Rider Roslyn Analyzer Not Working (Partially)
C#CC# / help
9mo ago
❔ Roslyn analyzer rules extraction
C#CC# / help
3y ago
✅ Roslyn analyzer: System.Guid only has _dummyPrimitive field?
C#CC# / help
3y ago
❔ Roslyn analyzer test project can't compile `where T : unmanaged` type constraint
C#CC# / help
3y ago