I ran into an interesting issue this week. We wrote a component that allows messages to be written to an IBM MQ –or- to a web service, which then writes the message to the queue for you. The reason for the web service, is that the client may not have the IBM MQ Client software installed.
So, we need to have a component that references IBM MQ, but that won’t break on a machine that doesn’t have it installed.
I was working with the consuming developer and he was saying that he was getting an error that the run-time couldn’t find the “amqmdnet.dll” reference, the main IBM MQ dll. Luckily, it was just an oversight on my part. There was a catch-block that was trying to catch MQException in the common code. That type is defined in the MQ library. So, when I removed that, it worked as expected.
In short, the run-time doesn’t actually seem to load the .dll until it has a reason to. So, it’s once you reference a type in the library, is the first time time the run-time will attempt to load it.