Microsoft Knowledge Base Email Alertz

(327094) - Describes a problem where the definitions for the interface UCOMIEnumVARIANT Clone and Next methods are wrong in the .NET Framework.

Search KbAlertz

Advanced Search

Receive Microsoft Knowledge Base articles by E-Mail?

Every night we scan the Microsoft Knowledge Base. If technologies you're interested in are updated, we'll send you an e-mail. You only get one e-mail a day, and only when new articles are added.

Click here to create a
FREE account
Already have an account?
[Click here to Login]











Microsoft Knowledge Base Article

This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks

Article ID: 327094 - Last Review: September 13, 2005 - Revision: 1.5

BUG: The UCOMIEnumVARIANT interface definitions for the Clone method and for the Next method are incorrect in the .NET Framework 1.1 and in the .NET Framework 1.0

This article was previously published under Q327094

SYMPTOMS

The signatures for the unmanaged IEnumVARIANT::Next method and for the IEnumVARIANT::Clone method are the following.
IEnumVARIANT::Next
HRESULT Next( 
  unsigned long  celt,              
  VARIANT FAR*  rgVar,              
  unsigned long FAR*  pCeltFetched  
);


IEnumVARIANT::Clone
HRESULT Clone( 
  IEnumVARIANT FAR* FAR*  ppEnum  
);
However, the UCOMIEnumVARIANT interface does not define these methods correctly. The following are the current incorrect signatures for these methods.
UCOMIEnumVARIANT.Next
int Next(
   int celt,
   int rgvar,
   int pceltFetched
);

UCOMIEnumVARIANT.Clone
void Clone(
   int ppenum
);
Note In the UCOMIEnumVARIANT.Next method, the rgvar parameter is defined as an int instead of as an object. Additionally, in the UCOMIEnumVARIANT.Clone method, the ppenum parameter is defined as an int instead of as UCOMIEnumVARIANT. Therefore, it is difficult to use the UCOMIEnumVARIANT interface to enumerate a collection of variants.

WORKAROUND

You can write you own definition of the IEnumVARIANT interface. The following code is an example on how to do this.
[
ComImport(),
Guid("00020404-0000-0000-C000-000000000046"),
InterfaceType(ComInterfaceType.InterfaceIsIUnknown)
]
interface IEnumVARIANT
{
	[PreserveSig()]
	int Next(
		int celt,
		out object rgVar,
		out int pCeltFetched);

	[PreserveSig()]
	int Skip(
		int celt);

	[PreserveSig()]
	uint Reset();

	IEnumVARIANT Clone();
}

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.

MORE INFORMATION

For more information, visit the following Microsoft Developer Network (MSDN) Web sites:
IEnumVARIANT interface
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/automat/htm/chap5_6t2d.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/automat/htm/chap5_6t2d.asp)

UCOMIEnumVARIANT interface
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemRuntimeInteropServicesUCOMIEnumVARIANTClassTopic.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemRuntimeInteropServicesUCOMIEnumVARIANTClassTopic.asp)

APPLIES TO
  • Microsoft .NET Framework 1.1
  • Microsoft .NET Framework 1.0
  • Microsoft Visual Studio .NET 2003 Professional Edition
  • Microsoft Visual Studio .NET 2003 Enterprise Architect
  • Microsoft Visual Studio .NET 2003 Enterprise Developer
  • Microsoft Visual Studio .NET 2002 Professional Edition
  • Microsoft Visual Studio .NET 2002 Enterprise Architect
  • Microsoft Visual Studio .NET 2002 Enterprise Developer
Keywords: 
kbvs2002sp1sweep kbtshoot kbprb kbbug KB327094
       

Community Feedback System

Very often, it takes hours to solve a problem. Very often, you've looked high and low, and have tried a lot of solutions. When you finally found it, chances are, it was because someone else helped you. Here's your chance to give back. Use our community feedback tool to let others know what worked for you and what didn't.

Please also understand that the community feedback system is not warranted to be correct, it's simply a system that we've built to let people try and help each other. If something in a feedback response doesn't make sense to you, or you're not comfortable making changes that the feedback talks about (like registry edits), please consult a professional.

Thank you for using kbAlertz.com Feedback System.

-- Scott Cate