OneTrueError - Automated exception handling

Windows azure & WordPress

I had a minor down time due to a failing WordPress plugin update. I had to manually delete the failing plugins using the FTP account which is hidden inside the publish profile XML which you can download. Now I manually have to reinstall those plugins.

Posted in Uncategorized | Leave a comment

Introducing OneTrueError.com

OneTrueError.com is my new startup for .NET developers. It’s a bit like ELMAH, but for most of Microsoft’s different frameworks, and with a tad bit of analytics.

Continue reading

Posted in CodeProject, OneTrueError | Tagged | Leave a comment

Alternative to IEnumerable for read-only collections

.NET 4.5 introduced a new interface which is great if you want to expose a collection as readonly.

The problem with IEnumerable<T> is that it’s forward only. i.e. there is no guarantee that you can traverse it multiple times. The collection size might also be unknown, depending on the implementation.

So if you want to expose a collection which can be traversed multiple times and where the size is know there is as of .NET 4.5 another alternative. And that’s IReadOnlyList<T>. It inherits another new interface called IReadOnlyCollection<out T>.

Code

public interface IReadOnlyCollection<out T> 
      : IEnumerable<T>, 
        IEnumerable
{
    int Count { get; }
}
public interface IReadOnlyList<out T> 
      : IReadOnlyCollection<T>
      , IEnumerable<T>
      , IEnumerable
{
    T this[int index] { get; }
}

Usage example

public class MyRepository
{
    public IReadOnlyList<User> FindUsers(string lastName)
    {
        // [...]
    }

    // [...]
}
Posted in Architecture, CodeProject | 1 Comment

Immutable collections should not implement mutable interfaces

I just read the new blog post about .NETs new mutable collections. It mostly looks really nice, but there is a major problem: They implement mutable interfaces like IList<T> which has an Add() method.

Continue reading

Posted in Architecture, CodeProject | Tagged | 16 Comments

A better windows service helper

I’ve updated my windows service helper so that it also can install your service for you (through the command line).

Continue reading

Posted in Uncategorized | Tagged | 1 Comment

Throwing exceptions

Throwing exceptions is in itself trivial. Just invoke throw with an exception object. But when should you throw? Should you create a new exception or rethrow an old one? What should you include in the exception info?

Continue reading

Posted in Architecture, CodeProject | Tagged | 3 Comments

If you can’t explain it simply, you don’t understand it well enough

albert-einstein-if-you-cant-explain-it-simply-you-dont-understand-it-well-enough

Posted in Uncategorized | Leave a comment

How to design exceptions

This article will teach you how you should design your exception classes. It’s a follow up to my previous article which told you what exceptions are and their intended usage.

Continue reading

Posted in Architecture, CodeProject | Tagged | 1 Comment

What are exceptions?

This blog has been quiet for a while. I am currently writing a book about localization. Me and my partner is also getting close to release of our new startup. One of it’s features is to automatically catch unhandled exceptions and send them to a webservice for analytics. But to take full advantage of that you’ll have to use a set of exception handling best practices. I’m therefore going to write a set of exception articles. The series will end with the release of our service.

Continue reading

Posted in Architecture, CodeProject | Tagged , | 3 Comments

More relevant ads please.

I just read that Mozilla are going to block third party cookies in the next version of Firefox (optional, but blocking is on per default). That’s great. Let’s get rid of the web site/usage tracking that all advertising services has.

Continue reading

Posted in Uncategorized | 3 Comments