Skip to content

Commit 6e16c1b

Browse files
authored
Improve XML comment indenting (#13095)
This commit updates XML comments and documentation to indent per standard. It relies on an AI generated Python script to generate the original changes, then it was manually reviewed and modified. Overall, these modifications aim to enhance maintainability and understanding of the code for developers. [The script generation](https://chatgpt.com/share/67cb7633-2628-8006-bcc9-d9716a9482d6) This is an interesting example in trying to get a terrible first result to something that was much more usable. The script could be improved further. Ignoring CDATA sections would have helped a bit, for example. ###### Microsoft Reviewers: [Open in CodeFlow](https://microsoft.github.io/open-pr/?codeflow=https://github.com/dotnet/winforms/pull/13095)
1 parent 316a77b commit 6e16c1b

File tree

240 files changed

+1852
-1903
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

240 files changed

+1852
-1903
lines changed

src/Common/src/PlatformAttributes.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
namespace System.Runtime.Versioning;
55

66
/// <summary>
7-
/// Base type for all platform-specific API attributes.
7+
/// Base type for all platform-specific API attributes.
88
/// </summary>
99
#if SYSTEM_PRIVATE_CORELIB
1010
public
@@ -22,7 +22,7 @@ private protected OSPlatformAttribute(string platformName)
2222
}
2323

2424
/// <summary>
25-
/// Records the platform that the project targeted.
25+
/// Records the platform that the project targeted.
2626
/// </summary>
2727
[AttributeUsage(AttributeTargets.Assembly,
2828
AllowMultiple = false, Inherited = false)]
@@ -39,8 +39,8 @@ public TargetPlatformAttribute(string platformName) : base(platformName)
3939
}
4040

4141
/// <summary>
42-
/// Records the operating system (and minimum version) that supports an API. Multiple attributes can be
43-
/// applied to indicate support on multiple operating systems.
42+
/// Records the operating system (and minimum version) that supports an API. Multiple attributes can be
43+
/// applied to indicate support on multiple operating systems.
4444
/// </summary>
4545
/// <remarks>
4646
/// <para>

src/Common/tests/TestUtilities/XUnit/UseCultureAttribute.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public UseCultureAttribute(string culture, string uiCulture)
4949
}
5050

5151
/// <summary>
52-
/// Gets the culture.
52+
/// Gets the culture.
5353
/// </summary>
5454
public CultureInfo Culture => _culture.Value;
5555

@@ -59,14 +59,14 @@ public UseCultureAttribute(string culture, string uiCulture)
5959
public bool SetUnmanagedUiThreadCulture { get; set; }
6060

6161
/// <summary>
62-
/// Gets the UI culture.
62+
/// Gets the UI culture.
6363
/// </summary>
6464
public CultureInfo UICulture => _uiCulture.Value;
6565

6666
/// <summary>
67-
/// Stores the current <see cref="Thread.CurrentPrincipal" />
68-
/// <see cref="CultureInfo.CurrentCulture" /> and <see cref="CultureInfo.CurrentUICulture" />
69-
/// and replaces them with the new cultures defined in the constructor.
67+
/// Stores the current <see cref="Thread.CurrentPrincipal" />
68+
/// <see cref="CultureInfo.CurrentCulture" /> and <see cref="CultureInfo.CurrentUICulture" />
69+
/// and replaces them with the new cultures defined in the constructor.
7070
/// </summary>
7171
/// <param name="methodUnderTest">The method under test</param>
7272
public override unsafe void Before(MethodInfo methodUnderTest)
@@ -89,8 +89,8 @@ public override unsafe void Before(MethodInfo methodUnderTest)
8989
}
9090

9191
/// <summary>
92-
/// Restores the original <see cref="CultureInfo.CurrentCulture" /> and
93-
/// <see cref="CultureInfo.CurrentUICulture" /> to <see cref="Thread.CurrentPrincipal" />
92+
/// Restores the original <see cref="CultureInfo.CurrentCulture" /> and
93+
/// <see cref="CultureInfo.CurrentUICulture" /> to <see cref="Thread.CurrentPrincipal" />
9494
/// </summary>
9595
/// <param name="methodUnderTest">The method under test</param>
9696
public override void After(MethodInfo methodUnderTest)

src/System.Drawing.Common/src/Special/NullableAttributes.cs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ sealed class MaybeNullWhenAttribute : Attribute
5555
{
5656
/// <summary>Initializes the attribute with the specified return value condition.</summary>
5757
/// <param name="returnValue">
58-
/// The return value condition. If the method returns this value, the associated parameter may be null.
58+
/// The return value condition. If the method returns this value, the associated parameter may be null.
5959
/// </param>
6060
public MaybeNullWhenAttribute(bool returnValue) => ReturnValue = returnValue;
6161

@@ -74,7 +74,7 @@ sealed class NotNullWhenAttribute : Attribute
7474
{
7575
/// <summary>Initializes the attribute with the specified return value condition.</summary>
7676
/// <param name="returnValue">
77-
/// The return value condition. If the method returns this value, the associated parameter will not be null.
77+
/// The return value condition. If the method returns this value, the associated parameter will not be null.
7878
/// </param>
7979
public NotNullWhenAttribute(bool returnValue) => ReturnValue = returnValue;
8080

@@ -93,7 +93,7 @@ sealed class NotNullIfNotNullAttribute : Attribute
9393
{
9494
/// <summary>Initializes the attribute with the associated parameter name.</summary>
9595
/// <param name="parameterName">
96-
/// The associated parameter name. The output will be non-null if the argument to the parameter specified is non-null.
96+
/// The associated parameter name. The output will be non-null if the argument to the parameter specified is non-null.
9797
/// </param>
9898
public NotNullIfNotNullAttribute(string parameterName) => ParameterName = parameterName;
9999

@@ -122,8 +122,8 @@ sealed class DoesNotReturnIfAttribute : Attribute
122122
{
123123
/// <summary>Initializes the attribute with the specified parameter value.</summary>
124124
/// <param name="parameterValue">
125-
/// The condition parameter value. Code after the method will be considered unreachable by diagnostics if the argument to
126-
/// the associated parameter matches this value.
125+
/// The condition parameter value. Code after the method will be considered unreachable by diagnostics if the argument to
126+
/// the associated parameter matches this value.
127127
/// </param>
128128
public DoesNotReturnIfAttribute(bool parameterValue) => ParameterValue = parameterValue;
129129

@@ -143,13 +143,13 @@ sealed class MemberNotNullAttribute : Attribute
143143
{
144144
/// <summary>Initializes the attribute with a field or property member.</summary>
145145
/// <param name="member">
146-
/// The field or property member that is promised to be not-null.
146+
/// The field or property member that is promised to be not-null.
147147
/// </param>
148148
public MemberNotNullAttribute(string member) => Members = [member];
149149

150150
/// <summary>Initializes the attribute with the list of field and property members.</summary>
151151
/// <param name="members">
152-
/// The list of field and property members that are promised to be not-null.
152+
/// The list of field and property members that are promised to be not-null.
153153
/// </param>
154154
public MemberNotNullAttribute(params string[] members) => Members = members;
155155

@@ -168,10 +168,10 @@ sealed class MemberNotNullWhenAttribute : Attribute
168168
{
169169
/// <summary>Initializes the attribute with the specified return value condition and a field or property member.</summary>
170170
/// <param name="returnValue">
171-
/// The return value condition. If the method returns this value, the associated parameter will not be null.
171+
/// The return value condition. If the method returns this value, the associated parameter will not be null.
172172
/// </param>
173173
/// <param name="member">
174-
/// The field or property member that is promised to be not-null.
174+
/// The field or property member that is promised to be not-null.
175175
/// </param>
176176
public MemberNotNullWhenAttribute(bool returnValue, string member)
177177
{
@@ -181,10 +181,10 @@ public MemberNotNullWhenAttribute(bool returnValue, string member)
181181

182182
/// <summary>Initializes the attribute with the specified return value condition and list of field and property members.</summary>
183183
/// <param name="returnValue">
184-
/// The return value condition. If the method returns this value, the associated parameter will not be null.
184+
/// The return value condition. If the method returns this value, the associated parameter will not be null.
185185
/// </param>
186186
/// <param name="members">
187-
/// The list of field and property members that are promised to be not-null.
187+
/// The list of field and property members that are promised to be not-null.
188188
/// </param>
189189
public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
190190
{

src/System.Drawing.Common/src/Special/RequiresUnreferencedCodeAttribute.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ namespace System.Diagnostics.CodeAnalysis;
99
/// </summary>
1010
/// <remarks>
1111
/// <para>
12-
/// This allows tools to understand which methods are unsafe to call when removing unreferenced
13-
/// code from an application.
12+
/// This allows tools to understand which methods are unsafe to call when removing unreferenced
13+
/// code from an application.
1414
/// </para>
1515
/// </remarks>
1616
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Class, Inherited = false)]
@@ -22,25 +22,25 @@ namespace System.Diagnostics.CodeAnalysis;
2222
sealed class RequiresUnreferencedCodeAttribute : Attribute
2323
{
2424
/// <summary>
25-
/// Initializes a new instance of the <see cref="RequiresUnreferencedCodeAttribute"/> class
26-
/// with the specified message.
25+
/// Initializes a new instance of the <see cref="RequiresUnreferencedCodeAttribute"/> class
26+
/// with the specified message.
2727
/// </summary>
2828
/// <param name="message">
29-
/// A message that contains information about the usage of unreferenced code.
29+
/// A message that contains information about the usage of unreferenced code.
3030
/// </param>
3131
public RequiresUnreferencedCodeAttribute(string message)
3232
{
3333
Message = message;
3434
}
3535

3636
/// <summary>
37-
/// Gets a message that contains information about the usage of unreferenced code.
37+
/// Gets a message that contains information about the usage of unreferenced code.
3838
/// </summary>
3939
public string Message { get; }
4040

4141
/// <summary>
42-
/// Gets or sets an optional URL that contains more information about the method,
43-
/// why it requires unreferenced code, and what options a consumer has to deal with it.
42+
/// Gets or sets an optional URL that contains more information about the method,
43+
/// why it requires unreferenced code, and what options a consumer has to deal with it.
4444
/// </summary>
4545
public string? Url { get; set; }
4646
}

src/System.Drawing.Common/src/System/Drawing/BitmapSelector.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
namespace System.Drawing;
88

99
/// <summary>
10-
/// Provides methods to select bitmaps.
10+
/// Provides methods to select bitmaps.
1111
/// </summary>
1212
internal static class BitmapSelector
1313
{
1414
/// <summary>
15-
/// Returns a resource stream loaded from the appropriate location according to the current
16-
/// suffix.
15+
/// Returns a resource stream loaded from the appropriate location according to the current
16+
/// suffix.
1717
/// </summary>
1818
/// <param name="assembly">The assembly from which the stream is loaded</param>
1919
/// <param name="type">The type whose namespace is used to scope the manifest resource name</param>
2020
/// <param name="originalName">The name of the manifest resource being requested</param>
2121
/// <returns>
22-
/// The manifest resource stream corresponding to <paramref name="originalName"/>.
22+
/// The manifest resource stream corresponding to <paramref name="originalName"/>.
2323
/// </returns>
2424
public static Stream? GetResourceStream(Assembly assembly, Type type, string originalName)
2525
{
@@ -28,7 +28,7 @@ internal static class BitmapSelector
2828

2929
/// <summary>
3030
/// Returns a resource stream loaded from the appropriate location according to the current
31-
/// suffix.
31+
/// suffix.
3232
/// </summary>
3333
/// <param name="type">
3434
/// The type from whose assembly the stream is loaded and whose namespace is used to scope the resource name.

src/System.Drawing.Common/src/System/Drawing/BitmapSuffixInSameAssemblyAttribute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
namespace System.Drawing;
55

66
/// <summary>
7-
/// Opt-In flag to look for resources in the same assembly but with the "bitmapSuffix" config setting.
8-
/// i.e. System.Web.UI.WebControl.Button.bmp -> System.Web.UI.WebControl.Button.VisualStudio.11.0.bmp
7+
/// Opt-In flag to look for resources in the same assembly but with the "bitmapSuffix" config setting.
8+
/// i.e. System.Web.UI.WebControl.Button.bmp -> System.Web.UI.WebControl.Button.VisualStudio.11.0.bmp
99
/// </summary>
1010
[AttributeUsage(AttributeTargets.Assembly)]
1111
public class BitmapSuffixInSameAssemblyAttribute : Attribute

src/System.Drawing.Common/src/System/Drawing/BitmapSuffixInSatelliteAssemblyAttribute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
namespace System.Drawing;
55

66
/// <summary>
7-
/// Opt-In flag to look for resources in the another assembly with the "bitmapSuffix" config setting
8-
/// i.e. System.Web.dll -> System.Web.VisualStudio.11.0.dll
7+
/// Opt-In flag to look for resources in the another assembly with the "bitmapSuffix" config setting
8+
/// i.e. System.Web.dll -> System.Web.VisualStudio.11.0.dll
99
/// </summary>
1010
[AttributeUsage(AttributeTargets.Assembly)]
1111
public class BitmapSuffixInSatelliteAssemblyAttribute : Attribute

src/System.Drawing.Common/src/System/Drawing/BufferedGraphics.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
namespace System.Drawing;
77

88
/// <summary>
9-
/// The BufferedGraphics class can be thought of as a "Token" or "Reference" to the buffer that a
10-
/// BufferedGraphicsContext creates. While a BufferedGraphics is outstanding, the memory associated with the
11-
/// buffer is locked. The general design is such that under normal conditions a single BufferedGraphics will be in
12-
/// use at one time for a given BufferedGraphicsContext.
9+
/// The BufferedGraphics class can be thought of as a "Token" or "Reference" to the buffer that a
10+
/// BufferedGraphicsContext creates. While a BufferedGraphics is outstanding, the memory associated with the
11+
/// buffer is locked. The general design is such that under normal conditions a single BufferedGraphics will be in
12+
/// use at one time for a given BufferedGraphicsContext.
1313
/// </summary>
1414
public sealed class BufferedGraphics : IDisposable
1515
{
@@ -21,7 +21,7 @@ public sealed class BufferedGraphics : IDisposable
2121
private readonly Size _virtualSize;
2222

2323
/// <summary>
24-
/// Internal constructor, this class is created by BufferedGraphicsContext.
24+
/// Internal constructor, this class is created by BufferedGraphicsContext.
2525
/// </summary>
2626
internal BufferedGraphics(Graphics bufferedGraphicsSurface, BufferedGraphicsContext context, Graphics? targetGraphics,
2727
IntPtr targetDC, Point targetLoc, Size virtualSize)
@@ -55,12 +55,12 @@ public void Dispose()
5555
}
5656

5757
/// <summary>
58-
/// Allows access to the Graphics wrapper for the buffer.
58+
/// Allows access to the Graphics wrapper for the buffer.
5959
/// </summary>
6060
public Graphics Graphics => _bufferedGraphicsSurface;
6161

6262
/// <summary>
63-
/// Renders the buffer to the specified target graphics.
63+
/// Renders the buffer to the specified target graphics.
6464
/// </summary>
6565
public void Render(Graphics? target)
6666
{

src/System.Drawing.Common/src/System/Drawing/BufferedGraphicsContext.cs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public sealed unsafe class BufferedGraphicsContext : IDisposable
2929
private const int BufferBusyDisposing = 2; // The graphics buffer is busy disposing.
3030

3131
/// <summary>
32-
/// Basic constructor.
32+
/// Basic constructor.
3333
/// </summary>
3434
public BufferedGraphicsContext()
3535
{
@@ -68,7 +68,7 @@ public Size MaximumBuffer
6868
~BufferedGraphicsContext() => Dispose(false);
6969

7070
/// <summary>
71-
/// Returns a BufferedGraphics that is matched for the specified target Graphics object.
71+
/// Returns a BufferedGraphics that is matched for the specified target Graphics object.
7272
/// </summary>
7373
public BufferedGraphics Allocate(Graphics targetGraphics, Rectangle targetRectangle)
7474
{
@@ -81,7 +81,7 @@ public BufferedGraphics Allocate(Graphics targetGraphics, Rectangle targetRectan
8181
}
8282

8383
/// <summary>
84-
/// Returns a BufferedGraphics that is matched for the specified target HDC object.
84+
/// Returns a BufferedGraphics that is matched for the specified target HDC object.
8585
/// </summary>
8686
public BufferedGraphics Allocate(IntPtr targetDC, Rectangle targetRectangle)
8787
{
@@ -94,7 +94,7 @@ public BufferedGraphics Allocate(IntPtr targetDC, Rectangle targetRectangle)
9494
}
9595

9696
/// <summary>
97-
/// Returns a BufferedGraphics that is matched for the specified target HDC object.
97+
/// Returns a BufferedGraphics that is matched for the specified target HDC object.
9898
/// </summary>
9999
private BufferedGraphics AllocBuffer(Graphics? targetGraphics, HDC targetDC, Rectangle targetRectangle)
100100
{
@@ -143,7 +143,7 @@ private BufferedGraphics AllocBuffer(Graphics? targetGraphics, HDC targetDC, Rec
143143
}
144144

145145
/// <summary>
146-
/// Returns a BufferedGraphics that is matched for the specified target HDC object.
146+
/// Returns a BufferedGraphics that is matched for the specified target HDC object.
147147
/// </summary>
148148
private static BufferedGraphics AllocBufferInTempManager(Graphics? targetGraphics, HDC targetDC, Rectangle targetRectangle)
149149
{
@@ -174,11 +174,11 @@ public void Dispose()
174174
}
175175

176176
/// <summary>
177-
/// This routine allows us to control the point were we start using throw away
178-
/// managers for painting. Since the buffer manager stays around (by default)
179-
/// for the life of the app, we don't want to consume too much memory
180-
/// in the buffer. However, re-allocating the buffer for small things (like
181-
/// buttons, labels, etc) will hit us on runtime performance.
177+
/// This routine allows us to control the point were we start using throw away
178+
/// managers for painting. Since the buffer manager stays around (by default)
179+
/// for the life of the app, we don't want to consume too much memory
180+
/// in the buffer. However, re-allocating the buffer for small things (like
181+
/// buttons, labels, etc) will hit us on runtime performance.
182182
/// </summary>
183183
private bool ShouldUseTempManager(Rectangle targetBounds)
184184
{
@@ -336,17 +336,17 @@ private Graphics CreateBuffer(HDC src, int width, int height)
336336
}
337337

338338
/// <summary>
339-
/// Create a DIB section with an optimal format w.r.t. the specified hdc.
339+
/// Create a DIB section with an optimal format w.r.t. the specified hdc.
340340
///
341-
/// If DIB &lt;= 8bpp, then the DIB color table is initialized based on the
342-
/// specified palette. If the palette handle is NULL, then the system
343-
/// palette is used.
341+
/// If DIB &lt;= 8bpp, then the DIB color table is initialized based on the
342+
/// specified palette. If the palette handle is NULL, then the system
343+
/// palette is used.
344344
///
345-
/// Note: The hdc must be a direct DC (not an info or memory DC).
345+
/// Note: The hdc must be a direct DC (not an info or memory DC).
346346
///
347-
/// Note: On palettized displays, if the system palette changes the
348-
/// UpdateDIBColorTable function should be called to maintain
349-
/// the identity palette mapping between the DIB and the display.
347+
/// Note: On palettized displays, if the system palette changes the
348+
/// UpdateDIBColorTable function should be called to maintain
349+
/// the identity palette mapping between the DIB and the display.
350350
/// </summary>
351351
/// <returns>A valid bitmap handle if successful, IntPtr.Zero otherwise.</returns>
352352
private HBITMAP CreateCompatibleDIB(HDC hdc, HPALETTE hpalette, int ulWidth, int ulHeight)
@@ -453,7 +453,7 @@ private void DisposeBitmap()
453453
}
454454

455455
/// <summary>
456-
/// Disposes of the Graphics buffer.
456+
/// Disposes of the Graphics buffer.
457457
/// </summary>
458458
private void Dispose(bool disposing)
459459
{
@@ -489,7 +489,7 @@ private void Dispose(bool disposing)
489489
}
490490

491491
/// <summary>
492-
/// Invalidates the cached graphics buffer.
492+
/// Invalidates the cached graphics buffer.
493493
/// </summary>
494494
public void Invalidate()
495495
{
@@ -509,7 +509,7 @@ public void Invalidate()
509509
}
510510

511511
/// <summary>
512-
/// Returns a Graphics object representing a buffer.
512+
/// Returns a Graphics object representing a buffer.
513513
/// </summary>
514514
internal void ReleaseBuffer()
515515
{

0 commit comments

Comments
 (0)