Solved

CoCreateInstance augers in.... how to debug?

Posted on 2004-08-25
6
1,101 Views
Last Modified: 2013-12-27
I have the following code (fragment below) that worked *perfectly* for the past 8 months.  Short of removing it and generating a lot of work for me in the next 48 hours, time I do not have, I need suggestions for debugging this.

Fragment:

      hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
      if (SUCCEEDED(hr))
      {
            // Create instance of engine COM server.
            hr = CoCreateInstance(CLSID_EngineData, NULL, CLSCTX_INPROC_SERVER,
                  IID_IEngineData, (void**) &m_pIEngineData);
            if(!SUCCEEDED(hr))
            {...


Some system specifics:
  Target device is an x86 cpu running Windows CE.net 4.1.
  I have multiple custom activeX controls in this project, all apartment threaded.
  I have a COM dll that has not changed in many months.  Code fragment above loads this COM object.
    threading is apartment as well.

Execution comes to this code and executes the CoInitializeEx and proceeds to the CoCreateInstance.  Attempting to execute the CoCreateInstance (in debug) I receive a dialog:  "User breakpoint called from code at 0x1dc6fa46."  At this point I'm stuck in assembly code, the call never returns and I have no error code.

Any ideas how to go about diagnosing this?  My current thoughts are that I #$% something up on my target device or on my development laptop, but without an error code, I don't know what.  I've re-registered everything, so short of just deleting the code (and avoiding the problem), I'm stuck.

This issue is critical as it has brought my progress to a standstill, hence the high point value.  I'll throw in some donuts as well.
0
Comment
Question by:charles_gilley
  • 3
  • 3
6 Comments
 
LVL 23

Expert Comment

by:chensu
ID: 11898268
What does the call stack look like when it breaks in the debugger? Do you have all the source code especially the COM object (CLSID_EngineData)?
0
 

Author Comment

by:charles_gilley
ID: 11898517
No, and this is the most frustrating thing - nothing but pure assembly and hex code.  

For what it's worth, I've even gone back three prior build versions, spanning 3 weeks, and they all fail in the same way.  So, common thread is the development environment and target device.  
0
 
LVL 23

Expert Comment

by:chensu
ID: 11898558
Since it worked for the past 8 months, what has changed? Can you create a small new application simply doing the CoCreateInstance() to see what happens?
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 

Author Comment

by:charles_gilley
ID: 11898698
All of my activeX stuff is GUI related, so I have created a simple app and validated that each of them load and execute correctly.  I've not trimmed down the application for three reasons: 1) hadn't thought of it, 2) time constraints, and 3) (this is the main one), the CoCreateInstance happens so early in the application launch that I just didn't think it was necessary.  Yet, you have a valid point, and it is something I can do easily.

I'm on USA East Coast time, and my batteries are shot.  I may get a chance to post results tonight, but more likely tomorrow morning.  Chensu, I appreciate the questions....
0
 
LVL 23

Accepted Solution

by:
chensu earned 500 total points
ID: 11898858
If you can reproduce the same problem with a standalone application, the bug is likely in the COM object. If not, you will need to look into your application.
0
 

Author Comment

by:charles_gilley
ID: 12041114
Chensu - turns out that there was a major memory bug lurking since who knows how long (8 months at least :)).  Once I located that, the crash went away.  I then ripped the COM code out, since I wasn't really using it anyway.
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article shows how to setup the internet connectivity on Windows Mobile Emulator.   I assume that you already have Microsoft Visual Studio, Microsoft Windows Mobile SDK's and the emulator installed. The emulator is available with Visual Studi…
Preface: This article is part of a series focused on cross platform mobile app development (specifically Android and iOS) using the Alloy framework and Titanium Studio made by Appcelerator (https://www.appcelerator.com/). This article presumes a wor…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question