Trying to debug VS2010 C# code that uses IBM WMQ (amqmdnet.dll)

1

I'm using IMB WMQ library to connect to a queue manager.

This is a code I use for a long time, it was created by a friend in VS2005 and I updated to be used in VS2010. It works fine when I use integrated with LoadRunner tool to run some performance scripts. However when I try to debug it returns the following error:

{"Unable to load DLL '**amqxcs2.dll**': The handle is invalid. (Exception from HRESULT: 0x80070006 (E_HANDLE))"}

This is something related to debugging external DLL, but I didn't find out how to resolve.

I used the following command to register the dll into GAC:

gacutil /I "C:\Program Files\IBM\WebSphere MQ\bin\amqmdnet.dll"

When I tried to add amqxcs2.dll it returns an error:

gacutil /I "C:\Program Files\IBM\WebSphere MQ\bin\amqxcs2.dll"
Failure adding assembly to the cache:   The module was expected
to contain an assembly manifest.

I have VS2010 Ultimate running on a Windows Server 2003.

When running the code inside Loadrunner I'm able to put and get messages from the queues, but I'm not able to debug.

There's a similar post here, but it doesn't have a solution.

c#
.net
ibm-mq
asked on Stack Overflow Apr 13, 2012 by Ricardo • edited May 23, 2017 by Community

2 Answers

0

Why do you think "make sure the library is either where the application needs it to be" is not a solution?

You need to either properly install whatever product your are using on the machine you plan to use it or cheat your way through by copying necessary files to correct places by hand (and figuring "correct places" by hand too. SysInternals tools may be helpful to track what files an application tries to use).

answered on Stack Overflow Apr 13, 2012 by Alexei Levenkov
0

This may be a COM error. The IBM assembly is probably a native dll and so you cannot register it in the GAC, which is for .NET dlls only. Native COM dlls can be registered with Regsvr32. This error can also occur if a native dll has a dependency on another dll that is missing. Also see Understanding Dependencies of a Visual C++ Application which gives information about the Dependency Walker tool that can be used to figure out the depndencies for a native dll.

answered on Stack Overflow Apr 13, 2012 by JamieSee • edited Apr 13, 2012 by JamieSee

User contributions licensed under CC BY-SA 3.0