Re: EnvDTE.CodeElement.get_EndPoint throws Argument exception



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
> >
>
>
>
.



Relevant Pages

  • Re: RAW vs JPEGs - Does RAW show more detail?
    ... format being used, they will all be available forever. ... Every time a new sensor comes out with its associated storage format in RAW, the c code needs to be updated with the definition for it, specific-to-type algorithms and then recompiled. ... A recent version set of dcraw.c source code has over 7000 lines of code dedicated to a plethora of sensors/models! ... filters = 0x16161616; ...
    (rec.photo.digital.slr-systems)
  • Re: When to use Rosasm, when to use Masm?
    ... just because we are tokenising for the editor and assembler whilst running ... load / save" or "plain text"...so, if you want it plain text for other ... as desired;)...once the format can only possibly be read ... the source code is saved tokenised or not...it's RosAsm's _OWN_ format, ...
    (alt.lang.asm)
  • Re: choice of character for relational division
    ... because the format is so regular. ... "Source code checks in but it doesn't check out!") ... system's own tables which were accessible to any programmer, ... level and declarative, or low level and procedural, our code ...
    (comp.databases.theory)
  • Re: Representing futuristic English
    ... let's look at this separate challenge: the challenge to decode ... >>the source code for the codecs, ... I don't know whether mp3 is closed source or open source but enough ... specifications are out there in a readable format. ...
    (rec.arts.sf.composition)
  • Re: EnvDTE.CodeElement.get_EndPoint throws Argument exception
    ... strange that your add-in prints the source code with a different format than ... "Reload Active Document from Disk" feature of my add-in does, ... > If I format the source code in the IDE using Edit>Advanced>Format ... > If I format the same source code in the Addin using SmartFormat method ...
    (microsoft.public.vsnet.ide)

Loading