Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
24 changes: 24 additions & 0 deletions src/libraries/System.Data.OleDb/ref/System.Data.OleDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ namespace System.Data.OleDb
{
[System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.Data.VS.OleDbCommandDesigner, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.ToolboxItemAttribute(true)]
#if NET
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("OleDbConnection requires dynamic code.")]
#endif
public sealed partial class OleDbCommand : System.Data.Common.DbCommand, System.Data.IDbCommand, System.ICloneable, System.IDisposable
{
public OleDbCommand() { }
Expand Down Expand Up @@ -120,13 +123,19 @@ public override void EnlistTransaction(System.Transactions.Transaction? transact
public override System.Data.DataTable GetSchema(string collectionName) { throw null; }
public override System.Data.DataTable GetSchema(string collectionName, string?[]? restrictionValues) { throw null; }
public override void Open() { }
#if NET
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("OleDbConnection requires dynamic code.")]
#endif
public static void ReleaseObjectPool() { }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
public void ResetState() { }
object System.ICloneable.Clone() { throw null; }
}
[System.ComponentModel.DefaultPropertyAttribute("Provider")]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
#if NET
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("OleDbConnection requires dynamic code.")]
#endif
public sealed partial class OleDbConnectionStringBuilder : System.Data.Common.DbConnectionStringBuilder
{
public OleDbConnectionStringBuilder() { }
Expand All @@ -151,6 +160,9 @@ public override void Clear() { }
}
[System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.Data.VS.OleDbDataAdapterDesigner, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.ToolboxItemAttribute("Microsoft.VSDesigner.Data.VS.OleDbDataAdapterToolboxItem, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
#if NET
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("OleDbConnection requires dynamic code.")]
#endif
public sealed partial class OleDbDataAdapter : System.Data.Common.DbDataAdapter, System.Data.IDataAdapter, System.Data.IDbDataAdapter, System.ICloneable
{
public OleDbDataAdapter() { }
Expand Down Expand Up @@ -183,6 +195,9 @@ protected override void OnRowUpdated(System.Data.Common.RowUpdatedEventArgs valu
protected override void OnRowUpdating(System.Data.Common.RowUpdatingEventArgs value) { }
object System.ICloneable.Clone() { throw null; }
}
#if NET
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("OleDbConnection requires dynamic code.")]
#endif
public sealed partial class OleDbDataReader : System.Data.Common.DbDataReader
{
internal OleDbDataReader() { }
Expand Down Expand Up @@ -229,6 +244,9 @@ public override void Close() { }
public sealed partial class OleDbEnumerator
{
public OleDbEnumerator() { }
#if NET
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("OleDbConnection requires dynamic code.")]
#endif
public System.Data.DataTable GetElements() { throw null; }
public static System.Data.OleDb.OleDbDataReader GetEnumerator(System.Type type) { throw null; }
public static System.Data.OleDb.OleDbDataReader GetRootEnumerator() { throw null; }
Expand Down Expand Up @@ -265,6 +283,9 @@ internal OleDbException() { }
#endif
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo si, System.Runtime.Serialization.StreamingContext context) { }
}
#if NET
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("OleDbConnection requires dynamic code.")]
#endif
public sealed partial class OleDbFactory : System.Data.Common.DbProviderFactory
{
internal OleDbFactory() { }
Expand Down Expand Up @@ -477,6 +498,9 @@ public sealed partial class OleDbSchemaGuid
public static readonly System.Guid View_Table_Usage;
public OleDbSchemaGuid() { }
}
#if NET
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("OleDbConnection requires dynamic code.")]
#endif
public sealed partial class OleDbTransaction : System.Data.Common.DbTransaction
{
internal OleDbTransaction() { }
Expand Down
108 changes: 108 additions & 0 deletions src/libraries/System.Data.OleDb/src/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,112 @@
<Left>lib/netstandard2.0/System.Data.OleDb.dll</Left>
<Right>lib/net462/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0015</DiagnosticId>
<Target>T:System.Data.OleDb.OleDbCommand:[T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute]</Target>
<Left>ref/net10.0/System.Data.OleDb.dll</Left>
<Right>runtimes/win/lib/net10.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0015</DiagnosticId>
<Target>T:System.Data.OleDb.OleDbDataAdapter:[T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute]</Target>
<Left>ref/net10.0/System.Data.OleDb.dll</Left>
<Right>runtimes/win/lib/net10.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0015</DiagnosticId>
<Target>T:System.Data.OleDb.OleDbDataReader:[T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute]</Target>
<Left>ref/net10.0/System.Data.OleDb.dll</Left>
<Right>runtimes/win/lib/net10.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0015</DiagnosticId>
<Target>T:System.Data.OleDb.OleDbCommand:[T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute]</Target>
<Left>ref/net8.0/System.Data.OleDb.dll</Left>
<Right>runtimes/win/lib/net8.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0015</DiagnosticId>
<Target>T:System.Data.OleDb.OleDbDataAdapter:[T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute]</Target>
<Left>ref/net8.0/System.Data.OleDb.dll</Left>
<Right>runtimes/win/lib/net8.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0015</DiagnosticId>
<Target>T:System.Data.OleDb.OleDbDataReader:[T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute]</Target>
<Left>ref/net8.0/System.Data.OleDb.dll</Left>
<Right>runtimes/win/lib/net8.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0015</DiagnosticId>
<Target>T:System.Data.OleDb.OleDbCommand:[T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute]</Target>
<Left>ref/net9.0/System.Data.OleDb.dll</Left>
<Right>runtimes/win/lib/net9.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0015</DiagnosticId>
<Target>T:System.Data.OleDb.OleDbDataAdapter:[T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute]</Target>
<Left>ref/net9.0/System.Data.OleDb.dll</Left>
<Right>runtimes/win/lib/net9.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0015</DiagnosticId>
<Target>T:System.Data.OleDb.OleDbDataReader:[T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute]</Target>
<Left>ref/net9.0/System.Data.OleDb.dll</Left>
<Right>runtimes/win/lib/net9.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0016</DiagnosticId>
<Target>M:System.Data.OleDb.OleDbEnumerator.GetEnumerator(System.Type):[T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute]</Target>
<Left>ref/net10.0/System.Data.OleDb.dll</Left>
<Right>runtimes/win/lib/net10.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0016</DiagnosticId>
<Target>M:System.Data.OleDb.OleDbEnumerator.GetRootEnumerator:[T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute]</Target>
<Left>ref/net10.0/System.Data.OleDb.dll</Left>
<Right>runtimes/win/lib/net10.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0016</DiagnosticId>
<Target>T:System.Data.OleDb.OleDbConnection:[T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute]</Target>
<Left>ref/net10.0/System.Data.OleDb.dll</Left>
<Right>runtimes/win/lib/net10.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0016</DiagnosticId>
<Target>M:System.Data.OleDb.OleDbEnumerator.GetEnumerator(System.Type):[T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute]</Target>
<Left>ref/net8.0/System.Data.OleDb.dll</Left>
<Right>runtimes/win/lib/net8.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0016</DiagnosticId>
<Target>M:System.Data.OleDb.OleDbEnumerator.GetRootEnumerator:[T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute]</Target>
<Left>ref/net8.0/System.Data.OleDb.dll</Left>
<Right>runtimes/win/lib/net8.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0016</DiagnosticId>
<Target>T:System.Data.OleDb.OleDbConnection:[T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute]</Target>
<Left>ref/net8.0/System.Data.OleDb.dll</Left>
<Right>runtimes/win/lib/net8.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0016</DiagnosticId>
<Target>M:System.Data.OleDb.OleDbEnumerator.GetEnumerator(System.Type):[T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute]</Target>
<Left>ref/net9.0/System.Data.OleDb.dll</Left>
<Right>runtimes/win/lib/net9.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0016</DiagnosticId>
<Target>M:System.Data.OleDb.OleDbEnumerator.GetRootEnumerator:[T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute]</Target>
<Left>ref/net9.0/System.Data.OleDb.dll</Left>
<Right>runtimes/win/lib/net9.0/System.Data.OleDb.dll</Right>
</Suppression>
<Suppression>
<DiagnosticId>CP0016</DiagnosticId>
<Target>T:System.Data.OleDb.OleDbConnection:[T:System.Diagnostics.CodeAnalysis.RequiresDynamicCodeAttribute]</Target>
<Left>ref/net9.0/System.Data.OleDb.dll</Left>
<Right>runtimes/win/lib/net9.0/System.Data.OleDb.dll</Right>
</Suppression>
</Suppressions>
1 change: 1 addition & 0 deletions src/libraries/System.Data.OleDb/src/OleDbCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
{
[Designer("Microsoft.VSDesigner.Data.VS.OleDbCommandDesigner, Microsoft.VSDesigner, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[ToolboxItem(true)]
[RequiresDynamicCode(OleDbConnection.TrimWarning)]

Check failure on line 17 in src/libraries/System.Data.OleDb/src/OleDbCommand.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop (Build Source-Build (Linux_x64))

src/libraries/System.Data.OleDb/src/OleDbCommand.cs#L17

src/libraries/System.Data.OleDb/src/OleDbCommand.cs(17,26): error CS0182: (NETCORE_ENGINEERING_TELEMETRY=Build) An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
public sealed class OleDbCommand : DbCommand, ICloneable, IDbCommand
{
// command data
Expand Down
4 changes: 4 additions & 0 deletions src/libraries/System.Data.OleDb/src/OleDbConnection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@
// it won't happen if you directly create the provider and set its properties
// 2. First call on IDBInitialize must be Initialize, can't QI for any other interfaces before that
[DefaultEvent("InfoMessage")]
[RequiresDynamicCode(OleDbConnection.TrimWarning)]

Check failure on line 22 in src/libraries/System.Data.OleDb/src/OleDbConnection.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop (Build Source-Build (Linux_x64))

src/libraries/System.Data.OleDb/src/OleDbConnection.cs#L22

src/libraries/System.Data.OleDb/src/OleDbConnection.cs(22,26): error CS0182: (NETCORE_ENGINEERING_TELEMETRY=Build) An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
public sealed partial class OleDbConnection : DbConnection, ICloneable, IDbConnection
{
internal const string TrimWarning = OleDbConnection.TrimWarning;

Check failure on line 25 in src/libraries/System.Data.OleDb/src/OleDbConnection.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop (Build linux-x64 debug Libraries_WithPackages)

src/libraries/System.Data.OleDb/src/OleDbConnection.cs#L25

src/libraries/System.Data.OleDb/src/OleDbConnection.cs(25,31): error CS0110: (NETCORE_ENGINEERING_TELEMETRY=Build) The evaluation of the constant value for 'OleDbConnection.TrimWarning' involves a circular definition

Check failure on line 25 in src/libraries/System.Data.OleDb/src/OleDbConnection.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop (Build Source-Build (Linux_x64))

src/libraries/System.Data.OleDb/src/OleDbConnection.cs#L25

src/libraries/System.Data.OleDb/src/OleDbConnection.cs(25,31): error CS0110: (NETCORE_ENGINEERING_TELEMETRY=Build) The evaluation of the constant value for 'OleDbConnection.TrimWarning' involves a circular definition

Check failure on line 25 in src/libraries/System.Data.OleDb/src/OleDbConnection.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop

src/libraries/System.Data.OleDb/src/OleDbConnection.cs#L25

src/libraries/System.Data.OleDb/src/OleDbConnection.cs(25,31): error CS0110: (NETCORE_ENGINEERING_TELEMETRY=Build) The evaluation of the constant value for 'OleDbConnection.TrimWarning' involves a circular definition

private static readonly object EventInfoMessage = new object();

public OleDbConnection(string? connectionString) : this()
Expand Down Expand Up @@ -636,6 +639,7 @@
}

// @devnote: should be multithread safe
[RequiresDynamicCode(OleDbConnection.TrimWarning)]
public static void ReleaseObjectPool()
{
OleDbConnectionString.ReleaseObjectPool();
Expand Down
2 changes: 2 additions & 0 deletions src/libraries/System.Data.OleDb/src/OleDbConnectionFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
using System.Data.Common;
using System.Data.ProviderBase;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.Versioning;

namespace System.Data.OleDb
{
[RequiresDynamicCode("XML deserialization requires dynamic code")]
internal sealed class OleDbConnectionFactory : DbConnectionFactory
{
private OleDbConnectionFactory() : base() { }
Expand Down
46 changes: 44 additions & 2 deletions src/libraries/System.Data.OleDb/src/OleDbConnectionInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
using System.Data.Common;
using System.Data.ProviderBase;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Threading;
using SysTx = System.Transactions;

namespace System.Data.OleDb
{
#if NET
[RequiresDynamicCode(OleDbConnection.TrimWarning)]

Check failure on line 17 in src/libraries/System.Data.OleDb/src/OleDbConnectionInternal.cs

View check run for this annotation

Azure Pipelines / runtime-dev-innerloop (Build Source-Build (Linux_x64))

src/libraries/System.Data.OleDb/src/OleDbConnectionInternal.cs#L17

src/libraries/System.Data.OleDb/src/OleDbConnectionInternal.cs(17,26): error CS0182: (NETCORE_ENGINEERING_TELEMETRY=Build) An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type
#endif
internal sealed class OleDbConnectionInternal : DbConnectionInternal, IDisposable
{
private static volatile OleDbServicesWrapper? idataInitialize;
Expand Down Expand Up @@ -60,6 +64,7 @@
// un-enlisted during Deactivate.
private bool _unEnlistDuringDeactivate;

[RequiresDynamicCode("Processing OleDbConnection requires dynamic code")]
internal OleDbConnectionInternal(OleDbConnectionString constr, OleDbConnection? connection) : base()
{
Debug.Assert((null != constr) && !constr.IsEmpty, "empty connectionstring");
Expand Down Expand Up @@ -219,6 +224,9 @@
}

// optional interface, unsafe cast
#if NET
[RequiresDynamicCode(OleDbConnection.TrimWarning)]
#endif
internal UnsafeNativeMethods.ICommandText? ICommandText()
{
Debug.Assert(null != _datasrcwrp, "IDBCreateCommand: null datasource");
Expand Down Expand Up @@ -375,6 +383,9 @@
return dbprops[0].dwStatus;
}

#if NET
[RequiresDynamicCode(OleDbConnection.TrimWarning)]
#endif
internal unsafe DataTable? BuildInfoLiterals()
{
using (IDBInfoWrapper wrapper = IDBInfo())
Expand Down Expand Up @@ -414,7 +425,11 @@
tagDBLITERALINFO tag = new tagDBLITERALINFO();
for (int i = 0; i < literalCount; ++i, offset += ODB.SizeOf_tagDBLITERALINFO)
{
Marshal.PtrToStructure((nint)offset, tag);
if (offset is null)
{
throw new NullReferenceException();
}
tag = Marshal.PtrToStructure<tagDBLITERALINFO>((IntPtr)offset)!;

DataRow row = table.NewRow();
row[literalName] = ((OleDbLiteral)tag.it).ToString();
Expand All @@ -441,6 +456,9 @@
}
}

#if NET
[RequiresDynamicCode(OleDbConnection.TrimWarning)]
#endif
internal DataTable? BuildInfoKeywords()
{
DataTable? table = new DataTable(ODB.DbInfoKeywords);
Expand All @@ -456,6 +474,9 @@
return table;
}

#if NET
[RequiresDynamicCode(OleDbConnection.TrimWarning)]
#endif
internal bool AddInfoKeywordsToTable(DataTable table, DataColumn keyword)
{
using (IDBInfoWrapper wrapper = IDBInfo())
Expand Down Expand Up @@ -491,6 +512,9 @@
}
}

#if NET
[RequiresDynamicCode(OleDbConnection.TrimWarning)]
#endif
internal DataTable BuildSchemaGuids()
{
DataTable table = new DataTable(ODB.SchemaGuids);
Expand Down Expand Up @@ -519,6 +543,9 @@
return table;
}

#if NET
[RequiresDynamicCode(OleDbConnection.TrimWarning)]
#endif
internal string? GetLiteralInfo(int literal)
{
using (IDBInfoWrapper wrapper = IDBInfo())
Expand Down Expand Up @@ -556,6 +583,9 @@
}
}

#if NET
[RequiresDynamicCode(OleDbConnection.TrimWarning)]
#endif
internal SchemaSupport[]? GetSchemaRowsetInformation()
{
OleDbConnectionString constr = ConnectionString;
Expand Down Expand Up @@ -591,7 +621,7 @@
for (int i = 0, offset = 0; i < supportedSchemas.Length; ++i, offset += ODB.SizeOf_Guid)
{
IntPtr ptr = ADP.IntPtrOffset(schemaGuids, i * ODB.SizeOf_Guid);
supportedSchemas[i]._schemaRowset = (Guid)Marshal.PtrToStructure(ptr, typeof(Guid))!;
supportedSchemas[i]._schemaRowset = Marshal.PtrToStructure<Guid>(ptr)!;
}
}
if (IntPtr.Zero != schemaRestrictions)
Expand All @@ -607,6 +637,9 @@
}
}

#if NET
[RequiresDynamicCode(OleDbConnection.TrimWarning)]
#endif
internal DataTable? GetSchemaRowset(Guid schema, object?[]? restrictions)
{
if (null == restrictions)
Expand Down Expand Up @@ -662,6 +695,9 @@
return (reader != null);
}

#if NET
[RequiresDynamicCode(OleDbConnection.TrimWarning)]
#endif
private void ProcessResults(OleDbHResult hr)
{
OleDbConnection? connection = Connection; // get value from weakref only once
Expand All @@ -670,6 +706,9 @@
{ throw e; }
}

#if NET
[RequiresDynamicCode(OleDbConnection.TrimWarning)]
#endif
internal bool SupportSchemaRowset(Guid schema)
{
SchemaSupport[]? schemaSupport = GetSchemaRowsetInformation();
Expand Down Expand Up @@ -760,6 +799,9 @@
OleDbConnectionInternal.idataInitialize = null;
}

#if NET
[RequiresDynamicCode(OleDbConnection.TrimWarning)]
#endif
internal OleDbTransaction? ValidateTransaction(OleDbTransaction? transaction, string method)
{
if (null != this.weakTransaction)
Expand Down
Loading
Loading