Visual Studio Developer Center > Visual Studio Forums > Visual Studio Extensibility > Visual Studio 2005 SDK (December 2005 CTP) Released
Ask a questionAsk a question
 

AnswerVisual Studio 2005 SDK (December 2005 CTP) Released

  • Wednesday, January 04, 2006 6:10 PMJillaint Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I installed this sdk but having trouble to get it to work with our package. The error message is "The object already has a CCW associated with it. Parameter name: o". Could anybody shine a light?

    Thanks,
    Jillaint

Answers

  • Thursday, January 05, 2006 8:39 PMJillaint Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Aaron,

    I found the place that cause the error, it is in ProjectFactory, IVsProjectFactory.CreateProject function. Part of code in this function is new in Dec. CTP. I believe an incident has already been created to address this problem.

    Thanks,
    Jillaint
  • Wednesday, February 15, 2006 10:34 PMCraig Skibo - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    THis occurs when you have a reference on a COM object, convert it to an IntPtr, then try to convert it back to a COM object reference. A wrapper object for that COM pointer already exists and the framework cannot create a second one so it fails. Try to pass around the COM reference rather than the wrapped object.

    This is a .NET framework issue, and not specific to Visual Studio.

    Craig

  • Thursday, February 16, 2006 7:32 PMRusty DeschenesModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    In your specific scenario, what this means is that a CCW (COM Callable Wrapper) was created for your project object before it was aggregated.

    I would recommand first trying this out with the February CTP since we did fix a number of bugs related to projects since then. If that still repro after that, you should look at what happens between the time the project object is created and the time it is aggregated.

    Rusty

All Replies

  • Wednesday, January 04, 2006 11:59 PMAaron MartenMSFT, OwnerUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi Jillaint,

    Could you provide a little more information? What exactly are you trying to do?

    Do you mean that you rebuilt your package with the December SDK and now you are seeing this error? Was this working with the October 2005 SDK? Can you determine when it is occurring?

    Based on my glances through the VS 2005 source code, this seems to be an exception that is thrown in Marshal.CreateAggregatedObject. How are you calling this method?

    Thanks,

    Aaron Marten (MSFT)

  • Thursday, January 05, 2006 8:39 PMJillaint Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Aaron,

    I found the place that cause the error, it is in ProjectFactory, IVsProjectFactory.CreateProject function. Part of code in this function is new in Dec. CTP. I believe an incident has already been created to address this problem.

    Thanks,
    Jillaint
  • Monday, January 16, 2006 9:57 PMJillaint Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Aaron,

    The exception is caused by CreateAggregatedObject. If I put a catch around it, the exception message is what I saw before “The object already has a CCW associated with it. Parameter: o”. If I ignore the exception and continue, it gives me another error message:”The operation could not be completed. Unspecified error.”

                try

                {

                    wrapperUnknown = Marshal.GetIUnknownForObject(wrapper);

                       innerUnknown = Marshal.CreateAggregatedObject(wrapperUnknown, project);

                }

                finally

                {

                    if (wrapperUnknown != IntPtr.Zero)

                    {

                        Marshal.Release(wrapperUnknown);

                    }

                }


    Do you know what could be wrong here? Can I comment out this code so that I can try the new features in this SDK?

    Thanks,
    Jillaint
  • Wednesday, February 15, 2006 10:34 PMCraig Skibo - MSFT Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    THis occurs when you have a reference on a COM object, convert it to an IntPtr, then try to convert it back to a COM object reference. A wrapper object for that COM pointer already exists and the framework cannot create a second one so it fails. Try to pass around the COM reference rather than the wrapped object.

    This is a .NET framework issue, and not specific to Visual Studio.

    Craig

  • Thursday, February 16, 2006 7:32 PMRusty DeschenesModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    In your specific scenario, what this means is that a CCW (COM Callable Wrapper) was created for your project object before it was aggregated.

    I would recommand first trying this out with the February CTP since we did fix a number of bugs related to projects since then. If that still repro after that, you should look at what happens between the time the project object is created and the time it is aggregated.

    Rusty

  • Wednesday, February 22, 2006 4:42 PMJillaint Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I've tried with Feb. CTP and the problem remains. Thank you all for the ideas though.