diagnostic analyzers in visual studio 2015

20
Damir Arh, Adacta d.o.o. MVP - .NET @Damir Arh http://www.damirscorner.com Diagnostični analizatorji v Visual Studiu 2015

Upload: damir-arh

Post on 23-Jul-2015

448 views

Category:

Technology


1 download

TRANSCRIPT

Damir Arh, Adacta d.o.o.MVP - .NET@Damir Arhhttp://www.damirscorner.com

Diagnostični analizatorji v Visual Studiu 2015

Diagnostični analizator?

Kako?

Zakaj?

Kaj?

.NET Compiler Platform

Formatter

Colorizer

Outlining

Navigate To

Object Browser

Completion List

Find

All Reference

s

Rename

Quick Info

Signature Help

Extract

Method

Go To Definition

Edit

and

Continue

Syntax Tree API Symbol API Binding and

Analysis API Emit API

Parser

Symbols

Binder IL EmitterMetadata

Import

Language

Service

Compiler API

Compiler

Pipeline

Kaj?

FxCop Analyzers

Demo

NuGetVezano na projektZa vse razvijalce

Načini distribucije

VSIXZa vse projekteVezano na razvijalca

Uporabnost analizatorjev

Zahtevana programska opremahttp://bit.ly/VS2015rc http://bit.ly/VS2015SDKrc http://bit.ly/RoslynSdkTemplatesRc http://bit.ly/RoslynSyntaxVisualizerRc

Predloga za diagnostični analizatorDemo

using System.Text.RegularExpressions; namespace RegExSample{ public class Class1 { public void Foo() { Regex.Match("", "["); } }}

Preverjanje regularnih izrazov

Roslyn Syntax Visualizer

Demo

Sintaktično drevo

InvocationExpression

SimpleMemberAccessExpression

IdentifierName

Regex

WhitespaceTrivia

. IdentifierName

Match

ArgumentList

( Argument

StringLiteralExpression

""

,

WhitespaceTrivia

Argument

StringLiteralExpression

"["

)

Implementacija analizatorja

Demo

Strukturiranje izvorne kodeWorkspac

e

SolutionSolution

ProjectProject

MetadataReferenc

e

MetadataReferenc

eDocumen

tDocumen

t ImmutableArray<Diagnostic>

CompilationWithAnalyzersGetAnalyzerDiagnosticsAsync()

CompilationWithAnalyzers()

ProjectGetCompilationAsync()

Testno ogrodje

Demo

• Prevajalnik kot storitev• Prenovljen urejevalnik• Lažje dostopna analiza kode• Avtomatični popravki

Oživitev dokumentov s pravili kodiranja

Veliko novosti

© 2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.