This was a seriously obscure bug it turned out. It was so obscure I turned to stackoverflow to ask about it. I’ve written a C# assembly that wraps the Apache NMS library to provide applications with messaging functionality and the NUnit tests for the DLL run fine but when I tried using the DLL from the main Windows Service that I’m working on the connection to the broker always failed. And to boot, the exception info was not helpful:
Error in the application
(more…)
If you’re trying to debug your NUnit tests in Visual Studio and getting the error:
The breakpoint will not currently be hit
this is how to sort it. First, change NUNIT_HOME\bin\nunit.exe.config to remove references to .NET2 and make sure .NET4 is enabled, e.g.
(more…)
So I started getting this error when connecting to an ActiveMQ broker as a consumer and producer from the same machine:
“the connection is already closed!”
which occurred when I tried to set the clientID on the producer, having already set up the consumer. Turned out I was using the same clientID for the consumer and the producer!
As part of the porting matrix from Java to C# I’m installing .NET on a vmware Windows 7 image and seem to have inadvertently stumbled into a version bump mess. .NET is currently at 4.0 with 4.5 to be released soon but this is apparently an ‘in-place’ upgrade rather than a ‘side by side’ replacement. Sounds not too bad until you find out that apparently 4.0 apps may crash on 4.5 due to internal gubbins that won’t be apparent until runtime. Thanks M$! But I am rather enjoying the intellectual stimulation of a new platform and language.
References:
.NET Versioning and Multi-Targeting – .NET 4.5 is an in-place upgrade to .NET 4.0
.NET 4.5 is an in-place replacement for .NET 4.0
Microsoft’s .NET Framework 4.5 Versioning Faces Problems Ahead
I’ve recently been adding Groupwise functionality to GADfly which means using COM as that’s the only way to access the Groupwise Admin API, via the Groupwise client. I’ll go over how to do that in a later post but once I’d plumbed the COM functionality into GADfly via my MatrixClient for C#, I started to get a weird error. The basic setup is I register a message handler to deal with GW messages with MatrixClient and when a message arrives on a JMS topic, my durable subscriber gets the message, parses out the info and create a Groupwise account from it. However, the event handler was causing the GW class to barf in a big way:
Unable to cast COM object of type 'AdminTypeLibrary.SystemClass' to interface type 'AdminTypeLibrary.DIADSystem'.
This operation failed because the QueryInterface call on the COM component for the interface with
IID '{35FC2357-811A-11D0-8A96-00805FC16077}' failed due to the following error:
No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)) (more...)
I have a bit of a problem with “cross platform” development at the moment. I’m running Windows XP inside an ActiveDirectory forest using VMware Fusion from OSX. A nasty experience a while ago means writing code on a virtual machine’s hard disk is insanity itself. If something happens to the slice you lose everything. OK, you won’t if it’s in source control but using subversion or git from Windows is a pain. Also, why duplicate backup/vss options on a slice when I’m already using everything just fine from OSX? So instead, I develop via a shared folder. I write all the C# code via VisualStudio which points to the “network” share.

(more…)
I’ve pretty much finalised the design of GADfly, with a Windows service using a durable consumer to pull messages from a dedicated topic provided by Apache ActiveMQ inside Apache Camel. Just needed to try it out for real, so I knocked up FlyTrap, a small Windows GUI app to send messages to a test topic and consume them, using the GADfly functionality to create and delete accounts and directories in ActiveDirectory.

It’s a very simple app that tells you how long it took to create and delete the accounts and directories, including the messaging time:

I use XMLBeans extensively in Java so I don’t have to work with raw XML, especially SAX, as it’s a real pain to deal with. XMLBeans, given an XSD and xsdconfig will create a load of Java classes that map directly to the XML documents. All very nice but what about C#? When I was doing the C++ version of GADfly I was back into raw XML but there is something quite nice you can use in C# to get much the same effect as XMLBeans. It’s called xsd.exe
If you give it a schema and some params it’ll create classes you can serialize/deserialize to/from XML. Let’s say you have this simple schema: (more…)
I’ve ported the C++ STOMP code to C# with just a little problem, in that the STOMP support in ActiveMQ NMS doesn’t work. No to worry, the default protocol does. The first thing you need is ActiveMQ NMS (.NET Messaging). I used the 1.1.0 source release downloaded from here. You’ll also need nant to build it. Unzip nms-1.1.0 to NMS_SRC_HOME and make a quick change to nant-common.xml otherwise you’ll get this error:
Unknown function 'platform::is-windows()' (more...)