net debugging tricks you wish you knew tamir dresher

63
1 Tamir Dresher Senior Software Architect J Debugging tricks you wish you knew https://oz-code.com

Upload: tamir-dresher

Post on 12-Apr-2017

92 views

Category:

Software


2 download

TRANSCRIPT

Slide 1

Tamir DresherSenior Software ArchitectJ

Debugging tricks you wish you knew

https://oz-code.com

#

1

Debugging is a time-travel

2

2

3Author of Rx.NET in Action (manning publications)Software architect, consultant and instructorSoftware Engineering Lecturer @ Ruppin Academic CenterOzCode Evangelist

@[email protected]://www.TamirDresher.com.

About Me

My name is tamir dresherIm an architect from codevalue israel and a software engineering lecturer at the ruppin academic centerCodeValue is a consulting company and we are also the proud development center of OzCode the amazing debugging extension for visual studio. We have a booth here at conference, so please go and check it out, youll be amazed how you lived without it.My book Rx in action is now available at Manning early access program should be published in the next few months.And that the end of my self promotion(it never hurts right?).

So what are we really here for?

3

AgendaDebugging a real-life problemTips and TricksExceptionsBreakpoints (JustMyCode, External Code)Debugging Multithreaded ApplicationsSymbolsPost-mortem & Production DebuggingDebugging LINQ (if time allows)

4

Breakpointsconditional breakpointsComparing object while debuggingObject IDsOzCode CompareExceptionsBreaking on exceptionsConditional exceptions breakDebugging Multithreaded ApplicationsFreezing debugging to the current threaddetecting deadlocked tasksUsing tracepointsFinding an object and seeing all object of certain type while debuggingDebugging LINQPost-mortum debuggingDumps

4

5The following events are based on a true story

Demo application ToDo Items in Notebooks

6

Basic usage demo

7

Export and Import

8

The import bug

9

Mastering exceptions

10

Mastering exceptions Catching ALL exceptions

11

12

13

14

15

16

17

17

18

19

19

20

21

22

23

Finding the bug in the code (1)

24

Finding the bug in the code (2)25

Finding the bug in the code (3)26

Assemblies Load Failures

27

Why cant it load the refence assembly?

28

Fusion log view - FuslogvwAssembly Binding Log ViewerSet the registry keys under: HKLM\Software\Microsoft\Fusion

29

procmon

30

Breakpoints

31

Method BreakpointsIf you type a method name (without class name)VS select all that matches

32

Conditional Breakpoints

33

Conditional Breakpoints (OzCode)

34

invoice.Id915486intinvoice.Id915486int

Object Tracking Story

35

Multithreading

36

Staying on the same thread (freezing other threads)

37

Tracepoints (VS)a.k.a Printf() debugging38

Tracepoints (OzCode)

39

Show All Instances

40

Finding Tasks DeadlocksDebug > windows > Tasks41

Production Time and Post-Mortem Debugging

42

43

Backgammon failure43

44

Debugging an exe44

Debugging *.exe Files

45

VS Crash

46

Debugging VS

47

Attaching and Debugging VS47

Attaching to VS

48

Attaching to VS49

Dumps

50

51

Taking and debugging the dump51

Automatic Dump CreationTo enable it, set the reg key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumpsDumpFolder Location for the output dumpsDumpCount Maximum amount of dumps in the folderDumpType 1 Mini Dump2 Full Dump0 Custom DumpCustomDumpFlags if DumpType is 0, set the dump options52

52

Debugging the Dump (1)

53

Debugging the Dump (2)

54

LINQ

55

LINQ Debugging

56

AgendaDebugging a real-life problemTips and TricksExceptionsBreakpoints (JustMyCode, External Code)Debugging Multithreaded ApplicationsSymbolsPost-mortem & Production DebuggingDebugging LINQ (if time allows)

57

Breakpointsconditional breakpointsComparing object while debuggingObject IDsOzCode CompareExceptionsBreaking on exceptionsConditional exceptions breakDebugging Multithreaded ApplicationsFreezing debugging to the current threaddetecting deadlocked tasksUsing tracepointsFinding an object and seeing all object of certain type while debuggingDebugging LINQPost-mortum debuggingDumps

57

Thanks! Tamir Dresher Senior Architect @tamir_dresher http://www.tamirdresher.com http://oz-code.com

manning.com/dresher

58

Export

59

Custom Expressions60

items.Where(i=>i.tags.Contains(swift)).ToList()60

Give it a tryhttps://github.com/oz-code/OzCodeDemo

61

Predicting the futurePredict62

Comparing Instances

63

Make object ID

The object is later available in every watch window64

OzCode Comapre

65