Unit testing: COM object that has been separated from its underlying RCW cannot be used

Let’s say you’re writing unit tests for code which uses COM objects. You want some initialization and some cleanup to be done. So you set up your test: private static MyStore store; [ClassInitialize()] public static void MyClassInitialize(TestContext testContext) { store = new MyStore(“some value”); } [ClassCleanup] public static void MyClassCleanup() { store.DoWork(someArgument); } However, as…

2

Office 2010 Development – Outlook main window ribbon ID

I’m currently writing an Outlook add-in and I’m looking into getting this compatible with both Office 2007 and Office 2010. One of the new features in Outlook 2010 is the main window Ribbon. Using VSTO, you can create your own Ribbon, which can be automatically merged with default Ribbons by setting the correct OfficeId property…

1

PrintMonitor – A C# print spooler monitor

Recently, a colleague of mine had a requirement of getting information on the number of pages being printed by users. Monitoring a printer is done by calling FindFirstPrinterChangeNotification, waiting for the returned WaitHandle to be signaled and then calling FindNextPrinterChangeNotification to see why the handle got signaled and act accordingly. Sadly, there don’t seem to…

0

Outlook Add-in: Replying to people who voted

Recently, I asked my colleagues if they were interested in beta testing some software I’m building for internal use. I used voting buttons to enable easy tracking of replies. When I wanted to reply to all people who voted “Yes” on my request, I discovered there’s no real way of just replying to a set…

0

Feedback requested: Planning on Enterprise Library 5 has started!

Planning on Enterprise Library 5 has started! See Gregori’s blog for more information if you want your EntLib needs to be in the next release: http://blogs.msdn.com/agile/archive/2009/01/26/enterprise-library-5-what-s-on-your-wish-list.aspx!

1

Reflector add-in: Favorites

Every developer knows about and uses Reflector 😉 I use it a lot to learn about the inner workings of products. When analyzing what goes where and why, it’s easy to lose track (jumping from method to method to base class, etc.). Bookmarks are quick and easy, but don’t allow for a description to be…

1