Microsoft KB Archive/907298

= The VCCodeParameter.Name property returns an empty string in Visual Studio 2005 =

Article ID: 907298

Article Last Modified on 2/4/2006

-

APPLIES TO


 * Microsoft Visual Studio 2005 Standard Edition
 * Microsoft Visual Studio 2005 Professional Edition
 * Microsoft Visual Studio 2005 Express Edition

-





SYMPTOMS
When you use the VCCodeParameter.Name property to obtain the name of a template parameter in Microsoft Visual Studio 2005, the VCCodeParameter.Name property returns an empty string.



WORKAROUND
To work around this problem, use the VCCodeParameter.TypeString property. The VCCodeParameter.TypeString property returns the name of the parameter preceded by the text &quot;typename.&quot; The following text is an example of the text that is returned by the VCCodeParameter.TypeString property:

typename T



STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.



Steps to reproduce the problem
 Start Visual Studio 2005. Expand Visual C++, and then click Win32. Create a new Win32 console application that is named Test.  Add the following code to the Test.cpp file. template  class TEST {};  To display Macro Explorer, press ALT+F8.</li> Click Tools, click Macros, and then click New Macro Project.</li> Add a new macro project that is named MacroProject1.</li> In Macro Explorer, expand MacroProject1, and then double-click Module1.</li> In Project Explorer, add a reference to the Microsoft.VisualStudio.VCCodeModel.dll component.</li>  Add the following Imports statements before the definition of Module1. Imports Microsoft.VisualStudio.VCCodeModel </li>  Add the following code to Module1. Sub Macro1 Dim fcm As VCFileCodeModel = DTE.ActiveDocument.ProjectItem.FileCodeModel Dim c1 As VCCodeClass = fcm.Classes.Item(1) Dim p1 As VCCodeParameter = c1.TemplateParameters.Item(1) MsgBox(p1.Name) End Sub </li> Close the Macros IDE.</li> Put the insertion point in the Test.cpp file.</li> In Macro Explorer, right-click Macro1, and then click Run.

You receive a message that contains an empty string.</li></ol>

Keywords: kbinfo kbtshoot kbbug kbprogramming kbprb KB907298

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.