Noah Subrin's DEV Blog
Technology for Business Minds
Noah Subrin's Dev Blog

Book Review of Advanced .Net Debugging

Book Review of Advanced .Net Debugging

I work for SRA International (www.sra.com) as a Technical Lead managing a team of .Net developers. In my role, I am deeply interested in topics that will enhance our team’s software development process.  When I recently had the opportunity to review ‘Advanced .Net Debugging ‘by Mario Hewardt (Addison Wesley, 2010), I jumped at the chance.  I was able to review this book, through my membership and participation in the Gwinnett Georgia, Microsoft User Group (www.ggmug.com). Despite the book’s title, there is something for all levels of .Net developers.   Junior developers can get a useful inventory of the various tools that are available for debugging to complement the debugger found in Microsoft Visual Studio.  Developers of all experience levels can benefit from the numerous tips and tricks described in the book.  Senior developers can gain valuable insight into how to approach difficult bugs caused by interoperability, out of memory exceptions, and thread synchronization problems. The source code for the book is available for download at http://www.advanceddotnetdebugging.com/default.htm. The purchase of the book also allows the user access to a free online edition through Safari books for 45 days.

The author is a Senior Development Lead with Microsoft and has previously written “Advanced Windows Debugging”. He started working with the Windows team on Windows 98 and is currently working on online management services. His past experience with Windows is evident as he describes how Windows loads native images (for example notepad.exe) as well as managed assemblies. The author gets deep into the nitty gritty details quickly. By the end of the first section, the reader is able to set a breakpoint using Windbg (Win Debug) in the Windows notepad application.

The book assumes a working knowledge of C#, but an in depth knowledge of the CLR (Common Language Runtime) is not required. The book focuses on 32 bit development and the .Net Framework version 2.0.  Features in the latest release of the .Net Framework 4.0 are touched on briefly, but the book was published prior to the release of .Net Framework 4.0 to manufacturing. The samples are in C#; this is something to keep this in mind if you are a VB .Net developer. There also are newer versions of the debugging tools since the time the book was published, which are free to download from Microsoft and other vendors. The book clearly states where users can find the tools referenced in the book.

The book is divided into three sections:

Part 1 contains an Overview of the book including chapters on the tools, CLR Fundamentals, and Basic Debugging tasks.  To get a good working knowledge of .Net debugging, readers could focus on these chapters and come away with several nuggets of useful information.

Part 2 focuses on Applied Debugging. There are chapters on the Assembly Loader, Managed Heap and Garbage Collection, thread synchronization, and COM interoperability. Depending on what areas a developer may be interested in the reader may read these in any order, and might only be interested in one or more specific chapter.

Part 3 contains advanced topics. There are chapters on Postmortem debugging, Power Tools, and the CLR 4.0.  At the time of the books release, only Beta 1 of .Net 4.0 was available, so there are possibly modifications to some of the debugging features that were included in the .Net 4.0 RTM release.

Overall, I would recommend the book to all .Net developers. New developers may find it somewhat daunting at first, but after working through the code samples, there is some information every developer can use. The focus on the underlying .Net framework internals helps developers understand concepts like memory management, garbage collection, and thread synchronization, regardless of whether the developer is interested in debugging or not.  The discussion of the various available debugging tools alone is worth reading.

The only significant suggestion I have is that the book be updated to include more information on .Net 4.0 tools and functions to make it more up to date. The author also seems to assume some familiarity with a lot of the debugging tools, so plan on spending some time getting acquainted with them.  There are not a lot of books written on this topic, so serious .Net developers should consider adding this book to their library.

SQL Saturday #41

On Saturday, April 24 I will have the pleasure of speaking at the SQL Saturday #41 conference at the Microsoft Offices in Alpharetta. If you haven't had a chance to attend this event in the past, it is a day of free training! Currently, the event is sold out with a waiting list of around 70 people.

I will be discussing data mart assessments, what they are, why we do them, and how to perform them. The content is based on a project I am currently working on for a large federal agency.

I encourage everyone to attend - there should be something for developers, managers, and BI professionals. Whether you're just starting out or a seasoned professional, I am sure there is something that will interest you. I hope to see you there!

SQL Saturday #14

Yesterday, I had the good fortune to be able to deliver a presentation at the SQL Saturday #13 Community Event at the Microsoft Campus in Alpharetta. SQL Saturday is a community event for Microsoft SQL Server professionals. Several well known speakers presented including Joe Celko, Kevin Kline, and Andy Warren. A great amount of effort and preparation went into delivering this event, which had approximately 200 people in attendance. Hats off to all of the leadership team at Atlanta MDF for making this happen, as well as all of the sponsors, and Microsoft for providing the facility. There was a tremendous amount of give aways, and I think everyone went away satisfied.

My presentation, "Building Effective T-SQL Solutions" was based on five articles I have published on the SQL Server World Wide User Group web site . I discussed the following topics in my presentation which is available for download here:

  1. How to Set Compatibility Mode Using T-SQL
  2. How to Determine Membership in Windows Groups Using T-SQL
  3. Creating a Data Driven Web site using MySQL and VS 2008
  4. Importing a .csv file into SQLExpress using Bulk Insert
  5. Creating a Non-Sequential Order Number System
All in all, it was a great success.

Orlando Code Camp

This Saturday is the fourth annual Orlando Code Camp. I will be delivering my presentation on 'Developing A Biometric Application''.
Biometrics are automated methods of authenticating or verifying an individual based on physical or behavioral characteristics. In this session, we will build a Biometric software application using a fingerprint reader, Visual Studio 2008, Windows Forms, and a third party SDK.

At the time of this post there are over 540 people registered for the event. It is an all day event of free training, so I encourage everyone to attend. There are over 40 speakers, 60 sessions, and 11 tracks.

I look forward to seeing you there!

Presentation at the Atlanta Code Camp

It's that time of year again - time for the fifth annual  Atlanta Code Camp.
For those of you who have not been to a code camp, it is similar to developer conference, with many speakers and various tracks, except that it is free to attend. Lunch is provided, and most attendees also leave with a good bit of swag. In these challenging economic times, you can't beat that.

This year's Atlanta Code Camp is being held at Georgia Gwinnett College off of Collins Hill road in the Lawrenceville-Suwanee area.

I will be delivering a presentation on how to build a biometric application based on Visual Studio 2008, Windows Forms, SQL Server 2005, and a third party SDK.

I hope to see you there. Spread the word, these events typically "sell out" quickly because registration is capped due to space limitations at the facility.


How to set Compatibility Mode for a Database Using T-SQL

I participated in a database server migration from SQL Server 2000 to SQL Server 2005 and noticed some query performance issues that came up during testing. When a database is upgraded from SQL 2000 to SQL Server 2005 using backup\restore or sp_attach, the database retains its current compatibility level. Read my article on the SQL Server World Wide User Group web site as I explain how to set compatibility mode for a single database using T-SQL and how this may affect query performance.

Building Effective Web Applications with ASP .Net 3.5 - Week 2

Last week I delivered part two of a six part series of webcasts for a course I created for my employer, titled "Building Effective Web Applications with ASP .Net 3.5". Each session lasts two hours. Week 2 we focused on LINQ (Language Integrated Query). LINQ is a general purpose query facility to query relational data, XML data, objects/collections that allows us to query any of these data shapes in a consistent manner. LINQ query syntax resembles SQL except that the 'from' clause is in the beginning of the query, which allows the compiler to infer the type of the object.

Here are some of the benefits of using LINQ:
  1. You may not need to build an entire DAL (data access layer)
  2. It is much easier to query XML – don’t have to use Xpath
  3. We can work with data in a consistent way – whether it is SQL Server data, XML data, ADO .Net dataset, an object collection, or data in memory
  4. Offers compile time checking, autocompletion, and Intellisense

There are new features in C# that support LINQ including:
  1. Automatic properties
  2. Initializers
  3. Type Inference
  4. Anonymous types
Automatic properties provide us with a shorthand method for defining a new property. The C# compiler generates to get and set. Initializers reduce the amount of work it takes to create a new instance of a class.
Local variable type inference allow the C# or VB .Net compiler to determine the type of a variable at compile time
Anonymous types allow us to create an object type on the fly.

One of the coolest features in LINQ using VB.Net is XML literals. If you have ever had the experience of creating an XML document using the DOM (Document Object Model) you know that it may be cumbersome to build. It also is difficult to query using XPath. XML literals allow us to copy an paste code into LINQ and the compiler builds the syntax to make this happen. Read on here to read a description of XML literals and how it's done in VB9. In C#, we have to build an add-in to provide this same functionality. The following link describes how to build the Paste XML as XElement addin.

My slide deck can be downloaded here. Let me know what you think!



Building Effective Web Applications with ASP .Net 3.5 - Week 1

This week I began a 6 part series of webcasts for a course I created for my employer, titled "Building Effective Web Applications with ASP .Net 3.5". Each session lasts two hours. Week 1 we focused on laying out the course and how to get started with ASP .Net 3.5.

Here are the course objectives:
  • Become familiar with new features in ASP .Net 3.5
  • Build database driven apps using LINQ
  • Leverage ASP .Net AJAX on both the client and server side
  • Learn about state management and caching
  • Secure your ASP .Net websites
  • Create an end to end web app
Week 1's agenda presented the following topics:
  • Tools We Will Use
  • ASP .Net 3.5 Overview
  • Project Setup/Configuration
  • WebForms Overview
  • Server Controls
  • User Controls
  • Master Pages
  • Debugging and Tracing
  • New Features in ASP .Net 3.5
My slide deck can be downloaded here:

Let me know what you think!





ASP .Net Service Pack 1

If you are not aware, Visual Studio Service Pack 1 and the .Net Framework Service Pack 1 were released a few months ago. In addition to bug fixes, a lot of new functionality is contained in this release. A partial list of new features includes the following:

VS 2008 SP1:

    * Improved WPF designers
    * SQL Server 2008 support
    * ADO.NET Entity Designer
    * Visual Basic and Visual C++ components and tools (including an MFC-based Office 2007 style ‘Ribbon’)
    * Visual Studio Team System Team Foundation Server (TFS) addresses customer feedback on version control usability and performance, email integration with work item tracking and full support for hosting on SQL Server 2008
    * Richer JavaScript support, enhanced AJAX and data tools, and Web site deployment improvements

The .NET Framework 3.5 SP1:

* Performance increases between 20-45% for WPF-based applications – without having to change any code
    * WCF improvements that give developers more control over the way they access data and services
    * Streamlined installation experience for client applications
    * Improvements in the area of data platform, such as the ADO.NET Entity Framework, ADO.NET Data Services and support for SQL Server 2008’s new features

Additional details and a link to download SP1 can be found in this MSDN article.





How to determine membership in Windows Groups using T-SQL

I lead a recent server\database migration from SQL Server 2000 to SQL Server 2005. Several of my team were supposed to be added to a Windows group that was to have been granted access to the new SQL Server. We tested their access and they were not able to authenticate to the new SQL Server . Read my feature article on the SQL Server World Wide User Group website as I explain how I determined whether they were in fact members of a particular group.