New component released: Catel.Analyzers

A while back, we discovered an issue with the DispatcherService.InvokeAsync implementation when an async method / expression was passed in as parameter. We fixed this by adding an alternative method called  DispatcherService.InvokeTaskAsync. Unfortunately, we could not simply remove / change the behavior of the InvokeAsync because it would be a breaking change (and we are not ready for a breaking change release yet).

So we had a few considerations:

1. Mark the member obsolete => not possible because there is still valid use for this member, it should just not be abused.

2. Add warnings / code checking to Catel.Fody => great plan

Then after a while…

3. Create Catel.Analyzers as official Roslyn analyzer and actually use Roslyn to allow analyzers (and in the future code fixers)

After some great help from Johan Larsson (developer of the WpfAnalyzers analyzer), we have a first version ready that shows a compilation error whenever DispatcherService.InvokeAsync is used incorrectly:

image

What are you waiting for? Go install the analyzer via NuGet!