"No MTS context" error when trying to connect to MQ Queue Manager

I have a C# GUI application and am attempting to connect to an MQ channel using the IBM MQ API (that I have installed on my system).  I have a reference to the amqmdnet.dll DLL in the "C:\Program Files\IBM\WebSphere MQ\bin" folder.

I try to instantiate an MQQueueManager object using the following code:

   IBM.MQ.MQQueueManager qm = new IBM.MQ.MQQueueManager(qmName, channel, connName);

The prototype for the MQQueueManager overloaded constructor used above is:

   public MQQueueManager(string queueManagerName, string Channel, string ConnName);

However, upon executing this line of code, an exception is thrown saying "There is no MTS context available".  I've attached a screenshot.  I've Googled what I've found seems to be the error code for this (0x8004E004), and also a variation on the message ("no MTS object context"), but to no avail.

What's stranger is that I have fetched an earlier version of the code for my project and it works absolutely fine on the same machine.  I've done a diff, but there doesn't appear to be any obvious differences that would impact on this particular function.  I've even done a complete clean and rebuild to force a recompile and relink, and referenced DLLs are the same location on my hard disk.  I'm now at a complete loss.  Can anyone help me with pinpointing what could be causing this particular error?

Thanks for any help!
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I'm curious if the original code is a Serviced Component (COM+).  Do any of the class definitions look like:
public class MyClass: ServicedComponent
XtreemAuthor Commented:
No, that base class isn't used anywhere in the project in the new or old code.

A few new forms were added since the old code, but nothing that should impact this - they're just new dialogues.

Do you know if the original working application was a COM+ application.  You should be able to go to Start, Control Panel, Administrator tools, Component Services. Expand Component Services, Select My Computer and expand COM+ Applications.  Scroll through the COM+ applications and see if anything looks like the original application which is working.  
I am almost certain the application is a Serviced Component (COM+).  The System.EnterpriseServices.DLL leads me to believe this.  
A Serviced Component dll needs to be registered in the COM+ Catalog Before it can be registered it must be Strongly Named.  Strong Naming happens from the Visual Studio .Net Command prompt by using the sn command from the directory which contains the dll you created.
Once the dll is strongly named, it can be installed into the Global Assembly Cache (GAC).  While remaining at the Visual Studion .Net Command prompt I would do something like this gacutil /i myDLL.dll This installs the dll into the GAC.  Next, the dll needs to be registered.  I use regsvcs myDLL.dll.
There are also some other considerations that should be taken such as assigning a GUID to your dll and setting the version number of your assembly.  I would recommend reading up on COM+ components.
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

XtreemAuthor Commented:
I've done a search in the old project code in every file (*.*) for "ServicedComponent", but nothing found. But even if there was, this wouldn't have been removed in the latest code.

The application is an executable GUI Windows Application (.exe) written in C#/.NET.  So, it definitely isn't a COM+ application.  I've checked the Component Services and it isn't listed (see attached file) - The application is called PDCTradeGenerator; PDCWeb is something different.

Regarding your last three paragraphs, does this apply to a C# Windows Application executable also? Should I be running 'sn', 'gacutil' and 'regsvcs' on my executable?  And also, if so, is it possible that the new code has become unsynchronised with the old code's registering in this way (although, I would have though a complete rebuild would resolve anything like this, and I haven't done anything like this with the old code, I'm simply just building both versions of the project)?
No, if it an executable then it won't be a COM+ component.  You shouldn't register your executable.
I know you reference the amqmdnet.dll .  Do you reference any other's within the program?  
Sorry I had a hard drive which needed to be cloned today and kept me off the net.  I am just getting back on.  I have a few questions which may help me better understand your situation.
(1) What is different between your new application and the old one?  I am trying to understand the need for the new application.
(2) What references do you include within your GUI Windows App?
(3) Did you happen to add database calls within the new one?
XtreemAuthor Commented:
I found the solution for this eventually, sorry for late update...

The overloaded constructor for IBM.MQ.MQQueueManager always generates a first-chance exception, but it is safe to ignore this.  It's by design I believe.  The difference between my earlier code and current code was that I had breaking switched on for CLR Exceptions.

Please close this Question.

Thanks for everyone's input.
PAQed with points refunded (500)

EE Admin

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.