Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Spaghetti gate


Published on

You've officially leveled-up in the world of software development with Visual Studio, and you now find yourself working on projects that are infinitely larger and far more complex than anything you've worked on before. Time to beef up your debugging skills not only to debug, but sometimes just to learn the flow of a given process! Plain old break-points have always gotten you by, but now you quickly run into trickier situations that come close to making your head explode. Come and learn some new debugging tricks & tips to bring your debugging skills to new heights.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Spaghetti gate

  1. 1. You Will Haz Crazy Code! Super-Charged Debugging for the New Developer
  2. 2. 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.
  3. 3. 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. ● ● ● @DigiPug ● ● ● (this will all be at the end too!)
  4. 4. he's doing it wrong
  5. 5. totally doing it right... but might be drunk
  6. 6. 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.
  7. 7. 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.
  8. 8. 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...
  9. 9. the mighty breakpoint
  10. 10. 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!
  11. 11. hit it!
  12. 12. when hit... make me a tracepoint!
  13. 13. demo super-charging your breakpoints: tracepoints hit count conditional breakpoints labeled breakpoints
  14. 14. 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).
  15. 15. murphy's tip the "fun" issues always seem to happen in production... where tracepoints are not an option. NOW WHAT???
  16. 16. 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
  17. 17. remote debugging an extraordinarily powerful tool that so few take the time to learn how to set up!
  18. 18. 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!
  19. 19. what about the data?? sometimes a crazy-funky problem you're facing is being triggered by a bad state of your database
  20. 20. 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.
  21. 21. 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.
  22. 22. 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.
  23. 23. 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, but do what ya gotta do...
  24. 24. i'm hooked... i want more! Visual Studio Debugging from MSDN (general info from Microsoft): PostSharp AOP (logging and TONS more): Snoop (WPF debug assistant): Fiddler (web debug assistant): WPF debug converter & more (techniques): Favorite Documents Extension (keeping track of classes related to a particular issue or feature): Agent Ransack (kick-butt search tool): Remote Debugging (you'll be a star when you set this up!): Using Labels in TFS: sqlcmd:
  25. 25. thanks so much for coming! ● e: ● t: @DigiPug ● w: ● ●