From 193691f165918b56cfe94cea5e8e39b4b1830059 Mon Sep 17 00:00:00 2001
From: Cheena Malhotra <13396919+cheenamalhotra@users.noreply.github.com>
Date: Thu, 9 Jan 2025 00:46:05 +0530
Subject: [PATCH] Fix ref assembly definitions for SqlClientDiagnostic APIs
(#3097)
---
.../SqlClientDiagnostic.xml | 2 +-
.../netcore/ref/Microsoft.Data.SqlClient.cs | 356 +++++++++++-------
2 files changed, 227 insertions(+), 131 deletions(-)
diff --git a/doc/snippets/Microsoft.Data.SqlClient/SqlClientDiagnostic.xml b/doc/snippets/Microsoft.Data.SqlClient/SqlClientDiagnostic.xml
index 6306c624f4..d84a520c54 100644
--- a/doc/snippets/Microsoft.Data.SqlClient/SqlClientDiagnostic.xml
+++ b/doc/snippets/Microsoft.Data.SqlClient/SqlClientDiagnostic.xml
@@ -34,7 +34,7 @@
The element at the specified index in the read-only list.
-
+
diff --git a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs
index cefabcb537..c6eaffe0c2 100644
--- a/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs
+++ b/src/Microsoft.Data.SqlClient/netcore/ref/Microsoft.Data.SqlClient.cs
@@ -5,11 +5,6 @@
// NOTE: The current Microsoft.VSDesigner editor attributes are implemented for System.Data.SqlClient, and are not publicly available.
// New attributes that are designed to work with Microsoft.Data.SqlClient and are publicly documented should be included in future.
-using System;
-#if NET
-using System.Diagnostics.CodeAnalysis;
-#endif
-
[assembly: System.CLSCompliant(true)]
namespace Microsoft.Data
{
@@ -1304,7 +1299,7 @@ public override void Close() { }
public override System.Collections.IEnumerator GetEnumerator() { throw null; }
///
#if NET
- [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicProperties)]
+ [return: System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
#endif
public override System.Type GetFieldType(int i) { throw null; }
///
@@ -1327,7 +1322,7 @@ public override void Close() { }
public override int GetOrdinal(string name) { throw null; }
///
#if NET
- [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicProperties)]
+ [return: System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
#endif
public override System.Type GetProviderSpecificFieldType(int i) { throw null; }
///
@@ -1945,58 +1940,43 @@ public sealed class SqlConfigurableRetryFactory
}
namespace Microsoft.Data.SqlClient.Diagnostics
{
- ///
- public abstract class SqlClientDiagnostic : System.Collections.Generic.IReadOnlyList>
- {
- internal SqlClientDiagnostic() { }
- ///
- protected const int CommonPropertyCount = 3;
- ///
- protected SqlClientDiagnostic(System.Guid operationId, string operation, long timestamp) { }
+ ///
+ public sealed class SqlClientCommandBefore : System.Collections.Generic.IReadOnlyList>
+ {
+ ///
+ public const string Name = "Microsoft.Data.SqlClient.WriteCommandBefore";
///
public System.Guid OperationId => throw null;
///
public string Operation => throw null;
///
public long Timestamp => throw null;
- /// >
- public int Count => CommonPropertyCount + GetDerivedCount();
- /// >
- public System.Collections.Generic.KeyValuePair this[int index] => throw null;
- /// >
- public System.Collections.Generic.IEnumerator> GetEnumerator() => throw null;
- /// >
- System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
- ///
- protected bool TryGetCommonProperty(int index, out System.Collections.Generic.KeyValuePair property) => throw null;
- ///
- protected abstract int GetDerivedCount();
- ///
- protected abstract System.Collections.Generic.KeyValuePair GetDerivedProperty(int index);
- }
-
- ///
- public sealed class SqlClientCommandBefore : SqlClientDiagnostic
- {
- ///
- public const string Name = "Microsoft.Data.SqlClient.WriteCommandBefore";
///
public System.Guid? ConnectionId => throw null;
///
public long? TransactionId => throw null;
///
public SqlCommand Command => throw null;
- /// >
- protected sealed override int GetDerivedCount() => 3;
- /// >
- protected sealed override System.Collections.Generic.KeyValuePair GetDerivedProperty(int index) => throw null;
+ ///
+ public int Count => throw null;
+ ///
+ public System.Collections.Generic.KeyValuePair this[int index] => throw null;
+ ///
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
+ ///
+ public System.Collections.Generic.IEnumerator> GetEnumerator() => throw null;
}
-
///
- public sealed class SqlClientCommandAfter : SqlClientDiagnostic
+ public sealed class SqlClientCommandAfter : System.Collections.Generic.IReadOnlyList>
{
///
public const string Name = "Microsoft.Data.SqlClient.WriteCommandAfter";
+ ///
+ public System.Guid OperationId => throw null;
+ ///
+ public string Operation => throw null;
+ ///
+ public long Timestamp => throw null;
///
public System.Guid? ConnectionId => throw null;
///
@@ -2005,17 +1985,26 @@ public sealed class SqlClientCommandAfter : SqlClientDiagnostic
public SqlCommand Command => throw null;
///
public System.Collections.IDictionary Statistics => throw null;
- /// >
- protected sealed override int GetDerivedCount() => 4;
- /// >
- protected sealed override System.Collections.Generic.KeyValuePair GetDerivedProperty(int index) => throw null;
+ ///
+ public int Count => throw null;
+ ///
+ public System.Collections.Generic.KeyValuePair this[int index] => throw null;
+ ///
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
+ ///
+ public System.Collections.Generic.IEnumerator> GetEnumerator() => throw null;
}
-
///
- public sealed class SqlClientCommandError : SqlClientDiagnostic
+ public sealed class SqlClientCommandError : System.Collections.Generic.IReadOnlyList>
{
///
public const string Name = "Microsoft.Data.SqlClient.WriteCommandError";
+ ///
+ public System.Guid OperationId => throw null;
+ ///
+ public string Operation => throw null;
+ ///
+ public long Timestamp => throw null;
///
public System.Guid? ConnectionId => throw null;
///
@@ -2024,32 +2013,50 @@ public sealed class SqlClientCommandError : SqlClientDiagnostic
public SqlCommand Command => throw null;
///
public System.Exception Exception { get; }
- /// >
- protected sealed override int GetDerivedCount() => 4;
- /// >
- protected sealed override System.Collections.Generic.KeyValuePair GetDerivedProperty(int index) => throw null;
+ ///
+ public int Count => throw null;
+ /// >///
+ public System.Collections.Generic.KeyValuePair this[int index] => throw null;
+ ///
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
+ ///
+ public System.Collections.Generic.IEnumerator> GetEnumerator() => throw null;
}
-
///
- public sealed class SqlClientConnectionOpenBefore : SqlClientDiagnostic
+ public sealed class SqlClientConnectionOpenBefore : System.Collections.Generic.IReadOnlyList>
{
///
public const string Name = "Microsoft.Data.SqlClient.WriteConnectionOpenBefore";
+ ///
+ public System.Guid OperationId => throw null;
+ ///
+ public string Operation => throw null;
+ ///
+ public long Timestamp => throw null;
///
public SqlConnection Connection => throw null;
///
public string ClientVersion => throw null;
- /// >
- protected override int GetDerivedCount() => 2;
- /// >
- protected sealed override System.Collections.Generic.KeyValuePair GetDerivedProperty(int index) => throw null;
+ ///
+ public int Count => throw null;
+ /// >///
+ public System.Collections.Generic.KeyValuePair this[int index] => throw null;
+ ///
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
+ ///
+ public System.Collections.Generic.IEnumerator> GetEnumerator() => throw null;
}
-
///
- public sealed class SqlClientConnectionOpenAfter : SqlClientDiagnostic
+ public sealed class SqlClientConnectionOpenAfter : System.Collections.Generic.IReadOnlyList>
{
///
public const string Name = "Microsoft.Data.SqlClient.WriteConnectionOpenAfter";
+ ///
+ public System.Guid OperationId => throw null;
+ ///
+ public string Operation => throw null;
+ ///
+ public long Timestamp => throw null;
///
public System.Guid ConnectionId => throw null;
///
@@ -2058,17 +2065,26 @@ public sealed class SqlClientConnectionOpenAfter : SqlClientDiagnostic
public string ClientVersion => throw null;
///
public System.Collections.IDictionary Statistics => throw null;
- /// >
- protected override int GetDerivedCount() => 4;
- /// >
- protected sealed override System.Collections.Generic.KeyValuePair GetDerivedProperty(int index) => throw null;
+ ///
+ public int Count => throw null;
+ /// >///
+ public System.Collections.Generic.KeyValuePair this[int index] => throw null;
+ ///
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
+ ///
+ public System.Collections.Generic.IEnumerator> GetEnumerator() => throw null;
}
-
///
- public sealed class SqlClientConnectionOpenError : SqlClientDiagnostic
+ public sealed class SqlClientConnectionOpenError : System.Collections.Generic.IReadOnlyList>
{
///
public const string Name = "Microsoft.Data.SqlClient.WriteConnectionOpenError";
+ ///
+ public System.Guid OperationId => throw null;
+ ///
+ public string Operation => throw null;
+ ///
+ public long Timestamp => throw null;
///
public System.Guid ConnectionId => throw null;
///
@@ -2077,56 +2093,78 @@ public sealed class SqlClientConnectionOpenError : SqlClientDiagnostic
public string ClientVersion => throw null;
///
public System.Exception Exception => throw null;
- /// >
- protected override int GetDerivedCount() => 4;
- /// >
- protected sealed override System.Collections.Generic.KeyValuePair GetDerivedProperty(int index) => throw null;
+ ///
+ public int Count => throw null;
+ /// >///
+ public System.Collections.Generic.KeyValuePair this[int index] => throw null;
+ ///
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
+ ///
+ public System.Collections.Generic.IEnumerator> GetEnumerator() => throw null;
}
-
///
- public sealed class SqlClientConnectionCloseBefore : SqlClientDiagnostic
+ public sealed class SqlClientConnectionCloseBefore : System.Collections.Generic.IReadOnlyList>
{
///
public const string Name = "Microsoft.Data.SqlClient.WriteConnectionCloseBefore";
+ ///
+ public System.Guid OperationId => throw null;
+ ///
+ public string Operation => throw null;
+ ///
+ public long Timestamp => throw null;
///
public System.Guid? ConnectionId => throw null;
///
public SqlConnection Connection => throw null;
///
public System.Collections.IDictionary Statistics => throw null;
- /// >
- protected sealed override int GetDerivedCount() => 3;
- /// >
- protected sealed override System.Collections.Generic.KeyValuePair GetDerivedProperty(int index) => throw null;
+ ///
+ public int Count => throw null;
+ /// >///
+ public System.Collections.Generic.KeyValuePair this[int index] => throw null;
+ ///
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
+ ///
+ public System.Collections.Generic.IEnumerator> GetEnumerator() => throw null;
}
-
///
- public sealed class SqlClientConnectionCloseAfter : SqlClientDiagnostic
+ public sealed class SqlClientConnectionCloseAfter : System.Collections.Generic.IReadOnlyList>
{
///
public const string Name = "Microsoft.Data.SqlClient.WriteConnectionCloseAfter";
-
+ ///
+ public System.Guid OperationId => throw null;
+ ///
+ public string Operation => throw null;
+ ///
+ public long Timestamp => throw null;
///
public System.Guid? ConnectionId => throw null;
-
///
public SqlConnection Connection => throw null;
-
///
public System.Collections.IDictionary Statistics => throw null;
-
- /// >
- protected sealed override int GetDerivedCount() => 3;
-
- /// >
- protected sealed override System.Collections.Generic.KeyValuePair GetDerivedProperty(int index) => throw null;
+ ///
+ public int Count => throw null;
+ /// >///
+ public System.Collections.Generic.KeyValuePair this[int index] => throw null;
+ ///
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
+ ///
+ public System.Collections.Generic.IEnumerator> GetEnumerator() => throw null;
}
-
///
- public sealed class SqlClientConnectionCloseError : SqlClientDiagnostic
+ public sealed class SqlClientConnectionCloseError : System.Collections.Generic.IReadOnlyList>
{
///
public const string Name = "Microsoft.Data.SqlClient.WriteConnectionCloseError";
+ ///
+ public System.Guid OperationId => throw null;
+ ///
+ public string Operation => throw null;
+ ///
+ public long Timestamp => throw null;
///
public System.Guid? ConnectionId => throw null;
///
@@ -2135,51 +2173,78 @@ public sealed class SqlClientConnectionCloseError : SqlClientDiagnostic
public System.Collections.IDictionary Statistics => throw null;
///
public System.Exception Exception => throw null;
- /// >
- protected sealed override int GetDerivedCount() => 4;
- /// >
- protected sealed override System.Collections.Generic.KeyValuePair GetDerivedProperty(int index) => throw null;
+ ///
+ public int Count => throw null;
+ /// >///
+ public System.Collections.Generic.KeyValuePair this[int index] => throw null;
+ ///
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
+ ///
+ public System.Collections.Generic.IEnumerator> GetEnumerator() => throw null;
}
-
///
- public sealed class SqlClientTransactionCommitBefore : SqlClientDiagnostic
+ public sealed class SqlClientTransactionCommitBefore : System.Collections.Generic.IReadOnlyList>
{
///
public const string Name = "Microsoft.Data.SqlClient.WriteTransactionCommitBefore";
+ ///
+ public System.Guid OperationId => throw null;
+ ///
+ public string Operation => throw null;
+ ///
+ public long Timestamp => throw null;
///
public System.Data.IsolationLevel IsolationLevel => throw null;
///
public SqlConnection Connection => throw null;
///
public long? TransactionId => throw null;
- /// >
- protected sealed override int GetDerivedCount() => 3;
- /// >
- protected sealed override System.Collections.Generic.KeyValuePair GetDerivedProperty(int index) => throw null;
+ ///
+ public int Count => throw null;
+ /// >///
+ public System.Collections.Generic.KeyValuePair this[int index] => throw null;
+ ///
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
+ ///
+ public System.Collections.Generic.IEnumerator> GetEnumerator() => throw null;
}
-
///
- public sealed class SqlClientTransactionCommitAfter : SqlClientDiagnostic
+ public sealed class SqlClientTransactionCommitAfter : System.Collections.Generic.IReadOnlyList>
{
///
public const string Name = "Microsoft.Data.SqlClient.WriteTransactionCommitAfter";
+ ///
+ public System.Guid OperationId => throw null;
+ ///
+ public string Operation => throw null;
+ ///
+ public long Timestamp => throw null;
///
public System.Data.IsolationLevel IsolationLevel => throw null;
///
public SqlConnection Connection => throw null;
///
public long? TransactionId => throw null;
- /// >
- protected sealed override int GetDerivedCount() => 3;
- /// >
- protected sealed override System.Collections.Generic.KeyValuePair GetDerivedProperty(int index) => throw null;
+ ///
+ public int Count => throw null;
+ /// >///
+ public System.Collections.Generic.KeyValuePair this[int index] => throw null;
+ ///
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
+ ///
+ public System.Collections.Generic.IEnumerator> GetEnumerator() => throw null;
}
-
///
- public sealed class SqlClientTransactionCommitError : SqlClientDiagnostic
+ public sealed class SqlClientTransactionCommitError : System.Collections.Generic.IReadOnlyList>
{
///
public const string Name = "Microsoft.Data.SqlClient.WriteTransactionCommitError";
+ ///
+ public System.Guid OperationId => throw null;
+ ///
+ public string Operation => throw null;
+ ///
+ public long Timestamp => throw null;
///
public System.Data.IsolationLevel IsolationLevel => throw null;
///
@@ -2188,17 +2253,26 @@ public sealed class SqlClientTransactionCommitError : SqlClientDiagnostic
public long? TransactionId => throw null;
///
public System.Exception Exception => throw null;
- /// >
- protected sealed override int GetDerivedCount() => 4;
- /// >
- protected sealed override System.Collections.Generic.KeyValuePair GetDerivedProperty(int index) => throw null;
+ ///
+ public int Count => throw null;
+ /// >///
+ public System.Collections.Generic.KeyValuePair this[int index] => throw null;
+ ///
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
+ ///
+ public System.Collections.Generic.IEnumerator> GetEnumerator() => throw null;
}
-
///
- public sealed class SqlClientTransactionRollbackBefore : SqlClientDiagnostic
+ public sealed class SqlClientTransactionRollbackBefore : System.Collections.Generic.IReadOnlyList>
{
///
public const string Name = "Microsoft.Data.SqlClient.WriteTransactionRollbackBefore";
+ ///
+ public System.Guid OperationId => throw null;
+ ///
+ public string Operation => throw null;
+ ///
+ public long Timestamp => throw null;
///
public System.Data.IsolationLevel IsolationLevel => throw null;
///
@@ -2207,17 +2281,26 @@ public sealed class SqlClientTransactionRollbackBefore : SqlClientDiagnostic
public long? TransactionId => throw null;
///
public string TransactionName => throw null;
- /// >
- protected sealed override int GetDerivedCount() => 4;
- /// >
- protected sealed override System.Collections.Generic.KeyValuePair GetDerivedProperty(int index) => throw null;
+ ///
+ public int Count => throw null;
+ /// >///
+ public System.Collections.Generic.KeyValuePair this[int index] => throw null;
+ ///
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
+ ///
+ public System.Collections.Generic.IEnumerator> GetEnumerator() => throw null;
}
-
///
- public sealed class SqlClientTransactionRollbackAfter : SqlClientDiagnostic
+ public sealed class SqlClientTransactionRollbackAfter : System.Collections.Generic.IReadOnlyList>
{
///
public const string Name = "Microsoft.Data.SqlClient.WriteTransactionRollbackAfter";
+ ///
+ public System.Guid OperationId => throw null;
+ ///
+ public string Operation => throw null;
+ ///
+ public long Timestamp => throw null;
///
public System.Data.IsolationLevel IsolationLevel => throw null;
///
@@ -2226,17 +2309,26 @@ public sealed class SqlClientTransactionRollbackAfter : SqlClientDiagnostic
public long? TransactionId => throw null;
///
public string TransactionName => throw null;
- /// >
- protected sealed override int GetDerivedCount() => 4;
- /// >
- protected sealed override System.Collections.Generic.KeyValuePair GetDerivedProperty(int index) => throw null;
+ ///
+ public int Count => throw null;
+ /// >///
+ public System.Collections.Generic.KeyValuePair this[int index] => throw null;
+ ///
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
+ ///
+ public System.Collections.Generic.IEnumerator> GetEnumerator() => throw null;
}
-
///
- public sealed class SqlClientTransactionRollbackError : SqlClientDiagnostic
+ public sealed class SqlClientTransactionRollbackError : System.Collections.Generic.IReadOnlyList>
{
///
public const string Name = "Microsoft.Data.SqlClient.WriteTransactionRollbackError";
+ ///
+ public System.Guid OperationId => throw null;
+ ///
+ public string Operation => throw null;
+ ///
+ public long Timestamp => throw null;
///
public System.Data.IsolationLevel IsolationLevel => throw null;
///
@@ -2247,10 +2339,14 @@ public sealed class SqlClientTransactionRollbackError : SqlClientDiagnostic
public string TransactionName => throw null;
///
public System.Exception Exception => throw null;
- /// >
- protected sealed override int GetDerivedCount() => 5;
- /// >
- protected sealed override System.Collections.Generic.KeyValuePair GetDerivedProperty(int index) => throw null;
+ ///
+ public int Count => throw null;
+ /// >///
+ public System.Collections.Generic.KeyValuePair this[int index] => throw null;
+ ///
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() => GetEnumerator();
+ ///
+ public System.Collections.Generic.IEnumerator> GetEnumerator() => throw null;
}
}
namespace Microsoft.Data.SqlClient.Server
@@ -2290,7 +2386,7 @@ public SqlDataRecord(params Microsoft.Data.SqlClient.Server.SqlMetaData[] metaDa
public virtual double GetDouble(int ordinal) { throw null; }
///
#if NET
- [return: DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicFields | DynamicallyAccessedMemberTypes.PublicProperties)]
+ [return: System.Diagnostics.CodeAnalysis.DynamicallyAccessedMembers(System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicFields | System.Diagnostics.CodeAnalysis.DynamicallyAccessedMemberTypes.PublicProperties)]
#endif
public virtual System.Type GetFieldType(int ordinal) { throw null; }
///