G’Day and Welcome!

G’Day and welcome to Stuff the Box!

Here you will read about opinions of tech news, opinions on bass guitar gear, personal tid-bits and whatever else I feel like writing (complaining/ranting) about.
Feel free to comment to your hearts content…I only ask that you keep it civil and in good taste.

N.B. No trolls! Comments are moderated and trolling comments will be denied and the trolls will be condemned to a place worse than Hell!
You have been warned…

Method Load Order for a .NET Outlook Addin

I have been creating a .NET Outlook addin lately1 and it has been an incredible learning journey. I have had to support 3 generations of Outlook, using the base bottom COM feature/API set (oldest supported; 2007), and have still had to stay within the speed requirements of the latest supported (2013) :-/

One thing that perplexed me was how I could hook in, early enough, to the addin load/startup process to subscribe to the AppDomain.UnHandledException and Application.ThreadException event handlers so that I can log exceptions. This is desired because Outlook is so damned efficient that it decides to kill an addin as soon as it exhibits signs of an unhandled exception.

The Hunt

So, after looking around, I found nothing! I could not find a single site that outlined how the base method invocations are called and in what order :-(
Never fear, however, because I have Debug.WriteLine() and an Output window!

So, this is the method invocation of my addin23:

  1. AddInName(factory, serviceProvidor) – your addin’s primary constructor
  2. Initialize()
  3. InitializeCachedData()
  4. InitializeControls()
  5. InitializeComponents()
  6. InitializeData()
  7. InitializeDataBindings()
  8. BeginInitialization()
  9. BindToData()
  10. EndInitialization()
  11. FinishInitialization()
  12. OnStartup()

When I see it laid out like this, it’s kinda logical haha …
There were other methods in the base class, but at addin load/startup they were not called; so I did not investigate further as this served my purpose4.

The Hunt’s Rewards

So after all that, it turns out that all I have is some trophies to hang on the wall5 instead of a nice dinner for the family6

What I have discovered is that the best practices for VSTO addin’s is to use lots of try { } catch { } blocks around all executed code :-/
It is still accepted to add the desired UnHandledException (and ThreadException7) catch/es, but you shouldn’t rely on them alone. What I have done is create an internal static void UnHandledException(...) method that can be called from anywhere and log the details. It does a throw at the end so that the addin gets disabled by Outlook, as it should.

All this just to get logging so that I could identify what was causing an exception on that damn unsupported OS … which turned out to be in vain! I forgot that I had updated the addin to .NET 4.5 for a new feature of which I had created and added, but the unsupported OS that was having the exception only supports up to .NET 4 …
Alas, the journey and experience was worth it; I hope you may gain some benefit from my playing :-D

Happy coding!

  1. Mainly for fun, and in my own time … however it does have a work purpose ;-P 
  2. As you may have noticed, I am a C# developer. I can, and do (because I have to), develop in VB.NET, but C# is my playground and I love it! 
  3. These method names appear in AddInName.Designer.cs within the base AddInName class; although there are other classes in that file, they did not appear to load on startup for my addin. Your mileage may vary. 
  4. If you do more investigation, I would love to hear about your results! 
  5. A list on a blog of what runs and in what order … 
  6. An identified entry point for an AppDomain.UnHandledException and/or an Application.ThreadException 
  7. You will need to specify the full namespace path to System.Windows.Forms.Application as the default Application reference will resolve to Microsoft.Office.Interop.Outlook which doesn’t have a ThreadException event to subscribe to. 
Tagged , , , , , , , ,

Desktop UI Testing Without Running the Build? No Way?!

This is a post that I originally wrote on the Microsoft Development Team’s Brain Dump blog at work the other day, and thought I’d share it my non-work viewers too

So, it turns out that you can test WinFroms (and WPF) UI controls from within LINQPad!1

First save and build your project so that you have an/the assembly (*.exe, *.dll). Once you have a build, fire up LINQPad and right click on the query tab and select Advanced Properties. On the Additional References tab select Add and then Browse. Find the assembly that you did a build of and click OK; add any other necessary assemblies, i.e. System.PresentationFramework.dll, System.Windows.Forms.dll, System.Xaml.dll, etc. Once you have all of your assemblies added, switch to the Additional Namespace Imports tab and click Pick from assemblies and select the appropriate namespaces from all the assemblies that you need; this is what will give you IntelliSense.

Once you have done the above, you can close the Advanced Properties window and change the Language to C# Program (or VB Program … if you like pain ;P). Now you can create a new instance2 of your WinForms/WPF window and test3 out the UI without executing your app! You could even use LINQPad as a way of doing some Unit Tests or some such if you were really inclined …

Happy testing and debugging!

  1. I discovered this awesome feature by stumbling across this post by Matthew MacSuga; I have however documented my method of testing WinForms UI and confirming WPF support 
  2. Beware class/constructor access; if you have your class, constructor/s or other methods set to internal instead of public, you will not be able to create a new instance of your UI :( 
  3. Make sure that you set .ShowInTaskbar = true to ensure that you have a hook to kill the window if something goes wrong; especially if you are using .ShowDialog() to display it 
Tagged , , , , , , , , ,

Sold: Hartke HA3500 Bass Amp + Hartke 4.5XL Bass Cabinet – AU$600 Neg.

Update: the amp has been sold! A nice young guy, still in school, came ’round to try it out as he is in a band and wanted to upgrade his gear. He was incredibly talented and I am so happy that this amp kit has gone to someone who will look after it and use it. Continue reading

Tagged , , , , , , ,

Coffee Buzz 1.1

Coffee Buzz 1.1 is here!
It has been a fun holiday working on some different personal projects, and this was one of them :)

Since initially creating Coffee Buzz, I have learnt a lot [more] about Object Orientated Programming, and the language C#; so for this release there is quite a lot of refactoring, performance improvements, better memory management and a few little features/changes.

The main features additions/changes are:

  • Added the ability to disable balloon tips
    • Shift+Click the Icon to access the new setting
  • Added menu header to easily identify current version
  • Added menu aware click-behaviour of the Notification Tray icon left-click
  • Altered left-click behaviour when clicking the Notification Tray icon to allow for double click before presenting the menu; right-click behaviour unchanged
  • Added error log saving and notification for easier support in the rare case of issue
  • Rearranged menu item placement for the addition of the header and moved the About menu item to above Quit

You can get the new version here; and of course, any issues please don’t hesitate to get in touch :)

Tagged , , , , , , ,

EnumInstalledApp – Query the Registry Uninstall Key

Ever wanted to quickly find out what application is listed in the registry’s Uninstall key? Wanted to know what sub-key name it has and what version is recorded?

EnumInstalledApp is the CLi utility for you! Continue reading

Tagged , , , , , ,

Praying the Rosary

I start the prayer;
already a feeling of disconnect …
I pray the first decade;
why this feeling of hollowness to my words and intentions?
I pray a second decade;
for you God, and for myself, I try to mean every word I say …
I pray the third decade;
the yawning starts, I struggle to focus …
I pray the fourth decade;
God, give me strength to give my all to you …
I pray the fifth decade;
I love you Lord, I really do!

Tagged , , ,


I hate starting things and then not finishing them.
Some things work great when treated as an always incomplete project1; but, for the most part, I hate the practice.

I managed to not only start, but complete two personal projects: Coffee Buzz and PromoteNTA. This was an amazing feeling to complete and release them!

When developing them, I signed up for an account with Assembla and created a private SVN2 repository so that I can commit to and track changes and progress. I was using the commit messages to keep track of items to-do; sadly this wasn’t ideal.
I have recently upgraded the account to include ticketing features. This now allows me to create tasks against the different little projects that I am committing so that I can easily see what is left to do and how close to release I am.

With these new features in Assembla active, I have embarked on:

Hopefully, by setting up the ticketing support, this blog post and other factors, it may help keep me on track and complete these projects!

Time will tell … ;P

  1. Like this blog … 
  2. There are many different types of version control; I use SVN as I like the centralized model and find it very powerful. I have also been looking into Mercurial but haven’t set aside the time to tinker yet. 
Tagged , , , , , ,

Where am I at?

Howdy blog followers and visitors! (if I still any of either haha)

Where am I at? What am I doing?

I have been working incredibly hard as of late. My job has recently taken a few interesting turns where I am developing more and being involved in some more highly visible projects1; which of course is incredibly enjoyable, humbling and fun.

I love developing/programming. As soon as I open my IDE, I am engrossed in a world that is mine to create, massage and grow; it is an incredible feeling! Continue reading

Tagged , , , , , ,

Site Redesign

I’ve been thinking about a redesign to the site for a while now, but couldn’t really find any themes nor think of any ways to make it better.

Why did I want a redesign?
What was wrong?
What could be done better?

Although the last design looked great, I found the text sizing too small and annoying; also the kerning was bad!
I have also been getting more and more annoyed with side bars. Some sites do it really well, where other sites’ look like clutter and noise; I felt that this site was in the latter.
I was also sick of the black background. It looked elegant, and possibly more power conservative, but I found it too much.

I longed for simpler. Continue reading

Tagged , , , ,

PromoteNTA – Promote a Notification Tray application

Well, here it is, my second application!!!

PromoteNTA is little command line utility that can be used to “promote” a Notification Tray application state.

If you have the Windows (XP/7/8) Notification Tray (the one in the bottom right corner) configured with default settings, it will hide any application that isn’t active; i.e. telling (notifying) you about something. There are two other states an application can be promoted to, always hide or always show. Windows doesn’t provide a way to programatically “promote” the state of an application tray but instead only allows a user to set this using the User Interface.

PromoteNTA is a way for software developers or system admins to centrally promote an application state for any/all user/s.

If you are interested in finding out more, click through here to get access to the utility and the developer resource!

Tagged , , , , ,

Get every new post delivered to your Inbox.

Join 80 other followers