debugging tricks you wish you knew - tamir dresher

32
1 Tamir Dresher Senior Software Architect J Debugging tricks you wish you knew

Upload: tamir-dresher

Post on 12-Apr-2017

171 views

Category:

Software


3 download

TRANSCRIPT

Page 1: Debugging tricks you wish you knew  - Tamir Dresher

1

Tamir DresherSenior Software ArchitectJ

Debugging tricks you wish you knew

Page 2: Debugging tricks you wish you knew  - Tamir Dresher

Debugging is a time-travel

2

Page 3: Debugging tricks you wish you knew  - Tamir Dresher

333

• Software architect, consultant and instructor• Software Engineering Lecturer @ Ruppin Academic Center• Reactive Extensions in .NET (Manning)

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

About Me

Page 4: Debugging tricks you wish you knew  - Tamir Dresher

Agenda

BreakpointsComparing object while debuggingExceptionsDebugging Multithreaded ApplicationsPost-mortum debuggingDebugging LINQ

4

Page 5: Debugging tricks you wish you knew  - Tamir Dresher

Breakpoints

5

Page 6: Debugging tricks you wish you knew  - Tamir Dresher

Setting New Breakpoints

6

Page 7: Debugging tricks you wish you knew  - Tamir Dresher

Method Breakpoints

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

7

Page 8: Debugging tricks you wish you knew  - Tamir Dresher

Conditional Breakpoints

8

Page 9: Debugging tricks you wish you knew  - Tamir Dresher

Conditional Breakpoints (OzCode)

9

invoice.Id 915486 intinvoice.Id 915486 int

Page 10: Debugging tricks you wish you knew  - Tamir Dresher

Comparing Instances

10

Page 11: Debugging tricks you wish you knew  - Tamir Dresher

Make object ID

The object is later available in every watch window

11

Page 12: Debugging tricks you wish you knew  - Tamir Dresher

OzCode Comapre

12

Page 13: Debugging tricks you wish you knew  - Tamir Dresher

Exception

13

Page 14: Debugging tricks you wish you knew  - Tamir Dresher

First Chance Exceptions

Breaking when thrown

OzCode makes it easier

14

Page 15: Debugging tricks you wish you knew  - Tamir Dresher

Predicting the future

Predict

15

Page 16: Debugging tricks you wish you knew  - Tamir Dresher

Multithreading

16

Page 17: Debugging tricks you wish you knew  - Tamir Dresher

Staying on the same thread (freezing other threads)

17

Page 18: Debugging tricks you wish you knew  - Tamir Dresher

Tracepoints (VS)

a.k.a Printf(…) debugging

18

Page 19: Debugging tricks you wish you knew  - Tamir Dresher

Tracepoints (OzCode)

19

Page 20: Debugging tricks you wish you knew  - Tamir Dresher

Show All Instances

20

Page 21: Debugging tricks you wish you knew  - Tamir Dresher

Finding Tasks Deadlocks

Debug –> windows –> Tasks

21

Page 22: Debugging tricks you wish you knew  - Tamir Dresher

Post-Mortem Debugging

22

Page 23: Debugging tricks you wish you knew  - Tamir Dresher

23

Automatic Dump Creation

To enable it, set the reg key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps

DumpFolder – Location for the output dumpsDumpCount – Maximum amount of dumps in the folderDumpType

1 – Mini Dump2 – Full Dump0 – Custom Dump

CustomDumpFlags – if DumpType is 0, set the dump options

Page 24: Debugging tricks you wish you knew  - Tamir Dresher

Debugging using the Dump (1)

24

Page 25: Debugging tricks you wish you knew  - Tamir Dresher

Debugging using the Dump (2)

25

Page 26: Debugging tricks you wish you knew  - Tamir Dresher

Debugging *.exe Files

26

Page 27: Debugging tricks you wish you knew  - Tamir Dresher

LINQ

27

Page 28: Debugging tricks you wish you knew  - Tamir Dresher

LINQ Debugging

28

Page 29: Debugging tricks you wish you knew  - Tamir Dresher

Export

29

Page 30: Debugging tricks you wish you knew  - Tamir Dresher

Custom Expressions

30

Page 31: Debugging tricks you wish you knew  - Tamir Dresher

Give it a try

https://github.com/oz-code/OzCodeDemo

Page 32: Debugging tricks you wish you knew  - Tamir Dresher

32 32

Presenter contact detailst: @tamir_dreshere: [email protected]: TamirDresher.comw: www.codevalue.net

manning.com/dresherDiscount code: dreshermu

Discount code: CPH_50