Handling the AggregateException

Last week I showed you how you can use the AggregateException to apply consistent exception handling in batch operations. You can find that post here. Bart De Smet read that post and pointed out that I should check out the Handle method of the AggregateException. The Handle method As found in the MSDN documentation. Description Invokes a handler on each Exception contained by this AggregateException. Parameters System.Func<Exception, Boolean> predicate The predicate to execute for each exception. The predicate accepts as an argument the Exception to be processed and returns a Boolean to indicate whether the exception was handled. Remarks ...

May 23, 2010 · 2 min · Jef Claes

Exception handling in batch operations with the AggregateException

Doing batch operations and elegantly handling exceptions is a problem which every developer has faced before. In .NET 3.5 or older there is no out-of-the-box solution to handle exceptions in these types of scenarios, without being inconsistent to the normal flow of exception handling. .NET 4 introduces the AggregateException; an exception representing multiple exceptions. The AggregateException was introduced in the first place to be used with the parallel framework, but it can be used in other scenarios as well, such as batch operations. ...

May 15, 2010 · 2 min · Jef Claes

Trip Report Czech Republic

Last week my girlfriend and I went on a short holiday to the city of Plzeň in the Czech Republic. In this post you can find a small trip report. Roadtrippin' Minutes after leaving home we discovered an unpleasant surprise; my Tom Tom has no map of the Czech Republic. Good thing that people used to print this stuff on paper. After consulting a paper map of Europe we did have an idea which direction to follow. ...

April 12, 2010 · 2 min · Jef Claes

Cannot Start Service from the command line or debugger. A Windows Service must first be installed (using installutil.exe)..

When you create a new Windows Service project and try to debug it, Visual Studio will show you a Windows Service Start Failure with the message Cannot Start Service from the command line or debugger. A Windows Service must first be installed (using installutil.exe) and then started with the Server Explorer, Windows Services Administrative tool or the NET START command.. The trick my team and I use to workaround this problem, makes use of the service Debug flag. If the Debug flag is on, we just start the service by using our own public Start method. When the OnStart event is fired in the service itself, we call the same public Start method. ...

March 13, 2010 · 1 min · Jef Claes

Book review: Object-Oriented JavaScript

Although I’ve made my feet wet with various JavaScript frameworks, I am not a JavaScript hero at all. This might be one of the disadvantages of being a WebForms developer and having great toolkits at hand like the AJAX Control Toolkit and Telerik RADControls. Because you really can’t call yourself a webdeveloper without having some understanding of JavaScript I decided to order Object-Oriented Javascript by Stoyan Stefanov. This book really handles the language itself. The first chapters handle the basics: Types, loops, functions and objects. Although these concepts and the syntax resemble C#, JavaScript is a total different beast. After covering the basics, Stoyan goes deeper into OO JavaScript with Prototype and Inheritance. Then he shows the Browser Environment and he finishes the book with Coding and Design patterns. ...

February 22, 2010 · 1 min · Jef Claes

Webforms lessons learned the hard way (Part 2)

If you missed part 1, you can find it here. Use the built-in goodies ASP.NET Webforms has a lot of good stuff built into it. Do your homework before you start building the next big Webforms thing! A perfect example of this is ASP.NET Membership. ASP.NET provides an out-of-box membership solution. I’ve seen people who were to lazy to do some research or thought they could do better and ended up with a solution which put its doors wide open to people with bad intentions. ...

February 15, 2010 · 2 min · Jef Claes

Webforms lessons learned the hard way (Part 1)

I’ve been spending a lot of my days in Webforms the last two years. In this post I want to share some best practices I’ve learned the hard way over these years. A lot of MVC developers might think this post comes a bit late (who still cares about Webforms?!), I do think (in the real world) a lot of the ASP.NET developers are still using Webforms. This post is directly targeting them. ...

February 14, 2010 · 3 min · Jef Claes

Log4Net: log.Debug(String.Format()) versus log.DebugFormat()

Log4net is one of the most popular opensource logging frameworks available in the .NET world. I’ve been using this framework for over a year now, and today I discovered something new. I often use string.Format() to format my log messages. Earlier this morning I made a typo formatting my message and an Exception was thrown in the beginning of my method which caused the application flow to break. You can avoid this by using the DebugFormat() method. If you mistype here, no exception will be thrown, but a WARN message will be logged. ...

January 20, 2010 · 1 min · Jef Claes

Looking back, moving forward (New years post)

In this post I’m going to reflect on the year that’s almost finished and the year to come. I came up with a few topics that are worth discussing in this post. My career I don’t think I ever mentioned where I work. The first of January I will be working 18 months for Ferranti. The only company I’ve worked for since I graduated. The first project I’ve ever worked on was a rather big one. Firestation Antwerp. Last year we heard that sales scored another firestation for us (Firestation Ghent). So I’ve been working on these two projects since I started. ...

December 21, 2009 · 2 min · Jef Claes

Response.RedirectPermanent in .NET 3.5 and older

One of the new features in ASP.NET 4.0 is permanently redirecting to a page using Response.RedirectPermanent. It is common practice in Web applications to move pages and other content around over time, which can lead to an accumulation of stale links in search engines. In ASP.NET, developers have traditionally handled requests to old URLs by using by using the Response.Redirect method to forward a request to the new URL. However, the Redirect method issues an HTTP 302 Found (temporary redirect) response, which results in an extra HTTP round trip when users attempt to access the old URLs. ...

December 5, 2009 · 1 min · Jef Claes