12 Program Challenge update #4 Chain Analyzer PoC

This month is crazy for me. If you have seen my last few posts I was quite occupied. But That doesn’t mean I wasn’t paying attention to the challenge.

Its time for progress update on Chain Analyzer!

A lot of reading the theory.

I won’t lie that it is the hardest project I have ever tried.
Hover, this adventure is good practical example of how I learn!
Roslyn is a complicated subject because of how close it lives to the compiler. If you have seen any of my presentations about how selenium works I quite often finish with saying „we won’t go deeper – this is formal languages land, and it is a dark place.”

Thing is I am glad I had that subject on my studies- this was the only reason why I was able to grasp what is going on here.
I’ve done the first Tutorial on ms page, Which showed me how the terminology here is different from regular c# code.

Mind Map with some of my notes

Which lead me into land on documentation – Syntax Trees, nodes, tokens, trivia and much much more. But it was worth it.

PoC is ready!

Here is link to NuGet if you want to check it out (its called Chain Analyzer).

screen shot of proper behavior
Too long chain highlighted

For now, it works well on simple case ergo no methods that use parameters.
You should see code highlighted in Visual Studio and information in the warnings section.

The bug

Example of false positive chain is proper length put was highlighted due to issue dots in method calls – fixing in progress.

I am aware of one issue if there parameterised method, it could wrongly count it. This is an excellent example of why TDD is hard. While preparing unit tests, I haven’t thought about such a case.

Whats next?

  1. Fix pipeline it uses wrong repo.
  2. Fix an issue with parameters.
  3. Add a page with an explanation of fixes;
  4. Make better warning messages.
  5. Find out how message suppression works.
  6. Add more features.

That all for now!

Dodaj komentarz