Microsoft.com
All DevCenters
MSDN Home
MSDN Code Gallery:
Code Gallery Home
|
Browse Gallery
|
Share Code
|
Help and FAQs
StyleCop
Home
Downloads
Discussions
Issue Tracker
People
License
Close
RSS
All Resource Updates
Discussions
Issue Tracker
Releases
Wiki
RSS
Previous
|
All
|
Next
Item
1
of
1
Basic View
|
Advanced View
|
Create New Item
25
votes
vote
SA1644 triggered in example code blocks
Description
SA1644 should not be triggered inside a <code/> comment block. In the attached example file there are 2 methods in the <code/> block separated by a single line, which triggers SA1644.
File Attachments
ExampleSA1644.cs
Comments
most recent at top
(
show oldest at top
)
hanscf
wrote
May 18 at 1:48 PM
Same thing for <pre> blocks, for those of us embedding some HTML here...
/// <remarks>
/// <para>The algorithm works as follows:</para>
/// <pre>
/// PseudoCode(x):
/// ...
///
/// MorePseudoCode(y):
/// ...
/// </pre>
/// </remarks>
MikeRosenblum
wrote
May 7 at 11:52 PM
I, too, find that it makes sense for SA1644 to not apply to XML comments between 'code' tags. Here is a portion from a recent example from my code:
/// <code>
/// System.Globalization.Cult
ureInfo enUsCulture = new CultureInfo("en-US");
/// System.Globalization.Cult
ureInfo frFrCulture = new CultureInfo("fr-FR");
///
/// // Save original Culture (to be restored at the end).
/// System.Globalization.Cult
ureInfo originalCulture =
/// System.Threading.Thread.C
urrentThread.CurrentCultu
re;
///
/// // Set current culture to "fr-FR" for this test.
/// Thread.CurrentThread.Curr
entCulture = frFrCulture;
///
/// // The following reports "fr-FR".
/// MessageBox.Show(System.Th
reading.Thread.CurrentThr
ead.CurrentCulture.ToStri
ng());
///
/// // Etc...
/// </code>
Restricting this to not have spaces makes for an ugly grouping that is very hard to read. :-(
I respectfully urge that this rule be modified to not flag spaces between code tags.
Thanks for your consideration,
Mike Rosenblum
btjdotnet
wrote
Mar 26 at 5:56 PM
Has anyone found a work-around to this? I tried adding <para> tags as the warning suggested, but then they showed up in my documentation. If there is no work-around other than disabling the whole rule, then the impact seems a bit more than "low" to me.
jasonall
wrote
Feb 19 at 4:51 PM
Another example:
/// <summary>
/// Gets or sets a value indicating whether counters are available.
/// </summary>
/// <value>
/// <c>true</c> if counters are available; otherwise, <c>false</c>.
/// </value>
private static Boolean CountersAreAvailable
{
get;
set;
}
jasonall
wrote
Oct 7 2008 at 5:16 PM
/// <summary>
/// Removed this for clarity.
/// </summary>
/// <example>
/// Removed this for clarity.
/// <code>
/// <![CDATA[
/// public class ClassA : ClassBase
/// {
/// public ClassA(int identifier)
/// : base(identifier)
/// {
/// }
/// }
///
/// public class ClassB : ClassBase
/// {
/// public ClassB(int identifier)
/// : base(identifier)
/// {
/// }
/// }
/// ]]>
/// </code>
/// </example>
In here I think the empty line is fine.
Close Work Item
Comment:
Work Item Details
Item #
97
Status
Proposed
Type
Issue
Impact
Low
Release
StyleCop 4.3.2.1
Assigned To
Unassigned
Component
No Component Selected
Reported On
Sep 18 2008 at 6:50 AM
Reported By
JohnBates
Updated On
Oct 8 at 12:33 PM
Updated By
KrisVandermotten
Closed On
n/a
Closed By
n/a
Wiki Link
[workitem:97]
Manage Your Profile
Legal
Contact Us
MSDN Flash Newsletter
© 2008 Microsoft Corporation. All rights reserved.
Terms of Use
Trademarks
Privacy Statement
Updating...