-
Notifications
You must be signed in to change notification settings - Fork 0
System.Reflection.Metadata: migrate XML docs (fill-gaps) #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System.Diagnostics; | ||
|
|
@@ -49,6 +49,16 @@ public AssemblyNameInfo(string name, Version? version = null, string? cultureNam | |
| } | ||
| #endif | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the AssemblyNameInfo class. | ||
| /// </summary> | ||
| /// <param name="name">The simple name of the assembly.</param> | ||
| /// <param name="version">The version of the assembly.</param> | ||
| /// <param name="cultureName">The name of the culture associated with the assembly.</param> | ||
| /// <param name="flags">The attributes of the assembly.</param> | ||
| /// <param name="publicKeyOrToken">The public key or its token. Set <paramref name="flags"/> to <see cref="AssemblyNameFlags.PublicKey"/> when it's public key.</param> | ||
| /// <exception cref="ArgumentNullException"><paramref name="name"/> is null.</exception> | ||
| /// <exception cref="T:System.ArgumentNullException"><paramref name="name"/> is <see langword="null"/>.</exception> | ||
|
Comment on lines
+60
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both these reference |
||
| internal AssemblyNameInfo(AssemblyNameParser.AssemblyNameParts parts) | ||
| { | ||
| Name = parts._name; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,7 @@ public partial class BlobBuilder | |
| private uint FrozenLength => _length | IsFrozenMask; | ||
| private Span<byte> Span => _buffer.AsSpan(0, Length); | ||
|
|
||
| /// <param name="capacity">To be added.</param> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we omit these "To be added" comments (or replace them with AI generated boilerplate)? It is easy to scan for public APIs with missing docs anytime. We do not have to have placeholders for it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incomplete. |
||
| public BlobBuilder(int capacity = DefaultChunkSize) | ||
| { | ||
| if (capacity < 0) | ||
|
|
@@ -63,6 +64,7 @@ public BlobBuilder(int capacity = DefaultChunkSize) | |
| _buffer = new byte[Math.Max(MinChunkSize, capacity)]; | ||
| } | ||
|
|
||
| /// <param name="minimalSize">To be added.</param> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incomplete. |
||
| protected virtual BlobBuilder AllocateChunk(int minimalSize) | ||
| { | ||
| return new BlobBuilder(Math.Max(_buffer.Length, minimalSize)); | ||
|
|
@@ -789,6 +791,15 @@ public void WriteBytes(byte[] buffer, int start, int byteCount) | |
| WriteBytes(buffer.AsSpan(start, byteCount)); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Writes a specified number of occurrences of a byte value to the builder. | ||
| /// </summary> | ||
| /// <param name="value">To be added.</param> | ||
| /// <param name="byteCount">The number of occurences of <paramref name="value"/> to write.</param> | ||
| /// <exception cref="ArgumentOutOfRangeException"><paramref name="byteCount"/> is negative.</exception> | ||
| /// <exception cref="InvalidOperationException">Builder is not writable, it has been linked with another one.</exception> | ||
| /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="byteCount"/> is negative.</exception> | ||
| /// <exception cref="T:System.InvalidOperationException">The builder is not writable, it has been linked with another one.</exception> | ||
| internal void WriteBytes(ReadOnlySpan<byte> buffer) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wrong method. The doc comment should be on the public ones. |
||
| { | ||
| if (!IsHead) | ||
|
|
@@ -991,6 +1002,14 @@ public void WriteUTF16(string value) | |
| WriteUTF16(value.AsSpan()); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Writes UTF-16 (little-endian) encoded string at the current position. | ||
| /// </summary> | ||
| /// <param name="value">To be added.</param> | ||
| /// <exception cref="ArgumentNullException"><paramref name="value"/> is null.</exception> | ||
| /// <exception cref="InvalidOperationException">Builder is not writable, it has been linked with another one.</exception> | ||
| /// <exception cref="T:System.ArgumentNullException"><paramref name="value"/> is <see langword="null"/>.</exception> | ||
| /// <exception cref="T:System.InvalidOperationException">Builder is not writable, it has been linked with another one.</exception> | ||
| private void WriteUTF16(ReadOnlySpan<char> value) | ||
| { | ||
| if (!IsHead) | ||
|
|
@@ -1072,6 +1091,15 @@ public void WriteUTF8(string value, bool allowUnpairedSurrogates = true) | |
| WriteUTF8(value, 0, value.Length, allowUnpairedSurrogates, prependSize: false); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Writes UTF-8 encoded string at the current position. | ||
| /// </summary> | ||
| /// <param name="value">Constant value.</param> | ||
| /// <param name="allowUnpairedSurrogates"> True to encode unpaired surrogates as specified, otherwise replace them with U+FFFD character. </param> | ||
| /// <exception cref="ArgumentNullException"><paramref name="value"/> is null.</exception> | ||
| /// <exception cref="InvalidOperationException">Builder is not writable, it has been linked with another one.</exception> | ||
| /// <exception cref="T:System.ArgumentNullException"><paramref name="value"/> is <see langword="null"/>.</exception> | ||
| /// <exception cref="T:System.InvalidOperationException">Builder is not writable, it has been linked with another one.</exception> | ||
| internal unsafe void WriteUTF8(string str, int start, int length, bool allowUnpairedSurrogates, bool prependSize) | ||
| { | ||
| Debug.Assert(start >= 0); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,21 +20,27 @@ public struct BlobWriter | |
| // position in buffer relative to the beginning of the array: | ||
| private int _position; | ||
|
|
||
| /// <param name="size">To be added.</param> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incomplete. |
||
| public BlobWriter(int size) | ||
| : this(new byte[size]) | ||
| { | ||
| } | ||
|
|
||
| /// <param name="buffer">To be added.</param> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incomplete. |
||
| public BlobWriter(byte[] buffer) | ||
| : this(buffer, 0, buffer.Length) | ||
| { | ||
| } | ||
|
|
||
| /// <param name="blob">To be added.</param> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incomplete. |
||
| public BlobWriter(Blob blob) | ||
| : this(blob.Buffer, blob.Start, blob.Length) | ||
| { | ||
| } | ||
|
|
||
| /// <param name="buffer">To be added.</param> | ||
| /// <param name="start">To be added.</param> | ||
| /// <param name="count">To be added.</param> | ||
|
Comment on lines
+41
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Incomplete. |
||
| public BlobWriter(byte[] buffer, int start, int count) | ||
| { | ||
| Debug.Assert(buffer != null); | ||
|
|
@@ -147,6 +153,10 @@ public unsafe void WriteBytes(byte* buffer, int byteCount) | |
| WriteBytes(new ReadOnlySpan<byte>(buffer, byteCount)); | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My base assumption is that every item should have a |
||
| /// <param name="byteCount">To be added.</param> | ||
| /// <exception cref="ArgumentOutOfRangeException"><paramref name="byteCount"/> is negative.</exception> | ||
| /// <exception cref="T:System.ArgumentOutOfRangeException"><paramref name="byteCount"/> is negative.</exception> | ||
| internal void WriteBytes(ReadOnlySpan<byte> buffer) | ||
| { | ||
| int start = Advance(buffer.Length); | ||
|
|
@@ -234,112 +244,132 @@ public void WriteBytes(byte[] buffer, int start, int byteCount) | |
| WriteBytes(buffer.AsSpan(start, byteCount)); | ||
| } | ||
|
|
||
| /// <param name="offset">To be added.</param> | ||
| public void PadTo(int offset) | ||
| { | ||
| WriteBytes(0, offset - Offset); | ||
| } | ||
|
|
||
| /// <param name="alignment">To be added.</param> | ||
| public void Align(int alignment) | ||
| { | ||
| int offset = Offset; | ||
| WriteBytes(0, BitArithmetic.Align(offset, alignment) - offset); | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
| public void WriteBoolean(bool value) | ||
| { | ||
| WriteByte((byte)(value ? 1 : 0)); | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
| public void WriteByte(byte value) | ||
| { | ||
| int start = Advance(sizeof(byte)); | ||
| _buffer[start] = value; | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
| public void WriteSByte(sbyte value) | ||
| { | ||
| WriteByte(unchecked((byte)value)); | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
| public void WriteDouble(double value) | ||
| { | ||
| int start = Advance(sizeof(double)); | ||
| _buffer.WriteDouble(start, value); | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
| public void WriteSingle(float value) | ||
| { | ||
| int start = Advance(sizeof(float)); | ||
| _buffer.WriteSingle(start, value); | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
| public void WriteInt16(short value) | ||
| { | ||
| WriteUInt16(unchecked((ushort)value)); | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
| public void WriteUInt16(ushort value) | ||
| { | ||
| int start = Advance(sizeof(ushort)); | ||
| _buffer.WriteUInt16(start, value); | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
| public void WriteInt16BE(short value) | ||
| { | ||
| WriteUInt16BE(unchecked((ushort)value)); | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
| public void WriteUInt16BE(ushort value) | ||
| { | ||
| int start = Advance(sizeof(ushort)); | ||
| _buffer.WriteUInt16BE(start, value); | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
| public void WriteInt32BE(int value) | ||
| { | ||
| WriteUInt32BE(unchecked((uint)value)); | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
| public void WriteUInt32BE(uint value) | ||
| { | ||
| int start = Advance(sizeof(uint)); | ||
| _buffer.WriteUInt32BE(start, value); | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
| public void WriteInt32(int value) | ||
| { | ||
| WriteUInt32(unchecked((uint)value)); | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
| public void WriteUInt32(uint value) | ||
| { | ||
| int start = Advance(sizeof(uint)); | ||
| _buffer.WriteUInt32(start, value); | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
| public void WriteInt64(long value) | ||
| { | ||
| WriteUInt64(unchecked((ulong)value)); | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
| public void WriteUInt64(ulong value) | ||
| { | ||
| int start = Advance(sizeof(ulong)); | ||
| _buffer.WriteUInt64(start, value); | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
| public void WriteDecimal(decimal value) | ||
| { | ||
| int start = Advance(BlobUtilities.SizeOfSerializedDecimal); | ||
| _buffer.WriteDecimal(start, value); | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
| public void WriteGuid(Guid value) | ||
| { | ||
| int start = Advance(BlobUtilities.SizeOfGuid); | ||
| _buffer.WriteGuid(start, value); | ||
| } | ||
|
|
||
| /// <param name="value">To be added.</param> | ||
| public void WriteDateTime(DateTime value) | ||
| { | ||
| WriteInt64(value.Ticks); | ||
|
|
@@ -393,6 +423,12 @@ public void WriteUTF16(string value) | |
| WriteUTF16(value.AsSpan()); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Writes UTF-16 (little-endian) encoded string at the current position. | ||
| /// </summary> | ||
| /// <param name="value">To be added.</param> | ||
| /// <exception cref="ArgumentNullException"><paramref name="value"/> is null.</exception> | ||
| /// <exception cref="T:System.ArgumentNullException"><paramref name="value"/> is <see langword="null"/>.</exception> | ||
| private void WriteUTF16(ReadOnlySpan<char> value) | ||
| { | ||
| if (BitConverter.IsLittleEndian) | ||
|
|
@@ -464,6 +500,13 @@ public void WriteUTF8(string value, bool allowUnpairedSurrogates) | |
| WriteUTF8(value, 0, value.Length, allowUnpairedSurrogates, prependSize: false); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Writes UTF-8 encoded string at the current position. | ||
| /// </summary> | ||
| /// <param name="value">To be added.</param> | ||
| /// <param name="allowUnpairedSurrogates">To be added.</param> | ||
| /// <exception cref="ArgumentNullException"><paramref name="value"/> is null.</exception> | ||
| /// <exception cref="T:System.ArgumentNullException"><paramref name="value"/> is <see langword="null"/>.</exception> | ||
| private unsafe void WriteUTF8(string str, int start, int length, bool allowUnpairedSurrogates, bool prependSize) | ||
| { | ||
| fixed (char* strPtr = str) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is on a wrong method