Click to See Complete Forum and Search --> : How to debug MTS component


reverse
April 5th, 1999, 11:51 AM
I composed a MTS component, in-process DLL.
Being tested, it has errors.
But I don't know how to debug.
What is the procedure to debug MTS component in VC++.

Regards

A programmer who loves Goethe.

Robert Dobbins
April 6th, 1999, 12:45 PM
Under Project Settings - Debug Tab. Set the Executable for Debug Session to Winnt/System32/mtx.exe. Under Program arguments put /p: and the GUID for the MTS Package includeing {}. Set a break point and debug

mohanpc
February 29th, 2000, 07:04 PM
The following is some information which will be helpfull when you have written ATL COM component and testing the ATL COM component in VB Client.

To facilitate application debugging using Visual Basic, you can debug a component that uses ObjectContext by enabling a special version of the object context. This debug-only version is enabled by creating the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Transaction

Server\Debug\RunWithoutContext
Steps to Create the Registry Key
Start Regedit and locate the following registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Transaction Server


Now, select the Debug key, right-click and then choose New. Next, choose Key and then name this new key RunWithoutContext.


Now that this registry entry is present on your computer, you should now be able to run your MTS component using Visual Basic.



In VC++ the following settings need to be don

ActiveX DLL Running Under Microsoft Transaction Server (MTS): To set
this up, select Settings from the Visual C++ 5.0 Project menu, and then click the Debug tab. In the Executable for debug session text box, specify MTX.EXE. Then, in the Program arguments text box place /p:{00000000-0000- 0000-0000- 000000000000} where you would replace the 0's with the actual MTS Package ID. The Package ID can be obtained by examining the properties of your package in the Transaction Server Explorer. Following step 4a above which will launch MTX.EXE and your .dll. Now run the base client .exe that makes a call into your COM component running under MTS and the Visual C++ 5.0 debugger will come up where you set the breakpoint in your .dll.
Select the Transaction Server key, right-click the selection and choose New. Next, choose Key and then name this new key Debug.

Joe L
April 6th, 2000, 03:38 PM
Can VC++ 6.0 do the debug to these VB components? I tried and failed.

AlbertoImedio
April 19th, 2001, 10:11 AM
You can also add a exe project to the MTS project and use it as starting point to your MTS DLL.
For example with this MTS Component

interface IArrayTest : IDispatch
{
[id(1), helpstring("method test")] HRESULT test(VARIANT *pArray);
[propget, id(2), helpstring("property Array")] HRESULT Array([out, retval] VARIANT *pVal);
[propput, id(2), helpstring("property Array")] HRESULT Array([in] VARIANT newVal);
[id(3), helpstring("method array2")] HRESULT array2([in] VARIANT *pArray, [in,out] VARIANT *size);
[id(4), helpstring("method Array3")] HRESULT Array3([in] VARIANT *pArray);
};

You can use this code in a method of your exe program

hr = CoInitialize(NULL);
BSTR err = NULL;
_variant_t resultado;
long tamanno = 0;

try{
IArrayTestPtr spArrayTest(__uuidof(ArrayTest));
//spArrayTest->array2((VARIANT*)psa, &resultado);
spArrayTest->array2((VARIANT*)NULL, &resultado);
}
catch(_com_error &e)
{
strcpy((char*)err, (_bstr_t)(e.Description()));
return;
}

You can use breackpoints in the “caller” code and in the COM code, (If you are using Win32 Debug as your active configuration)

AlbertoImedio
April 23rd, 2001, 06:11 AM
In Windows 2000?
There is no mtx.exe.