It's Theme Week again, with this week's theme the awesome courses that are available free from the Microsoft Virtual Academy.
I've highlighted the new Analyzers and Refactoring capabilities of the .NET Compiler Platform (fka Roslyn) a number of times. Now Bill Wagner and Jennifer Marsman have created an entire 5+ hour course on teaching you how to build them!
Do you know the difference between a syntax model and a syntactic model? You probably do, but you will still want to check out this exploration of the new Roslyn-based compilers in the upcoming release of Visual Studio! Help your team grow great coding habits, with this set of APIs that you can use to build automated tools to find and fix common coding mistakes. Plus, learn how to analyze code during development and create automated fixes for common poor practices.
Watch MVP and best-selling author Bill Wagner and Microsoft Principal Developer Evangelist Jennifer Marsman (named the "Techie whose innovation will have the biggest impact") for a demo-filled exploration of analyzers and code fixes. Examine nodes for poor practices, register fixes to correct mistakes, and learn to report errors and warnings with different levels of severity. Look at ways to express your designs in C#, and explore unit testing. Finally, hear about the different approaches to releasing your analyzer, including adding it to open source libraries.
(NOTE: Be sure to check out Jennifer's Channel 9 videos.)
1 | Introduction to Analyzers
See what you can build and how analyzers and code fixes are structured. Create a new analyzer with a code fix, go over all the code that has been generated by the templates, and look at unit tests.
2 | Analyzing Code
Go through the code necessary to find poor coding practices. Find out how to register your analyzer so that it is only called for particular syntax nodes (to limit the kinds of code you look for).
3 | Fixing Code
As the next step, write the code that corrects the mistake. The code fix will be called when the user wants to correct the mistake identified by the analyzer written in the previous module.
4 | Errors, Warnings, and Other Settings
See how to specify different importance to your code fixes: from errors and warnings all the way to hidden, which are available only when the user asks for them, and find out how they are registered.
5 | Testing and Unit Testing
Learn about different ways to express your designs in C# and how that leads to a large number of permutations in the code an analyzer should find, which results in a heavy emphasis on unit testing.
6 | NuGet-Based Analyzers
Take a look at different approaches to releasing your analyzer (as an extension to Visual Studio or as a NuGet package). NuGet-based analyzers are specific to a project and run on command line builds.
- Get an introduction to analyzers and code fixes.
- Fix code.
- Analyze code.
- Handle errors and warnings.
- Implement NuGet-based analyzers.
- Implement test routines.
Experience writing analyzers and code fixes. To best follow along with the demonstrations, please download (free) Visual Studio Community Edition.
Time requirements, modules, assessments and points for this course:
5 hours* 6 modules 6 assessment 84 points (*Excluding labs, knowledge checks and assessments.)
And here’s a few more links you might find interesting:
- Preview v2.0 Refactoring Essentials now...
- Refactoring Essentials - Open Source, Cross Platform Refactoring and Analyzers
- Here's your 6 Pack for New Year's Eve... "NR6Pack for Visual Studio 2015"
- Analyze This, Analyze That, Writing .NET Code Analyzers and Fixers
- The future of .NET, today. The .NET Compiler Platform
Comments have been closed since this content was published more than 30 days ago, but if you'd like to send us feedback you can Contact Us.