Skip to content

Commit ffbf6fe

Browse files
authored
Make NpgsqlConnection.GetSchema AOT/trimming-compatible (#5301)
Closes #5293
1 parent 25328d6 commit ffbf6fe

File tree

3 files changed

+467
-224
lines changed

3 files changed

+467
-224
lines changed

src/Npgsql/NpgsqlConnection.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1721,8 +1721,6 @@ internal void EndBindingScope(ConnectorBindingScope scope)
17211721
/// <summary>
17221722
/// Returns the supported collections
17231723
/// </summary>
1724-
[RequiresUnreferencedCode("Members from serialized types or types used in expressions may be trimmed if not referenced directly.")]
1725-
[UnconditionalSuppressMessage("Trimming", "IL2046", Justification = "At the Npgsql level we cannot add RUC to GetSchema.")]
17261724
public override DataTable GetSchema()
17271725
=> GetSchema("MetaDataCollections", null);
17281726

@@ -1731,8 +1729,6 @@ public override DataTable GetSchema()
17311729
/// </summary>
17321730
/// <param name="collectionName">The collection name.</param>
17331731
/// <returns>The collection specified.</returns>
1734-
[RequiresUnreferencedCode("Members from serialized types or types used in expressions may be trimmed if not referenced directly.")]
1735-
[UnconditionalSuppressMessage("Trimming", "IL2046", Justification = "At the Npgsql level we cannot add RUC to GetSchema.")]
17361732
public override DataTable GetSchema(string? collectionName) => GetSchema(collectionName, null);
17371733

17381734
/// <summary>
@@ -1744,8 +1740,6 @@ public override DataTable GetSchema()
17441740
/// in the Restrictions collection.
17451741
/// </param>
17461742
/// <returns>The collection specified.</returns>
1747-
[RequiresUnreferencedCode("Members from serialized types or types used in expressions may be trimmed if not referenced directly.")]
1748-
[UnconditionalSuppressMessage("Trimming", "IL2046", Justification = "At the Npgsql level we cannot add RUC to GetSchemaAsync.")]
17491743
public override DataTable GetSchema(string? collectionName, string?[]? restrictions)
17501744
=> NpgsqlSchema.GetSchema(async: false, this, collectionName, restrictions).GetAwaiter().GetResult();
17511745

@@ -1756,9 +1750,7 @@ public override DataTable GetSchema(string? collectionName, string?[]? restricti
17561750
/// An optional token to cancel the asynchronous operation. The default value is <see cref="CancellationToken.None"/>.
17571751
/// </param>
17581752
/// <returns>The collection specified.</returns>
1759-
[RequiresUnreferencedCode("Members from serialized types or types used in expressions may be trimmed if not referenced directly.")]
17601753
#if NET5_0_OR_GREATER
1761-
[UnconditionalSuppressMessage("Trimming", "IL2046", Justification = "At the Npgsql level we cannot add RUC to GetSchemaAsync.")]
17621754
public override Task<DataTable> GetSchemaAsync(CancellationToken cancellationToken = default)
17631755
#else
17641756
public Task<DataTable> GetSchemaAsync(CancellationToken cancellationToken = default)
@@ -1773,9 +1765,7 @@ public Task<DataTable> GetSchemaAsync(CancellationToken cancellationToken = defa
17731765
/// An optional token to cancel the asynchronous operation. The default value is <see cref="CancellationToken.None"/>.
17741766
/// </param>
17751767
/// <returns>The collection specified.</returns>
1776-
[RequiresUnreferencedCode("Members from serialized types or types used in expressions may be trimmed if not referenced directly.")]
17771768
#if NET5_0_OR_GREATER
1778-
[UnconditionalSuppressMessage("Trimming", "IL2046", Justification = "At the Npgsql level we cannot add RUC to GetSchemaAsync.")]
17791769
public override Task<DataTable> GetSchemaAsync(string collectionName, CancellationToken cancellationToken = default)
17801770
#else
17811771
public Task<DataTable> GetSchemaAsync(string collectionName, CancellationToken cancellationToken = default)
@@ -1794,9 +1784,7 @@ public Task<DataTable> GetSchemaAsync(string collectionName, CancellationToken c
17941784
/// An optional token to cancel the asynchronous operation. The default value is <see cref="CancellationToken.None"/>.
17951785
/// </param>
17961786
/// <returns>The collection specified.</returns>
1797-
[RequiresUnreferencedCode("Members from serialized types or types used in expressions may be trimmed if not referenced directly.")]
17981787
#if NET5_0_OR_GREATER
1799-
[UnconditionalSuppressMessage("Trimming", "IL2046", Justification = "At the Npgsql level we cannot add RUC to GetSchemaAsync.")]
18001788
public override Task<DataTable> GetSchemaAsync(string collectionName, string?[]? restrictions, CancellationToken cancellationToken = default)
18011789
#else
18021790
public Task<DataTable> GetSchemaAsync(string collectionName, string?[]? restrictions, CancellationToken cancellationToken = default)

0 commit comments

Comments
 (0)