Presentation is loading. Please wait.

Presentation is loading. Please wait.

Statische Code-Analyse mit FxCop & StyleCop ROLAND GRAF SIMON KRANZER.

Similar presentations


Presentation on theme: "Statische Code-Analyse mit FxCop & StyleCop ROLAND GRAF SIMON KRANZER."— Presentation transcript:

1 Statische Code-Analyse mit FxCop & StyleCop ROLAND GRAF SIMON KRANZER

2 Tools  FxCop  FxCop runs against the compiled binaries as a way to understand and enforce the.NET Framework Guidelines for managed code assemblies. FxCop cannot analyze source code and aspects like the proper use of braces, whitespace, or comments.  StyleCop  StyleCop runs against C# source code but cannot analyze VB.NET or another.NET language source code.  Visual Studio 2013  Includes now FxCop and more.

3 FxCop

4 FxCop Rules Assemblies  FxCop erlaubt die Einbindung eigener Rules über Assemblies  Visual Studio bis 2010 Einbindung von FxCop Rules möglich  Gute Dokumentation/Beispiele auf binarycoder.net * FxCop and Code Analysis: Writing Your Own Custom Rules  Hilfestellung der über die Tools  Introspector v1.4 - browse assemblies using the FxCop introspection object model .NET Decompiler wie ILSpy, JustDecompile,.NET Reflector

5 FxCop Rules Assemblies  Erstellung eines FxCop Rules Assembly mit Visual Studio Erstellung eines.NET 4.0 C# Assembly Projects 2. Einbindung der Referenzen auf FxCopSdk.dll und Microsoft.Cci.dll 3. Erstellung einer Rules.xml Datei mit der Beschreibung des Rules 4. Einbindung der Namensräume using Microsoft.FxCop.Sdk; using Microsoft.VisualStudio.CodeAnalysis.Extensibility; 5. Erstellung je einer Klasse pro Rule abgeleitet von der Klasse BaseIntrospectionRule

6 FxCop Rules Assemblies  Erstellung der Rules.xml  Einbindung der Datei als Embedded Resource

7 FxCop Rules Assemblies  Erstellung der Rule-Basisklasse

8 FxCop Rules Assemblies  Erstellung einer Rule-Klasse

9 FxCop Rules Assemblies Debugging in Visual Studio mit FxCop  FxCop 1. Project => Add Rules… 2. Project => Add Targets… 3. Abspeichern als FxCop Project  Visual Studio Project Settings => Debug => Start external program

10 FxCop Rules Assemblies

11 StyleCop  Integration in Visual Studio 2013

12

13 Dynamische Code-Analyse mittels Profiling ROLAND GRAF SIMON KRANZER

14 Tools  Visual Studio 2013  Analyze Performance and Diagnostics  Microsoft PerfView  Collecting Data: CPU Investigation  Collecting Data: Managed Memory Investigation  Collecting Data: Blocked Time Investigation  Tipp: Improving Your App's Performance with PerfView performance-with-perfview.aspx performance-with-perfview.aspx  Tipp: Channel 9 PerfView Tutorials: Tutorialhttp://channel9.msdn.com/Series/PerfView- Tutorial

15 Profiling mit Visual Studio

16

17 PerfView  CPU investigation:  Enables you to diagnose the cause of excessive CPU use:  GC Stats view for understanding the garbage collection costs in your app.  JIT Stats view for understanding the JIT costs in your app.  Provides aggregate call stacks of your app over time.  Helps you quickly sort through all the stack data collected, to find the root cause of a performance issue.  Managed memory investigations:  Enables you to diagnose the cause of excessive memory use.  Provides snapshots of the.NET Framework garbage collection (GC) heap, including large heaps.  GC samples are displayed in the same stack viewer used for stack traces, enabling the same approach to be used to investigate memory use issues.  Blocked time investigations:  Enables you to diagnose and visualize latency issues in your app (for example, waiting on the network).

18 PerfView  Non-invasive collection - suitable for use in live, production environments  Xcopy deployment - copy and run  Memory  Support for very large heaps (gigabytes)  Snapshot diffing  Dump files (.dmp)  CPU Performance  Support for managed, native, and mixed code  Can read XPerf logs  Profile diffing

19 Profiling mit PerfView

20


Download ppt "Statische Code-Analyse mit FxCop & StyleCop ROLAND GRAF SIMON KRANZER."

Similar presentations


Ads by Google