简体   繁体   中英

How to debug Com+ DLL in Delphi that normally gets run from MSC application

Although I have many years Delphi experience, this is my first exposure to Com+. My client have a Com+ application that I have to maintain. In the end-user world, the DLL gets run by a MSC (Microsoft Common Console Document) application. How can I debug this DLL? I have set the host application under the debugger options to C:\\WINDOWS\\SYSTEM32\\DLLHOST.EXE and the Parameters to /ProcessID:{Application ID from Component Services}. The DLL runs but it does not give me any exposure/access to the GUI aspects of the DLL. All my break-points are also set to green (not reachable).

Did you find this 'Application ID from Component Services' in your local configuration of the Component Services? If you do, keep the Component Services view open, and switch to the alternate report view that shows the current processes. There should be no running process for your component, until you start the debugger (and DLLHOST.EXE that will connect to the COM+ management). Only then, when a first COM+ request is made for an object of your component, the debugger will see the DLL get loaded and be able to catch exceptions and breakpoints.

In the end, this has solved my problem: Under Project -> Options -> Delphi Compiler -> Compiling: Change the Optimization to FALSE and the Stack frames to TRUE

Under Project -> Options -> Delphi Compiler -> Linking: Set the Include remote debug symbols to TRUE.

Run -> Parameters must look like this: 在此处输入图片说明

The ProcessID is the Application ID from your COM+ Application in Component Services (right click on your COM+ application and select Properties): 在此处输入图片说明

Remember to rebuild and register your DLL when all that changes have been made.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM