Visual Studio 2005 SDK (December 2005 CTP) Released
- 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
- 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
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
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
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)
- 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
- 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 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
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
- I've tried with Feb. CTP and the problem remains. Thank you all for the ideas though.

