Solved

C++ COM object debugging notes

Posted on 2001-09-01
3
574 Views
Last Modified: 2006-11-17
I have a COM object that runs correctly in the debugger when using an MS Visual C++ client driver in Windows 98, all return flags are valid (0x00) and no unusual messages are generated in the debug window.

I ran the COM object through the debugger using an MS VB client as a driver program, again in Windows 98. The program runs correctly but I notice the C++ debug window notes a first chance exception is raised during the call to CoUninitialize():

(MSADCE.DLL): 0xC0000005: Access Violation.

Note: the message is issued but the program terminates without throwing an exception.

I found a note in MSDN saying that this message is occasionally raised by CoUninitialiize() and can be "safely ignored."  ( WHAT?! )

Finally, when a colleague tested my COM object using a MS VB client on Windows NT, the program crashed and raised a memory read exception 0x0000008

It is required that the COM object should run on Windows NT. Is anyone able to point me in the right direction or give me some ideas?

0
Comment
Question by:jtm111
3 Comments
 
LVL 49

Accepted Solution

by:
DanRollins earned 200 total points
ID: 6448427
>> ...and can be "safely ignored."  ( WHAT?! )

When the MS dox say that it usually means that the error is trapped and fixed by a higher level exception handler.

It is fairly common.  You should see the stream of them that appears when hosting a webbrowser control.

>>... the program crashed and raised a memory read exception 0x0000008

Did this happen at the very end... at the same time that you would have see the message in the trace screen?  What I'm saying is... is there any chance that this crash was not related to the unhandled (yet handled) expection?

If you are fairly certain that this is the issue, then the problem may relate to an try...catch that you use in the area.  When an exception occurs in an exception handler, things can go round and round and get pretty nasty.   If so, try removing your own try...catch handling and check the result.

-- Dan
0
 
LVL 1

Expert Comment

by:kanejin
ID: 6453005
We can generally ignore the 1st exception because it should be handled by the program itself. (Q105675)

For the problem you met on NT, you can check the code and verify there is no memory leak.
0
 
LVL 3

Author Comment

by:jtm111
ID: 6467178
Thanks, I was convinced the exception was not being handled. You saved me at least a week of wasted effort trying to solve the wrong problem.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

813 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now