6

In Visual Studio 2015 (after installing the SDK preview), I created a 'diagnostic with code fix' project. The skeleton code is full of interesting types such as DiagnosticAnalyzer (under Microsoft.CodeAnalysis.Diagnostics) and CodeFixProvider (under Microsoft.CodeAnalysis.CodeFixes).

Where can I read the docs for these types? I couldn't find them on msdn. All I found was a different namespace with a confusingly similar name System.Diagnostics.CodeAnalysis .

Ideally msdn would have a full guide to writing a DiagnosticAnalyzer, as well as the usual reference documentation.

Colonel Panic
  • 132,665
  • 89
  • 401
  • 465

3 Answers3

10

These are all Roslyn related, so the best place to look is the Roslyn documentation

It has samples, walkthroughs, FAQ, etc. Specifically here's a PDF file showing How To: Write a C# Diagnostic and Code Fix using a DiagnosticAnalyzer.

MSDN doesn't usually have information on technologies still in preview. I can only guess that until VS 2015 ships all the MSDN articles would be published (but we'll have to wait and see).

enorl76
  • 2,562
  • 1
  • 25
  • 38
i3arnon
  • 113,022
  • 33
  • 324
  • 344
  • 2
    Brilliant thanks. It looks like the API has changed a little since April but that guide should be really helpful. When this is released properly I expect people are going to make a lot of cool stuff. – Colonel Panic Dec 29 '14 at 11:04
  • 1
    Wicked I've got my DiagnosticAnalyzer working without yet a CodeFixProvider. I really like the API. – Colonel Panic Dec 29 '14 at 11:40
1

Roslyn is now moved to https://github.com/dotnet/roslyn

I think still the documentation is not that very great...!

my personal openion

Basav
  • 3,176
  • 1
  • 22
  • 20
1

This is an older question, but the docs have moved Roslyn Wiki A useful example: build a c# analyzer

  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/31628761) – Furkan Öztürk Apr 26 '22 at 16:40