Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

namespace System.Diagnostics
{
/// <summary>
/// Provides methods to register and configure tracing settings from configuration files to <see cref="TraceSource" /> and related classes.
/// </summary>
public static class TraceConfiguration
{
private static volatile bool s_registered;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,11 @@ public static XmlQualifiedName GetXsdType(XmlSchemaSet schemaSet)
return new XmlQualifiedName("base64Binary", XmlSchema.Namespace);
}

/// <summary>
/// Wraps a byte array in a <see cref="SqlBinary" /> without copying the data.
/// </summary>
/// <param name="bytes">The byte array to wrap.</param>
/// <returns>A <see cref="SqlBinary" /> that wraps the provided byte array.</returns>
public static SqlBinary WrapBytes(byte[] bytes)
{
return new SqlBinary(bytes, copy: false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1154,6 +1154,13 @@ private decimal ToDecimal()
}
}

/// <summary>
/// Writes the TDS (Tabular Data Stream) representation of this <see cref="SqlDecimal" /> to the specified destination.
/// </summary>
/// <param name="destination">The destination span to write the TDS (Tabular Data Stream) value to. Must be at least 4 elements long.</param>
/// <returns>The number of <see langword="uint" /> values written to the destination.</returns>
/// <exception cref="SqlNullValueException">Thrown when the <see cref="SqlDecimal" /> is <see langword="null" />.</exception>
/// <exception cref="ArgumentOutOfRangeException">Thrown when the destination span is too small.</exception>
[CLSCompliant(false)]
public int WriteTdsValue(Span<uint> destination)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ public override string ToString()
return money.ToString("#0.00##", null);
}

/// <summary>
/// Gets the TDS (Tabular Data Stream) representation of this <see cref="SqlMoney" /> value.
/// </summary>
/// <returns>A long value representing the TDS (Tabular Data Stream) representation.</returns>
/// <exception cref="SqlNullValueException">Thrown when the <see cref="SqlMoney" /> is <see langword="null" />.</exception>
public long GetTdsValue()
{
if (IsNull)
Expand Down Expand Up @@ -249,6 +254,11 @@ public static SqlMoney Parse(string s)
return money;
}

/// <summary>
/// Creates a <see cref="SqlMoney" /> from a TDS (Tabular Data Stream) value.
/// </summary>
/// <param name="value">The TDS value to convert to <see cref="SqlMoney" />.</param>
/// <returns>A <see cref="SqlMoney" /> representing the TDS value.</returns>
public static SqlMoney FromTdsValue(long value)
{
return new SqlMoney(value, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@ namespace System.Diagnostics
/// </summary>
public sealed class InitializingSwitchEventArgs : EventArgs
{
/// <summary>
/// Initializes a new instance of the <see cref="InitializingSwitchEventArgs"/> class.
/// </summary>
/// <param name="switch">The switch that is being initialized.</param>
public InitializingSwitchEventArgs(Switch @switch)
{
Switch = @switch;
}

/// <summary>
/// Gets the <see cref="Switch" /> that is being initialized.
/// </summary>
public Switch Switch { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,23 @@ namespace System.Diagnostics
/// </summary>
public sealed class InitializingTraceSourceEventArgs : EventArgs
{
/// <summary>
/// Initializes a new instance of the <see cref="InitializingTraceSourceEventArgs"/> class.
/// </summary>
/// <param name="traceSource">The trace source that is being initialized.</param>
public InitializingTraceSourceEventArgs(TraceSource traceSource)
{
TraceSource = traceSource;
}

/// <summary>
/// Gets the trace source that is being initialized.
/// </summary>
public TraceSource TraceSource { get; }

/// <summary>
/// Gets or sets a value indicating whether the trace source was initialized from configuration.
/// </summary>
public bool WasInitialized { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,32 @@ public UnsupportedOSPlatformAttribute(string platformName, string? message) : ba
#endif
sealed class ObsoletedOSPlatformAttribute : OSPlatformAttribute
{
/// <summary>
/// Initializes a new instance of the <see cref="ObsoletedOSPlatformAttribute"/> class with the specified platform name.
/// </summary>
/// <param name="platformName">The name of the platform where the API was obsoleted.</param>
public ObsoletedOSPlatformAttribute(string platformName) : base(platformName)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="ObsoletedOSPlatformAttribute"/> class with the specified platform name and message.
/// </summary>
/// <param name="platformName">The name of the platform where the API was obsoleted.</param>
/// <param name="message">The message that explains the obsolescence.</param>
public ObsoletedOSPlatformAttribute(string platformName, string? message) : base(platformName)
{
Message = message;
}

/// <summary>
/// Gets the message that explains the obsolescence.
/// </summary>
public string? Message { get; }

/// <summary>
/// Gets or sets the URL that provides more information about the obsolescence.
/// </summary>
public string? Url { get; set; }
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@

namespace System.Runtime.Serialization.DataContracts
{
/// <summary>
/// Represents a data contract that defines serialization and deserialization behavior for types.
/// </summary>
public abstract class DataContract
{
internal const string SerializerTrimmerWarning = "Data Contract Serialization and Deserialization might require types that cannot be statically analyzed. Make sure all of the " +
Expand All @@ -46,6 +49,9 @@ internal DataContract(DataContractCriticalHelper helper)
_ns = helper.Namespace;
}

/// <summary>
/// Gets the contract type name for this data contract.
/// </summary>
public virtual string? ContractType => null;

internal MethodInfo? ParseMethod => _helper.ParseMethod;
Expand Down Expand Up @@ -190,24 +196,36 @@ internal virtual object ReadXmlElement(XmlReaderDelegator xmlReader, XmlObjectSe
throw new InvalidDataContractException(SR.Format(SR.UnexpectedContractType, DataContract.GetClrTypeFullName(GetType()), DataContract.GetClrTypeFullName(UnderlyingType)));
}

/// <summary>
/// Gets a value indicating whether the data contract represents a value type.
/// </summary>
public virtual bool IsValueType
{
get => _helper.IsValueType;
internal set => _helper.IsValueType = value;
}

/// <summary>
/// Gets a value indicating whether the data contract is serialized by reference.
/// </summary>
public virtual bool IsReference
{
get => _helper.IsReference;
internal set => _helper.IsReference = value;
}

/// <summary>
/// Gets the XML qualified name for the data contract.
/// </summary>
public virtual XmlQualifiedName XmlName
{
get => _helper.XmlName;
internal set => _helper.XmlName = value;
}

/// <summary>
/// Gets the base data contract for this data contract.
/// </summary>
public virtual DataContract? BaseContract
{
[RequiresDynamicCode(DataContract.SerializerAOTWarning)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,20 @@ private XmlDictionaryString RootName
// These Get/Set methods mirror the extensions that were added to DCS in the early days of Core, which allowed
// using a slimmed-down surrogate on both NetFx and Core via type-forwarding mechanisms. That's why these are
// a pair of methods instead of making the property itself public.

/// <summary>
/// Gets the current serialization surrogate provider.
/// </summary>
/// <returns>The current <see cref="ISerializationSurrogateProvider"/> instance, or <see langword="null"/> if no provider is set.</returns>
public ISerializationSurrogateProvider? GetSerializationSurrogateProvider()
{
return SerializationSurrogateProvider;
}

/// <summary>
/// Sets the serialization surrogate provider.
/// </summary>
/// <param name="provider">The <see cref="ISerializationSurrogateProvider"/> to use for serialization, or <see langword="null"/> to remove the current provider.</param>
public void SetSerializationSurrogateProvider(ISerializationSurrogateProvider? provider)
{
SerializationSurrogateProvider = provider;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,10 @@ public FieldTypeEncoder(BlobBuilder builder)
Builder = builder;
}

/// <summary>
/// Creates <see cref="CustomModifiersEncoder" /> object that can be used to encode custom modifiers.
/// </summary>
/// <returns>A <see cref="CustomModifiersEncoder"/> instance that can be used to encode custom modifiers.</returns>
public CustomModifiersEncoder CustomModifiers()
{
return new CustomModifiersEncoder(Builder);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,57 @@

namespace System.Security.Cryptography.X509Certificates
{
/// <summary>
/// Represents the Subject Alternative Name X.509 Extension (2.5.29.17).
/// </summary>
public sealed class X509SubjectAlternativeNameExtension : X509Extension
{
private List<GeneralNameAsn>? _decoded;

/// <summary>
/// Initializes a new instance of the <see cref="X509SubjectAlternativeNameExtension" /> class.
/// </summary>
public X509SubjectAlternativeNameExtension() : base(Oids.SubjectAltNameOid)
{
_decoded = new List<GeneralNameAsn>(0);
}

/// <summary>
/// Initializes a new instance of the <see cref="X509SubjectAlternativeNameExtension" /> class from an encoded representation of the extension and an optional critical marker.
/// </summary>
/// <param name="rawData">The encoded data to use to create the extension.</param>
/// <param name="critical"><see langword="true" /> if the extension is critical; otherwise, <see langword="false" />. The default is <see langword="false" />.</param>
public X509SubjectAlternativeNameExtension(byte[] rawData, bool critical = false)
: base(Oids.SubjectAltNameOid, rawData, critical)
{
_decoded = Decode(RawData);
}

/// <summary>
/// Initializes a new instance of the <see cref="X509SubjectAlternativeNameExtension" /> class from an encoded representation of the extension and an optional critical marker.
/// </summary>
/// <param name="rawData">The encoded data to use to create the extension.</param>
/// <param name="critical"><see langword="true" /> if the extension is critical; otherwise, <see langword="false" />. The default is <see langword="false" />.</param>
public X509SubjectAlternativeNameExtension(ReadOnlySpan<byte> rawData, bool critical = false)
: base(Oids.SubjectAltNameOid, rawData, critical)
{
_decoded = Decode(RawData);
}

/// <summary>
/// Copies the extension properties of the specified <see cref="AsnEncodedData" /> object.
/// </summary>
/// <param name="asnEncodedData">The <see cref="AsnEncodedData" /> object whose extension properties to copy.</param>
public override void CopyFrom(AsnEncodedData asnEncodedData)
{
base.CopyFrom(asnEncodedData);
_decoded = null;
}

/// <summary>
/// Enumerates the alternative name entries with a DNS Name type identifier.
/// </summary>
/// <returns>An enumerable collection of alternative names with DNS Name type identifiers.</returns>
public IEnumerable<string> EnumerateDnsNames()
{
List<GeneralNameAsn> decoded = (_decoded ??= Decode(RawData));
Expand All @@ -54,6 +78,10 @@ private static IEnumerable<string> EnumerateDnsNames(List<GeneralNameAsn> decode
}
}

/// <summary>
/// Enumerates the alternative name entries with an IP Address type identifier.
/// </summary>
/// <returns>An enumerable collection of alternative names with IP Address type identifiers.</returns>
public IEnumerable<IPAddress> EnumerateIPAddresses()
{
List<GeneralNameAsn> decoded = (_decoded ??= Decode(RawData));
Expand Down
Loading