Programming and Peace of Mind

Break where the error HRESULT occurs using WinDbg

When debugging, I found an error HRESULT returned: 0x80020003, but I do not know which function is...

Author: enwang Date: 02/05/2009

An initialization pattern to avoid problems calling virtual method in constructor

You are not supposed to call virtual methods in a constructor. The reason being that at the point...

Author: enwang Date: 10/05/2008

What does it mean for a class to be thread-safe?

We often heard the question about whether a class is thread-safe. The answer can be complicated....

Author: enwang Date: 05/28/2008

Why, in Visual Studio 2008, opening a VSTO Office 2003 AddIn project gets upgrade wizard?

Recently a customer asks an issue about using VSTO (Visual Studio Tools for Office) in Visual Studio...

Author: enwang Date: 05/15/2008

When to catch all exceptions?

One of the general guidelines of exception handling in .Net is to catch the exceptions that you know...

Author: enwang Date: 05/09/2008

Determine share mode of opened file handle

If there is a file already opened and you also want to open it, you need to know the share mode:...

Author: enwang Date: 05/07/2008

To mock or not to mock?

In Wikipedia's definition of Unit test, it says "Ideally, each test case is independent from the...

Author: enwang Date: 04/27/2008

Waste-less Programming

Waste-less programming is my way of thinking about getting better at programming. We, as...

Author: enwang Date: 04/21/2008

Using EventProviderTraceListener

In .Net framework 3.5, there is a new trace listener, EventProviderTraceListener, which you can use...

Author: enwang Date: 04/16/2008

Abstract Class or Interface II

In previous post, I was convinced that abstract class was the right choice for the work I am doing....

Author: enwang Date: 04/07/2008

Abstract Class or Interface I

Recently I'm working on designing a set of .Net APIs for external clients to use. One of the...

Author: enwang Date: 03/31/2008

Programming and Peace of Mind

Robert M. Pirsig quotes in Zen and The Art of Motorcycle Maintenance: 'Assembly of Japanese bicycle...

Author: enwang Date: 03/30/2008