Re: EnvDTE.CodeElement.get_EndPoint throws Argument exception
- From: "Joginder Nahil" <JoginderNahil@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 8 Nov 2005 00:23:04 -0800
Hi Carlos,
Thanks for finding the time to respond. Nice to hear from you.
The released version of the addin VSNETcodePrint allows the user to format
the source code before printing it so that the connecting lines for the
language constructs are drawn correctly. (You can see the output samples on
my website www.starprint2000.com).
For this reason, the addin starts an Undo, format and prints the source code
and then aborts the Undo to ensure that the source code is left in its
origional state.
The error occurs if user sets option 'Leave open braces on the same line a
constrcut' from the Options -> Text Editor -> C# -> Formatting tab in the IDE
AND
The Undo context is started
AND
The source code is formatted
If you remove smart formatting then the problem does not occur. But I do
need to format the source code as I have stated in my opening paragraph above.
Regards,
Joginder Nahil
www.starprint2000.com
"Carlos J. Quintero [VB MVP]" wrote:
> Does the problem happen removing the smart formatting, that is, with a C#
> code already formatted? That is, can we remove the smart formatting from
> your code to better diagnose the problem?
>
> --
>
> Best regards,
>
> Carlos J. Quintero
>
> MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
> You can code, design and document much faster.
> Free resources for add-in developers:
> http://www.mztools.com
>
> "Joginder Nahil" <JoginderNahil@xxxxxxxxxxxxxxxxxxxxxxxxx> escribió en el
> mensaje news:5282CF04-788F-44CD-9A7C-3E459999BEE0@xxxxxxxxxxxxxxxx
> >I have an Addin written VB which prints the source code in a .NET project.
> > The addin formats the source code using SmartFormat before printing the
> > source code.
> >
> > Here is a code in the addin that formats the source code:
> >
> > dim ce as CodeElement
> > dim td as textDocument
> > dim pi as ProjectItem
> >
> > ' Determine project Item under the cursor
> > td = applicationObject.ActiveDocument.Object
> > ce = td.Selection.ActivePoint.CodeElement(vsCMElement.vsCMElementClass)
> > pi = ce.ProjectItem
> >
> > ' Format the project item
> > td = DirectCast(pi.Document.Object, TextDocument)
> > td.StartPoint.CreateEditPoint.SmartFormat(td.EndPoint.CreateEditPoint)
> >
> > For Each ce In ProjItem.FileCodeModel.CodeElements
> > Debug.WriteLine( ce.EndPoint.Line ) ' ce.EndPoint.Line fails here
> > Next
> >
> > Line debug line in the For .. Next above fails with Argument exception:
> >
> > 'The parameter is incorrect' at ENVDTE.CodeElement.get_EndPoint()
> >
> > The error only occurs if I set option 'Leave open braces on the same line
> > a
> > constrcut' from the Options -> Text Editor -> C# -> Formatting tab in the
> > IDE
> >
> > How can I avoid the error?
> >
> > A test Addin that demonstrates the error can be downloaded using the
> > following link:
> >
> > http://www.starprint2000.com/downloads/beta/getendpointtest.zip
> >
> >
> > Regards,
> > Joginder Nahil
> > www.starprint2000.com
> >
> >
> >
> > If I check the option 'Leave open braces on the same line as construct' on
> > the C# Formatting options in the IDE then the an
> >
>
>
>
.
- References:
- Re: EnvDTE.CodeElement.get_EndPoint throws Argument exception
- From: Carlos J. Quintero [VB MVP]
- Re: EnvDTE.CodeElement.get_EndPoint throws Argument exception
- Prev by Date: RE: Suppressing stupid things in the IDE when working with Datasets
- Next by Date: [VS2005] Parallel batch builds?
- Previous by thread: Re: EnvDTE.CodeElement.get_EndPoint throws Argument exception
- Next by thread: Re: EnvDTE.CodeElement.get_EndPoint throws Argument exception
- Index(es):
Relevant Pages
|