Search the web
Sign In
New User? Sign Up
vsnetaddin · Visual Studio.NET Add-ins
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
System.Runtime.InteropServices.COMException - Unspecified error   Message List  
Reply | Forward Message #3872 of 3878 |
Re: System.Runtime.InteropServices.COMException - Unspecified error


--- In vsnetaddin@yahoogroups.com, "noha_assem2030" <noha_assem2030@...>
wrote:
>
> i've an add-in to document classes in XML style, i'm trying to
determine
> the type of a CodeElement as follows:
>
> Dim fcmFileCodeModel As FileCodeModel =
> DTE.ActiveDocument.ProjectItem.FileCodeModel
>
> Dim editPoint As EditPoint =
> DTE.ActiveDocument.Selection.TopPoint.CreateEditPoint()
>
> Dim ceElement as CodeElement =
> editPoint.CodeElement(vsCMElement.vsCMElementProperty)
>
> on the previous line i get the error:
> editPoint.CodeElement(EnvDTE.vsCMElement.vsCMElementProperty)
> Overload resolution failed because no accessible 'CodeElement' is most
> specific for these arguments:
> 'Public Overridable ReadOnly Property CodeElement(Scope As
> EnvDTE.vsCMElement) As EnvDTE.CodeElement': Not most specific.
> 'Public Overridable ReadOnly Property CodeElement(Scope As
> EnvDTE.vsCMElement) As EnvDTE.CodeElement': Not most specific.
>
> and when i try to use the FileCodeModel object:
>
> ceElement =
>
fcmFileCodeModel.CodeElementFromPoint(DTE.ActiveDocument.Selection.Activ\
\
> ePoint, vsCMElement.vsCMElementProperty)
>
> i get the following exception:
> fcmFileCodeModel.CodeElementFromPoint(editPoint,
> vsCMElement.vsCMElementProperty) Run-time exception thrown :
> System.Runtime.InteropServices.COMException - Unspecified error
>
> And strange enough it works fine with Classes & Functions , What is
> missing??

I've found the solution in the following link:
HowTo: Get a code element at the cursor from a visual studio.net macro
or add-in <http://www.mztools.com/articles/2006/MZ2006009.aspx>



[Non-text portions of this message have been removed]




Sun Jun 22, 2008 12:40 pm

noha_assem2030
Offline Offline
Send Email Send Email

Forward
Message #3872 of 3878 |
Expand Messages Author Sort by Date

i've an add-in to document classes in XML style, i'm trying to determine the type of a CodeElement as follows: Dim fcmFileCodeModel As FileCodeModel = ...
noha_assem2030
Offline Send Email
Jun 22, 2008
9:31 am

... determine ... fcmFileCodeModel.CodeElementFromPoint(DTE.ActiveDocument.Selection.Activ\ \ ... I've found the solution in the following link: HowTo: Get a...
noha_assem2030
Offline Send Email
Jun 22, 2008
12:40 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help