Skip to content

Commit

Permalink
Validate member attributes (dotnet/corefx#42427)
Browse files Browse the repository at this point in the history
* Fix APICompat issues for member attributes

* Addressing more member attribute diffs

* Fix SQLClient build


Commit migrated from dotnet/corefx@33d0499
  • Loading branch information
ericstj authored and msftbot[bot] committed Nov 11, 2019
1 parent 7f823cc commit 25930e9
Show file tree
Hide file tree
Showing 36 changed files with 782 additions and 87 deletions.
4 changes: 4 additions & 0 deletions eng/DefaultGenApiDocIds.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,16 @@ T:System.Diagnostics.DebuggerNonUserCodeAttribute
T:System.Diagnostics.DebuggerStepThroughAttribute
T:System.Diagnostics.DebuggerTypeProxyAttribute
T:System.Diagnostics.MonitoringDescriptionAttribute
T:System.Diagnostics.StackTraceHiddenAttribute
T:System.IO.IODescriptionAttribute
T:System.Runtime.CompilerServices.AsyncIteratorStateMachineAttribute
T:System.Runtime.CompilerServices.AsyncStateMachineAttribute
T:System.Runtime.CompilerServices.CompilerGeneratedAttribute
T:System.Runtime.CompilerServices.IteratorStateMachineAttribute
T:System.Runtime.CompilerServices.MethodImpl
T:System.Runtime.CompilerServices.NullableAttribute
T:System.Runtime.CompilerServices.NullableContextAttribute
T:System.Runtime.CompilerServices.PreserveDependencyAttribute
T:System.Runtime.CompilerServices.TypeForwardedFromAttribute
T:System.Runtime.ConstrainedExecution.ReliabilityContractAttribute
T:System.Runtime.InteropServices.ClassInterfaceAttribute
Expand All @@ -49,6 +52,7 @@ T:System.Drawing.SRDescriptionAttribute
T:System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute
T:System.Runtime.CompilerServices.AsyncMethodBuilderAttribute
T:System.Reflection.DefaultMemberAttribute
T:System.Timers.TimersDescriptionAttribute

// These do not need to be persisted in the implementation
T:System.ComponentModel.EditorBrowsableAttribute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ public partial class BackgroundWorker : System.ComponentModel.Component
public BackgroundWorker() { }
public bool CancellationPending { get { throw null; } }
public bool IsBusy { get { throw null; } }
[System.ComponentModel.DefaultValueAttribute(false)]
public bool WorkerReportsProgress { get { throw null; } set { } }
[System.ComponentModel.DefaultValueAttribute(false)]
public bool WorkerSupportsCancellation { get { throw null; } set { } }
public event System.ComponentModel.DoWorkEventHandler DoWork { add { } remove { } }
public event System.ComponentModel.ProgressChangedEventHandler ProgressChanged { add { } remove { } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2269,10 +2269,14 @@ public partial class Timer : System.ComponentModel.Component, System.ComponentMo
{
public Timer() { }
public Timer(double interval) { }
[System.ComponentModel.DefaultValueAttribute(true)]
public bool AutoReset { get { throw null; } set { } }
[System.ComponentModel.DefaultValueAttribute(false)]
public bool Enabled { get { throw null; } set { } }
[System.ComponentModel.DefaultValueAttribute(100d)]
public double Interval { get { throw null; } set { } }
public override System.ComponentModel.ISite Site { get { throw null; } set { } }
[System.ComponentModel.DefaultValueAttribute(null)]
public System.ComponentModel.ISynchronizeInvoke SynchronizingObject { get { throw null; } set { } }
public event System.Timers.ElapsedEventHandler Elapsed { add { } remove { } }
public void BeginInit() { }
Expand Down
8 changes: 0 additions & 8 deletions src/libraries/System.Data.Common/ref/System.Data.Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,9 @@ public DataColumn(string columnName, System.Type dataType, string expr, System.D
[System.ComponentModel.DefaultValueAttribute("")]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
public string ColumnName { get { throw null; } set { } }
[System.ComponentModel.DefaultValueAttribute(typeof(string))]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
public System.Type DataType { get { throw null; } set { } }
[System.ComponentModel.DefaultValueAttribute(System.Data.DataSetDateTime.UnspecifiedLocal)]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
public System.Data.DataSetDateTime DateTimeMode { get { throw null; } set { } }
public object DefaultValue { get { throw null; } set { } }
[System.ComponentModel.DefaultValueAttribute("")]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
public string Expression { get { throw null; } set { } }
Expand Down Expand Up @@ -634,7 +630,6 @@ public DataTable(string tableName, string tableNamespace) { }
public System.Data.DataRelationCollection ParentRelations { get { throw null; } }
[System.ComponentModel.DefaultValueAttribute("")]
public string Prefix { get { throw null; } set { } }
public System.Data.DataColumn[] PrimaryKey { get { throw null; } set { } }
[System.ComponentModel.DefaultValueAttribute(System.Data.SerializationFormat.Xml)]
public System.Data.SerializationFormat RemotingFormat { get { throw null; } set { } }
[System.ComponentModel.BrowsableAttribute(false)]
Expand Down Expand Up @@ -884,9 +879,6 @@ public DataView(System.Data.DataTable table, string RowFilter, string Sort, Syst
System.ComponentModel.ListSortDescriptionCollection System.ComponentModel.IBindingListView.SortDescriptions { get { throw null; } }
bool System.ComponentModel.IBindingListView.SupportsAdvancedSorting { get { throw null; } }
bool System.ComponentModel.IBindingListView.SupportsFiltering { get { throw null; } }
[System.ComponentModel.DefaultValueAttribute(null)]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
public System.Data.DataTable Table { get { throw null; } set { } }
public event System.EventHandler Initialized { add { } remove { } }
public event System.ComponentModel.ListChangedEventHandler ListChanged { add { } remove { } }
public virtual System.Data.DataRowView AddNew() { throw null; }
Expand Down
29 changes: 29 additions & 0 deletions src/libraries/System.Data.Common/ref/System.Data.Common.manual.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,35 @@ internal class ConstraintConverter { }
[System.ComponentModel.TypeConverter(typeof(RelationshipConverter))]
public partial class DataRelation { }
internal class RelationshipConverter { }

public partial class DataColumn
{
[System.ComponentModel.DefaultValueAttribute(typeof(string))]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
[System.ComponentModel.TypeConverter(typeof(ColumnTypeConverter))]
public System.Type DataType { get { throw null; } set { } }

[System.ComponentModel.TypeConverter(typeof(DefaultValueTypeConverter))]
public object DefaultValue { get { throw null; } set { } }
}
internal class ColumnTypeConverter { }
internal class DefaultValueTypeConverter { }

public partial class DataTable
{
[System.ComponentModel.TypeConverter(typeof(PrimaryKeyTypeConverter))]
public System.Data.DataColumn[] PrimaryKey { get { throw null; } set { } }
}
internal class PrimaryKeyTypeConverter { }

public partial class DataView
{
[System.ComponentModel.DefaultValueAttribute(null)]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
[System.ComponentModel.TypeConverter(typeof(DataTableTypeConverter))]
public System.Data.DataTable Table { get { throw null; } set { } }
}
internal class DataTableTypeConverter { }
}
namespace System.Data.Common
{
Expand Down
22 changes: 19 additions & 3 deletions src/libraries/System.Data.OleDb/ref/System.Data.OleDb.Manual.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,24 @@ internal class OleDbParameterConverter : System.ComponentModel.ExpandableObjectC
[System.ComponentModel.TypeConverterAttribute(typeof(OleDbConnectionStringBuilder.OleDbConnectionStringBuilderConverter))]
public sealed partial class OleDbConnectionStringBuilder : System.Data.Common.DbConnectionStringBuilder
{
internal class OleDbConnectionStringBuilderConverter : System.ComponentModel.ExpandableObjectConverter
{
}
[System.ComponentModel.DisplayNameAttribute("OLE DB Services")]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
[System.ComponentModel.TypeConverterAttribute(typeof(OleDbServicesConverter))]
public int OleDbServices { get { throw null; } set { } }
[System.ComponentModel.DisplayNameAttribute("Provider")]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
[System.ComponentModel.TypeConverterAttribute(typeof(OleDbProviderConverter))]
public string Provider { get { throw null; } set { } }

internal class OleDbConnectionStringBuilderConverter { }
internal class OleDbServicesConverter { }
internal class OleDbProviderConverter { }
}
public sealed partial class OleDbException
{
[System.ComponentModel.TypeConverterAttribute(typeof(ErrorCodeConverter))]
public override int ErrorCode { get { throw null; } }

internal class ErrorCodeConverter { }
}
}
10 changes: 2 additions & 8 deletions src/libraries/System.Data.OleDb/ref/System.Data.OleDb.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public sealed partial class OleDbConnection : System.Data.Common.DbConnection, S
public OleDbConnection() { }
public OleDbConnection(string connectionString) { }
[System.ComponentModel.DefaultValueAttribute("")]
[System.ComponentModel.RecommendedAsConfigurableAttribute(true)]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
[System.ComponentModel.SettingsBindableAttribute(true)]
public override string ConnectionString { get { throw null; } set { } }
Expand Down Expand Up @@ -130,15 +131,9 @@ public OleDbConnectionStringBuilder(string connectionString) { }
public string FileName { get { throw null; } set { } }
public override object this[string keyword] { get { throw null; } set { } }
public override System.Collections.ICollection Keys { get { throw null; } }
[System.ComponentModel.DisplayNameAttribute("OLE DB Services")]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
public int OleDbServices { get { throw null; } set { } }
[System.ComponentModel.DisplayNameAttribute("Persist Security Info")]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
public bool PersistSecurityInfo { get { throw null; } set { } }
[System.ComponentModel.DisplayNameAttribute("Provider")]
[System.ComponentModel.RefreshPropertiesAttribute(System.ComponentModel.RefreshProperties.All)]
public string Provider { get { throw null; } set { } }
public override void Clear() { }
public override bool ContainsKey(string keyword) { throw null; }
public override bool Remove(string keyword) { throw null; }
Expand Down Expand Up @@ -244,7 +239,7 @@ public void CopyTo(System.Data.OleDb.OleDbError[] array, int index) { }
public sealed partial class OleDbException : System.Data.Common.DbException
{
internal OleDbException() { }
public override int ErrorCode { get { throw null; } }
[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)]
public System.Data.OleDb.OleDbErrorCollection Errors { get { throw null; } }
public override void GetObjectData(System.Runtime.Serialization.SerializationInfo si, System.Runtime.Serialization.StreamingContext context) { }
}
Expand All @@ -263,7 +258,6 @@ public sealed partial class OleDbInfoMessageEventArgs : System.EventArgs
{
internal OleDbInfoMessageEventArgs() { }
public int ErrorCode { get { throw null; } }
[System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)]
public System.Data.OleDb.OleDbErrorCollection Errors { get { throw null; } }
public string Message { get { throw null; } }
public string Source { get { throw null; } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<PropertyGroup>
<IsPartialFacadeAssembly Condition="'$(TargetsNetFx)' == 'true'">true</IsPartialFacadeAssembly>
<Configurations>net461-Debug;net461-Release;netfx-Debug;netfx-Release;netstandard2.0-Debug;netstandard2.0-Release</Configurations>
<NoWarn>$(NoWarn);0618</NoWarn>
</PropertyGroup>
<ItemGroup>
<Compile Include="System.Data.OleDb.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<NoWarn>$(NoWarn);CS1573</NoWarn>
<IsPartialFacadeAssembly Condition="'$(TargetsNetFx)' == 'true'">true</IsPartialFacadeAssembly>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(OSGroup)' == 'AnyOS' and '$(TargetsNetStandard)' == 'true'">SR.PlatformNotSupported_OleDb</GeneratePlatformNotSupportedAssemblyMessage>
<NoWarn Condition="'$(OSGroup)' == 'AnyOS' and '$(TargetsNetStandard)' == 'true'">$(NoWarn);CS0618</NoWarn>
<Configurations>net461-Windows_NT-Debug;net461-Windows_NT-Release;netfx-Windows_NT-Debug;netfx-Windows_NT-Release;netstandard2.0-Debug;netstandard2.0-Release;netstandard2.0-Windows_NT-Debug;netstandard2.0-Windows_NT-Release</Configurations>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ public sealed partial class SqlConnection : System.Data.Common.DbConnection
// SqlConection expects IDisposable methods to be implemented via System.ComponentModel.Component, which it no longer inherits from
protected override void Dispose(bool disposing) { }
}
public sealed partial class SqlConnectionStringBuilder
{
[System.ComponentModel.TypeConverter(typeof(SqlInitialCatalogConverter))]
public string InitialCatalog { get { throw null; } set { } }

private sealed class SqlInitialCatalogConverter { }
}

[System.ComponentModel.TypeConverter(typeof(SqlParameterConverter))]
public sealed partial class SqlParameter
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,6 @@ public SqlConnectionStringBuilder(string connectionString) { }
public bool Encrypt { get { throw null; } set { } }
public bool Enlist { get { throw null; } set { } }
public string FailoverPartner { get { throw null; } set { } }
public string InitialCatalog { get { throw null; } set { } }
public bool IntegratedSecurity { get { throw null; } set { } }
public override object this[string keyword] { get { throw null; } set { } }
public override System.Collections.ICollection Keys { get { throw null; } }
Expand Down Expand Up @@ -750,16 +749,20 @@ public SqlParameter(string parameterName, object value) { }
public int LocaleId { get { throw null; } set { } }
public int Offset { get { throw null; } set { } }
public override string ParameterName { get { throw null; } set { } }
[System.ComponentModel.DefaultValueAttribute((byte)0)]
public new byte Precision { get { throw null; } set { } }
[System.ComponentModel.DefaultValueAttribute((byte)0)]
public new byte Scale { get { throw null; } set { } }
public override int Size { get { throw null; } set { } }
public override string SourceColumn { get { throw null; } set { } }
public override bool SourceColumnNullMapping { get { throw null; } set { } }
public override System.Data.DataRowVersion SourceVersion { get { throw null; } set { } }
[System.Data.Common.DbProviderSpecificTypePropertyAttribute(true)]
public System.Data.SqlDbType SqlDbType { get { throw null; } set { } }
public object SqlValue { get { throw null; } set { } }
public string TypeName { get { throw null; } set { } }
public string UdtTypeName { get { throw null; } set { } }
[System.ComponentModel.TypeConverterAttribute(typeof(System.ComponentModel.StringConverter))]
public override object Value { get { throw null; } set { } }
public string XmlSchemaCollectionDatabase { get { throw null; } set { } }
public string XmlSchemaCollectionName { get { throw null; } set { } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
<ProjectReference Include="..\..\System.Data.Common\ref\System.Data.Common.csproj" />
<ProjectReference Include="..\..\System.Collections.NonGeneric\ref\System.Collections.NonGeneric.csproj" />
<ProjectReference Include="..\..\System.ComponentModel.Primitives\ref\System.ComponentModel.Primitives.csproj" />
<ProjectReference Include="..\..\System.ComponentModel.TypeConverter\ref\System.ComponentModel.TypeConverter.csproj" />
<ProjectReference Include="..\..\System.ObjectModel\ref\System.ObjectModel.csproj" />
<ProjectReference Include="..\..\System.Xml.ReaderWriter\ref\System.Xml.ReaderWriter.csproj" />
<ProjectReference Include="..\..\System.Runtime.InteropServices\ref\System.Runtime.InteropServices.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,7 @@
<Reference Condition="'$(TargetFramework)' != 'netstandard2.0'" Include="System.Data.Common" />
<Reference Include="System.Globalization" />
<Reference Include="System.IO" />
<Reference Include="System.ObjectModel" />
<Reference Include="System.Resources.ResourceManager" />
<Reference Include="System.Runtime" />
<Reference Include="System.Threading.Tasks" />
Expand All @@ -520,14 +521,12 @@
<Reference Include="System.Collections.Concurrent" />
<Reference Include="System.ComponentModel" />
<Reference Include="System.ComponentModel.Primitives" />
<Reference Include="System.ComponentModel.TypeConverter" />
<Reference Include="System.Diagnostics.Debug" />
<Reference Include="System.Diagnostics.DiagnosticSource" />
<Reference Include="System.Diagnostics.Process" />
<Reference Include="System.Diagnostics.Tools" />
<Reference Include="System.Diagnostics.Tracing" />
<Reference Include="System.Linq" />
<Reference Include="System.ObjectModel" />
<Reference Include="System.Runtime.Extensions" />
<Reference Include="System.Runtime.InteropServices" />
<Reference Include="System.Runtime.InteropServices.RuntimeInformation" />
Expand All @@ -551,6 +550,7 @@
<ItemGroup Condition="'$(TargetsNetCoreApp)' == 'true'">
<Reference Include="System.Transactions.Local" />
<Reference Include="System.Collections.NonGeneric" />
<Reference Include="System.ComponentModel.TypeConverter" />
</ItemGroup>
<ItemGroup Condition="'$(TargetsNetFx)' == 'true'">
<Reference Include="mscorlib" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,8 @@ public enum EventLogEntryType
public sealed partial class EventLogTraceListener : System.Diagnostics.TraceListener
{
public EventLogTraceListener() { }
[System.CLSCompliantAttribute(false)]
public EventLogTraceListener(System.Diagnostics.EventLog eventLog) { }
public EventLogTraceListener(string source) { }
[System.CLSCompliantAttribute(false)]
public System.Diagnostics.EventLog EventLog { get { throw null; } set { } }
public override string Name { get { throw null; } set { } }
public override void Close() { }
Expand Down
Loading

0 comments on commit 25930e9

Please sign in to comment.