diff --git a/src/libraries/System.Data.OleDb/src/OleDbDataReader.cs b/src/libraries/System.Data.OleDb/src/OleDbDataReader.cs index e305bfd04167ee..a995719d3b8967 100644 --- a/src/libraries/System.Data.OleDb/src/OleDbDataReader.cs +++ b/src/libraries/System.Data.OleDb/src/OleDbDataReader.cs @@ -7,6 +7,7 @@ using System.Data.Common; using System.Data.ProviderBase; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; @@ -329,7 +330,14 @@ private DataTable BuildSchemaTable(MetaData[] metadata) DataColumn precision = new DataColumn("NumericPrecision", typeof(short)); DataColumn scale = new DataColumn("NumericScale", typeof(short)); - DataColumn dataType = new DataColumn("DataType", typeof(System.Type)); + DataColumn dataType = GetSystemTypeDataColumn(); + + [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2110", + Justification = "The problem is Type.TypeInitializer which requires static .ctor on the type" + + "which in this case is System.Type itself. System.Type.cctor will always be preserved anyway.")] + static DataColumn GetSystemTypeDataColumn() => + new DataColumn(SchemaTableColumn.DataType, typeof(Type)); + DataColumn providerType = new DataColumn("ProviderType", typeof(int)); DataColumn isLong = new DataColumn("IsLong", typeof(bool));