R# and Stylecop formatting of XML Doc Comments

I've seen many threads out there on the correct combination of R# and Stylecop cleanup settings to get XML Doc Comments formatted as desired. However, I cannot seem to get the right combination for what I am looking for.

R#: 7.1.2000.1478
StyleCop: 4.7.44.0
Visual Studio 2012
C#

Before cleanup:
/// <summary>
/// Handle the add video source option and open the video source dialog
/// </summary>
/// <param name="sender">Sending object</param>

/// <param name="e">Event Args</param>

After cleanup:
/// <summary>
/// Handle the add video source option and open the video source dialog
/// </summary>
/// <param name="sender">

/// Sending object
/// </param>
/// <param name="e">
/// Event Args
/// </param>

Desired result (same as "Before cleanup"):
/// <summary>
/// Handle the add video source option and open the video source dialog
/// </summary>
/// <param name="sender">Sending object</param>

/// <param name="e">Event Args</param>

Basically, I do not want the XML Doc Comments formatted on cleanup. If some of the comments are single line (like the param tags above), leave them be. If some of the comments are multiline (like the summary tag above), leave them be. So attached to this post are my current settings, that are formatting everything as the "After Cleanup" section above.

Thanks!



Attachment(s):
XmlDocFormattingStyle(3).PNG
ToolsStylecopSettings.PNG
CodeCleanupC#.PNG
CodeCleanup_StyleCop_2.PNG
CodeCleanup_StyleCop_1.PNG
2 comments
Comment actions Permalink

Hello Tara,

It looks like a StyleCop issue here, not ReSharper's fault.

Basically, R# options with 'Keep existing line breaks' on and 'Format XML Doc comments' off (for Code Cleanup profile) are doing the trick - it is working as you desire on my PC.
Could you please temporary disable/uninstall StyleCop to confirm it?

Thanks!

0
Comment actions Permalink

I tested with all the StyleCop options for Code Cleanup disabled, and you're right, then it works as desired.  I pinpointed it to specifically StyleCop rule "SA1611: Element parameters must be documented."  When this option is selected in a Code Cleanup profile, it seems to insert line breaks for every tag in that group. However, it leaves doc comments without parameters, such as a field's documentation summary tag, alone.

For now I think I will leave the option enabled and deal with the extra line breaks, because when it is disabled, parameter documentation tags are no longer automatically inserted when they're missing.

0

Please sign in to leave a comment.