Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2010 Comments with an ampersand "&" get marked as warnings

This may be a simple thing but in VB2010 I like to place my sources in the routine comments. Some URLs have embedded ampersands and this gets marked as a warning by the IDE.

''' <summary>
''' routine that creates a new file based on a definition query.
''' </summary>
''' <param name="newLoc"></param>
''' <returns></returns>
''' <remarks>
''' http://forums.esri.com/Thread.asp?c=93&f=992&t=194920#580036
''' http://forums.esri.com/Thread.asp?c=93&f=992&t=155005#452664
''' </remarks>
Public Function DoSelectLoc(ByVal newLoc As NewLocation) As Boolean
   'my routine
End Function

The two URLs above get marked with a warning. I've tried several alternate ways to write the URL but none have worked. I've tried the HTML code &#38; but that still has the ampersand. I know the IDE uses XML for the comments but there must be some way to write the URL without getting the warning and still keeping the same referenced link.

Update: Based on the discussion here http://social.msdn.microsoft.com/Forums/en-US/f14e7b55-c352-4ca5-a82c-bca3b83818db/double-ampersand-in-a-code-comment-causes-intellisense-error I decided to use the CDDATA to encapsulate my URLs like so:

''' <remarks>
''' <![CDATA[
''' http://forums.esri.com/Thread.asp?c=93&f=992&t=194920#580036
''' http://forums.esri.com/Thread.asp?c=93&f=992&t=155005#452664
''' ]]>
''' </remarks>

Seems to work to allow the links to work properly and also to not trip the Visual Studio warning.

like image 864
sinDizzy Avatar asked Nov 05 '13 17:11

sinDizzy


1 Answers

The right XML syntax is &amp; i.e.

''' <remarks>
''' http://forums.esri.com/Thread.asp?c=93&amp;f=992&amp;t=194920#580036
''' http://forums.esri.com/Thread.asp?c=93&amp;f=992&amp;t=155005#452664
''' </remarks>
like image 192
Martin Honnen Avatar answered Oct 13 '22 08:10

Martin Honnen