April 2007 Entries

Re-Throwing Exceptions

I was going over some old code recently to try to resolve a production issue. The log of the stack trace was not providing enough information on the thrown exception and it reminded me of a good tip for throwing and specifically re-throwing exceptions. Consider the following code:   try{  int x = 0;  int y = 5 / x;}catch (Exception ex){  throw ex;} The stack trace at the time that the DivisionByZero is thrown will be different from the rethrow in the catch block. This is because the "throw ex" will create a new exception and throw it. Instead, you should try to...

Creating a custom AJAX control - DateTimePicker

Lately I decided to see how easy was to create AJAX custom controls specifically using the included javascript libraries. I thought it might be useful to try to use the included javascript libraries to enable client side access to the selected value from a custom control. The example I will use is a date time picker which uses the calendar extender from the ajax control toolkit for the date and a simple drop down for the time. Much like outlook, the date is pickable from a textbox and the time in a list of 15 minute intervals. The goal is to...

Microsoft announces Silverlight

Microsoft have just announced Silverlight, the new branding for what was previously known as WPF/E. They've also provided a lot more details about the specifications and their future plans.  Silverlight is the new Adobe (Macromedia) Flash competitor from Microsoft, it is based on the new Windows Presentation Foundation graphics engine found in Vista. It turns out that it will be very tightly integrated with .Net even to the point of shipping with its own cut down runtime. The download should be around 2MB though initially it will not contain 3D capabilities. IE, Firefox and Safari will be supported at launch. Silverlight website: http://www.microsoft.com/silverlight/

Response.Redirect and the ThreadAbortException

A colleague came across a problem recently where performance counters were showing a high exception to request ratio. In actual fact there were at 4 exceptions for every 1 request, that's 400% compared to the desired 5%. These seemed to be getting handled at some stage or another as there were no HttpUnhandledExceptions getting thrown at the UI. It turns out that Response.Redirect and Server.Transfer will throw a ThreadAbortException everytime the single parameter overload is called. i.e. Response.Redirect( string url ) The problem is that Response.Redirect will call a Response.End internally to stop code executing after the statement. This in turn throws our mystery...

Enterprise Library 3.0 Released - with some really nice features

The Microsoft Patterns and Practices team have just released Enterprise Library 3.0 - April 2007. This is the full RTM version of EntLib with some really neat new features: Validation Application Block. Allows you to centrally define validation rules using configuration or attributes, and easily validate data from anywhere in your application, including deep integration with Windows Forms, ASP.NET and WCF. Policy Injection Application Block. Provides a powerful approach for separating cross-cutting concerns from business logic using declarative policies that are attached at runtime to methods on your objects. Application Block Software Factory. Dramatically simplifies the process of building application blocks and...

Expression Web now available on MSDN subscriptions

Microsoft have finally listened to all the developers (who are also designers) rightfully throwing our toys out of our prams and included Expression Web Designer and possibly some other Expression badged products in the MSDN subscription downloads. "...we received a lot of questions about why we did not include some of these products, particularly Expression Web, within customers? MSDN subscriptions.........Based on this feedback, I am pleased to say that we will be making Expression Web available starting today to all MSDN Premium subscribers" This is really good news. The presumption that developers never need to use the latest CSS and HTML tools as they...

TeamPlain for TFS now available free

Due to the acquisition of DevBiz by Microsoft, their really cool TeamPlain web user interface for everything Team Foundation Server, is now available as a free download.   Great News. TeamPlain Web Site

My Blog

I'm starting this blog to keep track of technical work. My name is Peter Goodman, currently living in Edinburgh and working as a .Net developer for a major financial organistion, but soon to be living in New Zealand and hopefully doing something similar.