Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. XML in function descriptions doesn't correctly deal with less-than and greater-than

XML in function descriptions doesn't correctly deal with less-than and greater-than

Scheduled Pinned Locked Moved C#
csharptoolshelphtmlcss
2 Posts 2 Posters 13 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mike Morearty
    wrote on last edited by
    #1

    As everyone probably knows, in C# (and probably other .NET languages), you can put comments at the top of any class or function in this format (this example is for a function):

    /// <summary>super-duper function</summary>
    /// <param name="thing">the first parameter</param>
    void MyFunction(string thing)

    The great thing is that C# will automatically use these comments when doing tooltips for auto-complete. I love that. Unfortunately, it seems that auto-complete does not correctly deal with < and > characters when they appear in the XML. For example, if the following XML appears above a function:

    /// <summary>If x < y then do something</summary>

    ...then that is exactly how auto-complete will display the description of the function. It should be doing standard "entity" conversion, e.g. converting < to < and > to > and so on. (You can't just put < into the summary itself, because that's not legal in XML. Try it -- you'll get an error message in the auto-complete tooltip.) For another example of this, try typing "Directory.GetLogicalDrives(" into a C# file, and observe that the tooltip that comes up says:

    Retrieves the names of the logical drives on this computer
    in the form "<driver letter>:\".

    Oops. Microsoft, please fix the tooltip code? By the way, Visual Studio's utility for creating HTML documentation (Tools menu, "Build Comment Web Pages..." command) DOES correctly deal with < and > in the XML. Mike Morearty mike@morearty.com http://www.morearty.com

    P 1 Reply Last reply
    0
    • M Mike Morearty

      As everyone probably knows, in C# (and probably other .NET languages), you can put comments at the top of any class or function in this format (this example is for a function):

      /// <summary>super-duper function</summary>
      /// <param name="thing">the first parameter</param>
      void MyFunction(string thing)

      The great thing is that C# will automatically use these comments when doing tooltips for auto-complete. I love that. Unfortunately, it seems that auto-complete does not correctly deal with < and > characters when they appear in the XML. For example, if the following XML appears above a function:

      /// <summary>If x < y then do something</summary>

      ...then that is exactly how auto-complete will display the description of the function. It should be doing standard "entity" conversion, e.g. converting < to < and > to > and so on. (You can't just put < into the summary itself, because that's not legal in XML. Try it -- you'll get an error message in the auto-complete tooltip.) For another example of this, try typing "Directory.GetLogicalDrives(" into a C# file, and observe that the tooltip that comes up says:

      Retrieves the names of the logical drives on this computer
      in the form "<driver letter>:\".

      Oops. Microsoft, please fix the tooltip code? By the way, Visual Studio's utility for creating HTML documentation (Tools menu, "Build Comment Web Pages..." command) DOES correctly deal with < and > in the XML. Mike Morearty mike@morearty.com http://www.morearty.com

      P Offline
      P Offline
      Paul Watson
      wrote on last edited by
      #2

      I might have the wrong end of the stick here but I remember back when I first looked into XML that you had to define the "data type" of the XML entity for odd characters and entity-conversion to display properly. Unfortuanatley I am not near my XML book or VS.NET so I cannot remember how to do it, but if you know what I mean then see if defining that data type will help. Not the best solution but it might work :) regards, Paul Watson Bluegrass Cape Town, South Africa Do you Sonork? I do! 100.9903 Stormfront "The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups