Spaghetti gate
-
Upload
jon-bachelor -
Category
Technology
-
view
551 -
download
0
description
Transcript of Spaghetti gate
You Will Haz Crazy Code!Super-Charged Debugging for the New Developer
why are we here?
● Developers spend a *lot* of time debugging code.
● You're a developer interested in pushing your debugging skills beyond simple breakpoints.
● As the projects you work on grow in size and complexity, you will likely want some additional tools at the ready for when breakpoints prove totally, completely and in all other ways wholly inadequate.
who's the geek up front?
● Software/web developer at Bridgepoint Education, rocking primarily with ASP.NET MVC 4, SQL Server 2008, C#, Java, Javascript, Unity.
● [email protected]● www.jonbachelor.com● @DigiPug● speakerrate.com/digipug● slideshare.net/digipug● (this will all be at the end too!)
he's doing it wrong
totally doing it right... but might be drunk
the good news
There are enough debugging tools, tips, tricks and techniques to make this into a semester-length course, rather than a 1 hour talk.
the bad news
There are enough debugging tools, tips, tricks and techniques to make this into a semester-length course, rather than a 1 hour talk.
meet the tip of the iceberg
● Breakpoints● Tracepoints● Homemade debug
snippets● Conditional
breakpoints● Breakpoint filters● Fiddler● AOP with
PostSharp
● MOQ● 'FileWatcher'● Intellitrace● LINQPad● Snoop● Debug converters● sqlcmd● VS exception
settings● so... much... more...
the mighty breakpoint
f9, f10, ctrl-f10, f11, shift-f11
Use function keys to speed up your debugging efforts:● f9: Sets a breakpoint at your cursor● f10: Step over (not INTO code)● ctrl-f10: Run to cursor● f11: Step in● shift-f11: Step out● f5: giddy up!
hit it!
when hit... make me a tracepoint!
demosuper-charging your breakpoints:
tracepointshit count
conditional breakpointslabeled breakpoints
tracepoints == cool;
● Allows you to get a ton of information about your execution flow, arguments and/or variables, etc, very quickly.
● Prevents trouble you may otherwise run into with timing issues caused by using breakpoints (like when debugging threading problems).
murphy's tipthe "fun" issues always seem to happen in production...
where tracepoints are not an option.
NOW WHAT???
logging == super-cool;
● Tracepoints are really just a means to set up really quick logging statements.
● Take the time to implement good logging... If your logs don't capture a problem, they're useless. If your logs capture so much information that your app slows to a crawl, they're worse than useless.
● Two popular tools to make logging easier:○ PostSharp AOP○ Log4Net
remote debuggingan extraordinarily powerful tool that so few take the
time to learn how to set up!
it's easier than it sounds
● Remote debugging is particularly useful for troubleshooting an issue occurring on your development webserver which you cannot replicate on your local machine
● Fairly easy to setup if both you and your webserver are on the same domain
● Run the "remote debugging monitor" on the server
● Your DLLs and PDB files must match exactly● Attach to process: w3wp.exe● Enjoy rockstar status!
what about the data??sometimes a crazy-funky problem you're facing is
being triggered by a bad state of your database
an ounce of prevention...
● At some point, your database will presumably be in a known good state. Make a backup at that time.
● Restore to that backup if things go wrong.● Make backups of known bad states to
troubleshoot issues... Or play pranks on team members.
ssms not installed... ruh-roh!
● sqlcmd to the rescue!● Command line utility to run quick queries to
check on potential data issues.● Also super useful for creating batch scripts to
run collections of SQL scripts.
databases can be complex!
● Use database diagrams in SSMS to get your mind wrapped around a database, or even just a portion of a database.
warning: small font ahead!
What follows is a list of resources to help you dig into a bunch of the tools covered or
mentioned today...
I would suggest grabbing this deck from slideshare.net/digipug, but do what ya gotta
do...
i'm hooked... i want more!Visual Studio Debugging from MSDN (general info from Microsoft):
http://bit.ly/18LdVBk
PostSharp AOP (logging and TONS more):
http://www.postsharp.net/purchase
Snoop (WPF debug assistant):
http://snoopwpf.codeplex.com/
Fiddler (web debug assistant):
http://fiddler2.com/
WPF debug converter & more (techniques):
http://bit.ly/16deQqe
Favorite Documents Extension (keeping track of classes related to a particular issue or feature):
http://bit.ly/12VMRav
Agent Ransack (kick-butt search tool):
http://www.mythicsoft.com/agentransack
Remote Debugging (you'll be a star when you set this up!):
http://bit.ly/1ceBqlb
Using Labels in TFS:
http://bit.ly/17NkCOG
sqlcmd:
http://bit.ly/15ptd9U
thanks so much for coming!
● e: [email protected]● t: @DigiPug● w: www.jonbachelor.com● speakerrate.com/digipug● slideshare.net/digipug