debugging your way through .net with visual studio 2015

31
Debugging Your Way through .NET with Visual Studio 2015 Ido Flatow Senior Architect Microsoft MVP & RD Sela Group

Upload: ido-flatow

Post on 06-Jan-2017

141 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Debugging your Way through .NET with Visual Studio 2015

Debugging Your Way through .NET with Visual

Studio 2015Ido Flatow

Senior ArchitectMicrosoft MVP & RD

Sela Group

Page 2: Debugging your Way through .NET with Visual Studio 2015

A Slide on Debugging

Page 3: Debugging your Way through .NET with Visual Studio 2015

Start with the Basics?

Page 4: Debugging your Way through .NET with Visual Studio 2015

Debug Windows (1)• Data Tips

• Locals / Auto

Page 5: Debugging your Way through .NET with Visual Studio 2015

Debug Windows (2)• Quick Watch

• Watch

Page 6: Debugging your Way through .NET with Visual Studio 2015

Debug Windows (3)• Call Stack

• Immediate

Page 7: Debugging your Way through .NET with Visual Studio 2015

VISUAL STUDIO 2015 NEW DEBUGGING FEATURES

Page 8: Debugging your Way through .NET with Visual Studio 2015

Breakpoint Settings Window• Two new icons appear with breakpoint

• Settings opens a Peek window

Page 9: Debugging your Way through .NET with Visual Studio 2015

Lambda in Debug Windows• Watch & Immediate window support

lambda expressions• Rebuilt on top of the “Roslyn” compilers

Page 10: Debugging your Way through .NET with Visual Studio 2015

PerfTips• Performance Information at-a-glance • Excludes major debugger related overhead

– Time stopped under debugger– Symbol loading

• Suitable for order of magnitude measurements

Page 11: Debugging your Way through .NET with Visual Studio 2015

Diagnostics Tool Window• Just hit F5• Memory and CPU usage graphs• IntelliTrace UI is now part of the

window• Take memory snapshots and

profile CPU usage• Time sections of code with

PerfTips

Page 12: Debugging your Way through .NET with Visual Studio 2015

Diagnostics Tool WindowCPU Usage

• Shows CPU utilization across all cores• Turn on CPU profiling while debugging to

get usage breakdown by function• Available after debugging

session has stopped

Page 13: Debugging your Way through .NET with Visual Studio 2015

Diagnostics Tool Window Memory Usage• Monitors memory usage of your app• Can show native and managed heaps• Take snapshots of your memory• Ignores time spent in breakpoints• Informs you when GC was activated and why

Page 14: Debugging your Way through .NET with Visual Studio 2015

Diagnostics Tool Window Memory Usage – Cntd.• Use memory snapshots to inspect the heap and to find memory leaks

– Watch which objects were added, and their size– Track object paths to its root

Page 15: Debugging your Way through .NET with Visual Studio 2015

DEMOVisual Studio 2015 Debug Features

Page 16: Debugging your Way through .NET with Visual Studio 2015

DIAGNOSTICS HUBPROFILERS

Page 17: Debugging your Way through .NET with Visual Studio 2015

The Unified Diagnostics Hub• Shipped with VS 2013 (update 2)• Pick a target and choose the tools that work best• Runs without a debugger attached• Windows Desktop, Store, UWP. No ASP.NET

Page 18: Debugging your Way through .NET with Visual Studio 2015

What’s on the Hub?• Breakdown of the UI thread performance• Windows desktop, Windows Store, UWPApplication Timeline

• HTTP usage and performance• UWP onlyNetwork Usage

• Which code uses the most CPU• Any managed code, except ASP.NETCPU Usage

• How the application makes use of the GPU• Windows desktop, Windows Store, UWPGPU Usage

• Monitor memory usage, and take snapshots• Any managed code, except ASP.NETMemory Usage

VS 2

015

VS 2

013

Page 19: Debugging your Way through .NET with Visual Studio 2015

Diagnostic Hub Profilers

Page 20: Debugging your Way through .NET with Visual Studio 2015

YE OLDE PROFILERS

Page 21: Debugging your Way through .NET with Visual Studio 2015

Who Moved my Profilers?• Under the Analyze menu in VS 2010• Gone into hiding in VS 2013• Still in hiding in VS 2015

Page 22: Debugging your Way through .NET with Visual Studio 2015

The Visual Studio Profilers• Same good old profilers• Can run as stand-alone from the command-line

Sampling• CPU-bound apps, very low overhead• Full program stacks (including all system DLLs)

Instrumentation• I/O-bound apps, CPU-bound apps, higher overhead• More detailed timing data, limited stacks (just my code)

Allocations• Details on who allocated and what• Managed code only

Page 23: Debugging your Way through .NET with Visual Studio 2015

Concurrency Visualizer• Analyze the application’s

concurrency characteristics– CPU utilization– Thread blocking and migration– Resource contention

• Downloadable as a Visual Studio Extension

http://bit.ly/2a5kbay

Page 24: Debugging your Way through .NET with Visual Studio 2015

DEMOThe good old profilers

Page 25: Debugging your Way through .NET with Visual Studio 2015

DEBUGGING ASYNC CODE

Page 26: Debugging your Way through .NET with Visual Studio 2015

Parallel Watch• Simultaneously display the value an

expression holds on multiple threads

Page 27: Debugging your Way through .NET with Visual Studio 2015

Parallel Tasks• Tasks can be grouped/ungrouped• Hierarchical view of parent-child relationships

Simple Flat view

Group by status

Parent Child view

Page 28: Debugging your Way through .NET with Visual Studio 2015

Parallel Stacks• Visualizes multiple call stacks (works for tasks

and threads)

Synchronized

Page 29: Debugging your Way through .NET with Visual Studio 2015

DEMODebugging Async Code

Page 30: Debugging your Way through .NET with Visual Studio 2015

Resources• Visual Studio blogs

– https://blogs.msdn.microsoft.com/visualstudio– https://blogs.msdn.microsoft.com/visualstudioalm

• Suggestions and vote– http://visualstudio.uservoice.com

• Articles– http://bit.ly/29mIJfu (async debug)– http://bit.ly/29tuj08 (concurrency visualizer)– http://bit.ly/1IZOds9 (diagnostic tools)

• Videos– http://bit.ly/1MGWMuB – http://bit.ly/1Le96gs

• My Info– [email protected] // @idoflatow // http://www.idoflatow.net/downloads

Page 31: Debugging your Way through .NET with Visual Studio 2015

Thanks!Questions?