crash in mscorwks on 'simple' call, should be IUnknown but looks like it is trying IDispatch

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Chad DePue (cbdepue_at_hotmail.com)
Date: 07/15/04


Date: Thu, 15 Jul 2004 16:01:16 -0700

Hello,

I have a COM interface that looks like the one below (this is a simplied
version). IFolder.GetNextItem always returns a subclass of IMyItem. The
implemented classes for this typelib are in C# (SDK 1.1), the caller is a
Win32 app. When my Win32 class gets a subclass of IMyItem and calls
GetPropSz, it crashes with the callstack below in mscorwks.dll.

The thing i can't understand is why mscorwks appears to be doing an
IDispatch call when the typelibrary is all based on IUnknown. For testing
purposes right now I'm just returning a hard coded string in the C# class
"foobar".

Please help me figure out why this is crashing! Thanks in advance...

   [
        object,
        uuid(FB439F4D-CB3F-45d6-B383-289C86019CE9),
        helpstring("IFolder Interface"),
        pointer_default(unique)
    ]
    interface IFolder : IUnknown
    {

    HRESULT GetNextItem(
            [in] REFIID riid,
            [out, iid_is(riid)] IUnknown **ppunkOut
            )

    }

    [
        object,
        uuid(7D2A6BE3-B279-4728-9CFD-11DEA19F9665),
        helpstring("IItem Interface"),
        pointer_default(unique)
    ]
    interface IMyItem : IUnknown
    {

//--------------------------------------------------------------------------
-
        // GetPropSz
        //
        // Gets a string-based property for this object.

        HRESULT GetPropSz(
            [in] ITEM_PROP ipProp,
            [out] LPWSTR *ppszValue
            );

     ...

Stack Trace

-----------------

00fff774 79314d48 082effe4 0012074c 77f51c48
mscorwks!Dispatch_GetTypeInfoCount+0x2a (FPO: [Non-Fpo])

00fff78c 79314d85 00fff798 082effe4 00000005
mscorwks!Dispatch_GetTypeInfoCount_CallBack+0x25 (FPO: [Non-Fpo])

00fff7a4 100544a5 082effe4 00000005 00fffa20
mscorwks!Dispatch_GetTypeInfoCount_Wrapper+0x21 (FPO: [Non-Fpo])

00fffa2c 10053f71 082effe4 100bbaa8 007c27e8
dac!CStoreHandler::_AssignBuilderObjField+0xd5 (FPO: [Non-Fpo]) (CONV:
thiscall) [c:\dac\storehandler.cpp @ 3753]

00fffa6c 1004efd1 082effe4 00fffbf4 00ffff34
dac!CStoreHandler::_CreateMsgObject+0x111 (FPO: [Non-Fpo]) (CONV: thiscall)
[c:\dac\storehandler.cpp @ 3638]

00fffac8 1009c6d3 00000001 00fffbf4 00000000
dac!CStoreHandler::getPage+0x1b1 (FPO: [Non-Fpo]) (CONV: thiscall)
[c:\dac\storehandler.cpp @ 1157]

00fffe58 1009b654 007c24b8 0000016e 00000000
dac!CmdHandler::_HandleCommand+0x1073 (FPO: [Non-Fpo]) (CONV: thiscall)
[c:\util\cmdhandler.cpp @ 1144]

00fffe70 1004b56c 007c24b8 0000016e 00000000
dac!CmdHandler::HandleCommand+0x44 (FPO: [Non-Fpo]) (CONV: thiscall)
[c:\util\cmdhandler.cpp @ 709]

00ffff68 1006a6bc 00000008 00000000 00000000 dac!CStoreUser::DoWork+0x1cc
(FPO: [Non-Fpo]) (CONV: thiscall) [c:\dac\storeuser.cpp @ 483]

00ffff80 10075ec3 007c1a70 77f51c48 ffffffff dac!UserThreadExt+0x15c (FPO:
[Non-Fpo]) (CONV: stdcall) [c:\dac\usrmgr.cpp @ 6524]

00ffffb4 77e7d33b 007c1f88 77f51c48 ffffffff dac!_threadstartex+0x73 (CONV:
stdcall) [threadex.c @ 212]

00ffffec 00000000 10075e50 007c1f88 00000000 kernel32!BaseThreadStart+0x37
(FPO: [Non-Fpo])



Relevant Pages

  • Re: Question about Abstract classes and Interfaces
    ... Cylinder and Circle classes all implement the interface. ... Secondly, about Abstract classes. ... It can't be a calendar object ... you can use its name to refer to any instance of a subclass. ...
    (comp.lang.java.programmer)
  • Re: How about "pure virtual methods"?
    ... doesn't implement all the interface. ... based on the existence of "isinstance" in Python. ... subclass of a given type. ... So I conclude that a subclass, in Python, must implement the interface ...
    (comp.lang.python)
  • Re: How To Branch Java
    ... I've been told that people use source control. ... > code in sync with the production code. ... interface is used in production. ... and subclass can be tested, ...
    (comp.lang.java.programmer)
  • Re: Problems with inheritance!
    ... public void meth1; ... variates from subclass to subclass.... ... When I use an Interface, I have to write duplicated code, havent't I? ... Why particularly extend should be avoided you can read article at ...
    (comp.lang.java.programmer)
  • Re: Pickling and inheritance are making me hurt
    ... > these classes by writing other modules that subclass both of them as ... > to interface with particular search engines. ... > It seems like the problem is that _saveresults is only looking inside ... Maybe this interferes with pickling your first instance? ...
    (comp.lang.python)