Skip to content

Commit

Permalink
Move Editor Attribute to S.CM.Primitives and apply to types that had …
Browse files Browse the repository at this point in the history
…it in netfx (#41145)

* Move EditorAttribute to System.ComponentModel.Primitives

* Add EditorAttribute to types that had it in netfx and fix some DesignerSerializableAttributes

* PR Feedback

* PR Feedback
  • Loading branch information
safern committed Aug 23, 2020
1 parent c9f42a4 commit 3130ac9
Show file tree
Hide file tree
Showing 62 changed files with 186 additions and 51 deletions.
1 change: 0 additions & 1 deletion eng/DefaultGenApiDocIds.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// These attributes should be excluded from reference assemblies.

T:System.ComponentModel.Design.Serialization.RootDesignerSerializerAttribute
T:System.ComponentModel.EditorAttribute
T:System.Configuration.ConfigurationPropertyAttribute
T:System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute
T:System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ void System.Collections.ICollection.CopyTo(System.Array array, int index) { }
void System.Collections.IList.Insert(int index, object? value) { }
void System.Collections.IList.Remove(object? value) { }
}
[System.ComponentModel.Design.Serialization.DesignerSerializerAttribute("System.Diagnostics.Design.StringDictionaryCodeDomSerializer, System.Design, Version=4.0.0.0, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.Serialization.CodeDomSerializer, System.Design, Version=4.0.0.0, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.Design.Serialization.DesignerSerializerAttribute("System.Diagnostics.Design.StringDictionaryCodeDomSerializer, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.ComponentModel.Design.Serialization.CodeDomSerializer, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public partial class StringDictionary : System.Collections.IEnumerable
{
public StringDictionary() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ namespace System.Collections.Specialized
/// </devdoc>
[Serializable]
[System.Runtime.CompilerServices.TypeForwardedFrom("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
[DesignerSerializer("System.Diagnostics.Design.StringDictionaryCodeDomSerializer, System.Design, Version=4.0.0.0, PublicKeyToken=b03f5f7f11d50a3a",
"System.ComponentModel.Design.Serialization.CodeDomSerializer, System.Design, Version=4.0.0.0, PublicKeyToken=b03f5f7f11d50a3a")]
[DesignerSerializer("System.Diagnostics.Design.StringDictionaryCodeDomSerializer, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"System.ComponentModel.Design.Serialization.CodeDomSerializer, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public class StringDictionary : IEnumerable
{
// For compatibility, we want the Keys property to return values in lower-case.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,19 @@ public DisplayNameAttribute(string displayName) { }
public override int GetHashCode() { throw null; }
public override bool IsDefaultAttribute() { throw null; }
}
[System.AttributeUsageAttribute(System.AttributeTargets.All, AllowMultiple=true, Inherited=true)]
public sealed partial class EditorAttribute : System.Attribute
{
public EditorAttribute() { }
public EditorAttribute(string typeName, string? baseTypeName) { }
public EditorAttribute(string typeName, System.Type baseType) { }
public EditorAttribute(System.Type type, System.Type baseType) { }
public string? EditorBaseTypeName { get { throw null; } }
public string EditorTypeName { get { throw null; } }
public override object TypeId { get { throw null; } }
public override bool Equals(object? obj) { throw null; }
public override int GetHashCode() { throw null; }
}
public sealed partial class EventHandlerList : System.IDisposable
{
public EventHandlerList() { }
Expand All @@ -167,8 +180,8 @@ public void AddHandlers(System.ComponentModel.EventHandlerList listToAddFrom) {
public void Dispose() { }
public void RemoveHandler(object key, System.Delegate? value) { }
}
[System.ComponentModel.DesignerAttribute("System.ComponentModel.Design.ComponentDesigner, System.Design, Version=4.0.0.0, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.DesignerAttribute("System.Windows.Forms.Design.ComponentDocumentDesigner, System.Design, Version=4.0.0.0, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.DesignerAttribute("System.ComponentModel.Design.ComponentDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.DesignerAttribute("System.Windows.Forms.Design.ComponentDocumentDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.TypeConverterAttribute("System.ComponentModel.ComponentConverter, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
public partial interface IComponent : System.IDisposable
{
Expand Down Expand Up @@ -317,8 +330,8 @@ namespace System.ComponentModel.Design.Serialization
[System.AttributeUsageAttribute(System.AttributeTargets.Class | System.AttributeTargets.Interface, AllowMultiple=true, Inherited=true)]
public sealed partial class DesignerSerializerAttribute : System.Attribute
{
public DesignerSerializerAttribute(string serializerTypeName, string baseSerializerTypeName) { }
public DesignerSerializerAttribute(string serializerTypeName, System.Type baseSerializerType) { }
public DesignerSerializerAttribute(string? serializerTypeName, string? baseSerializerTypeName) { }
public DesignerSerializerAttribute(string? serializerTypeName, System.Type baseSerializerType) { }
public DesignerSerializerAttribute(System.Type serializerType, System.Type baseSerializerType) { }
public string? SerializerBaseTypeName { get { throw null; } }
public string? SerializerTypeName { get { throw null; } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Compile Include="System\ComponentModel\DesignOnlyAttribute.cs" />
<Compile Include="System\ComponentModel\Design\Serialization\DesignerSerializerAttribute.cs" />
<Compile Include="System\ComponentModel\DisplayNameAttribute.cs" />
<Compile Include="System\ComponentModel\EditorAttribute.cs" />
<Compile Include="System\ComponentModel\EventHandlerList.cs" />
<Compile Include="System\ComponentModel\IComponent.cs" />
<Compile Include="System\ComponentModel\IContainer.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace System.ComponentModel
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = true)]
public sealed class EditorAttribute : Attribute
{
private string _typeId;
private string? _typeId;

/// <summary>
/// Initializes a new instance of the <see cref='System.ComponentModel.EditorAttribute'/> class
Expand All @@ -25,7 +25,7 @@ public EditorAttribute()
/// Initializes a new instance of the <see cref='System.ComponentModel.EditorAttribute'/> class with the type name and base type
/// name of the editor.
/// </summary>
public EditorAttribute(string typeName, string baseTypeName)
public EditorAttribute(string typeName, string? baseTypeName)
{
EditorTypeName = typeName ?? throw new ArgumentNullException(nameof(typeName));
EditorBaseTypeName = baseTypeName;
Expand Down Expand Up @@ -63,14 +63,14 @@ public EditorAttribute(Type type, Type baseType)
throw new ArgumentNullException(nameof(baseType));
}

EditorTypeName = type.AssemblyQualifiedName;
EditorTypeName = type.AssemblyQualifiedName!;
EditorBaseTypeName = baseType.AssemblyQualifiedName;
}

/// <summary>
/// Gets the name of the base class or interface serving as a lookup key for this editor.
/// </summary>
public string EditorBaseTypeName { get; }
public string? EditorBaseTypeName { get; }

/// <summary>
/// Gets the name of the editor class.
Expand Down Expand Up @@ -102,7 +102,7 @@ public override object TypeId
}
}

public override bool Equals(object obj)
public override bool Equals(object? obj)
{
if (obj == this)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ namespace System.ComponentModel
/// provided "site".
/// Provides functionality required by all components.
/// </summary>
[Designer("System.ComponentModel.Design.ComponentDesigner, System.Design, Version=4.0.0.0, PublicKeyToken=b03f5f7f11d50a3a")]
[Designer("System.Windows.Forms.Design.ComponentDocumentDesigner, System.Design, Version=4.0.0.0, PublicKeyToken=b03f5f7f11d50a3a")]
[Designer("System.ComponentModel.Design.ComponentDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[Designer("System.Windows.Forms.Design.ComponentDocumentDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[TypeConverter("System.ComponentModel.ComponentConverter, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
public interface IComponent : IDisposable
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<Compile Include="System\ComponentModel\DesignerSerializationVisibilityAttributeTests.cs" />
<Compile Include="System\ComponentModel\DesignOnlyAttributeTests.cs" />
<Compile Include="System\ComponentModel\DisplayNameAttributeTests.cs" />
<Compile Include="System\ComponentModel\EditorAttributeTests.cs" />
<Compile Include="System\ComponentModel\EventHandlerListTests.cs" />
<Compile Include="System\ComponentModel\ImmutableObjectAttributeTests.cs" />
<Compile Include="System\ComponentModel\InitializationEventAttributeTests.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ComponentModel.Component))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ComponentModel.DesignerAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ComponentModel.Design.Serialization.DesignerSerializerAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ComponentModel.EditorAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ComponentModel.InvalidAsynchronousStateException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ComponentModel.InvalidEnumArgumentException))]
[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ComponentModel.ISupportInitialize))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,19 +398,6 @@ public partial class DoubleConverter : System.ComponentModel.BaseNumberConverter
{
public DoubleConverter() { }
}
[System.AttributeUsageAttribute(System.AttributeTargets.All, AllowMultiple=true, Inherited=true)]
public sealed partial class EditorAttribute : System.Attribute
{
public EditorAttribute() { }
public EditorAttribute(string typeName, string baseTypeName) { }
public EditorAttribute(string typeName, System.Type baseType) { }
public EditorAttribute(System.Type type, System.Type baseType) { }
public string EditorBaseTypeName { get { throw null; } }
public string EditorTypeName { get { throw null; } }
public override object TypeId { get { throw null; } }
public override bool Equals(object obj) { throw null; }
public override int GetHashCode() { throw null; }
}
public partial class EnumConverter : System.ComponentModel.TypeConverter
{
public EnumConverter(System.Type type) { }
Expand Down Expand Up @@ -586,6 +573,7 @@ public partial interface IIntellisenseBuilder
string Name { get; }
bool Show(string language, string value, ref string newValue);
}
[System.ComponentModel.EditorAttribute("System.Windows.Forms.Design.DataSourceListEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
[System.ComponentModel.MergablePropertyAttribute(false)]
public partial interface IListSource
{
Expand Down Expand Up @@ -1568,6 +1556,7 @@ protected virtual void PopulateOptionCollection(System.ComponentModel.Design.Des
protected virtual bool ShowDialog(System.ComponentModel.Design.DesignerOptionService.DesignerOptionCollection options, object optionObject) { throw null; }
object System.ComponentModel.Design.IDesignerOptionService.GetOptionValue(string pageName, string valueName) { throw null; }
void System.ComponentModel.Design.IDesignerOptionService.SetOptionValue(string pageName, string valueName, object value) { }
[System.ComponentModel.EditorAttribute("", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public sealed partial class DesignerOptionCollection : System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList
{
internal DesignerOptionCollection() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@
<Compile Include="System\ComponentModel\Design\CommandID.cs" />
<Compile Include="System\ComponentModel\Design\CheckoutException.cs" />
<Compile Include="System\ComponentModel\Design\StandardCommands.cs" />
<Compile Include="System\ComponentModel\EditorAttribute.cs" />
<Compile Include="System\ComponentModel\ExpandableObjectConverter.cs" />
<Compile Include="System\ComponentModel\IBindingListView.cs" />
<Compile Include="System\ComponentModel\ListSortDescriptionCollection.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ void IDesignerOptionService.SetOptionValue(string pageName, string valueName, ob
/// properties if all the branch's children.
/// </summary>
[TypeConverter(typeof(DesignerOptionConverter))]
[Editor("", "System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public sealed class DesignerOptionCollection : IList
{
private readonly DesignerOptionService _service;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
namespace System.ComponentModel
{
[MergableProperty(false)]
[Editor("System.Windows.Forms.Design.DataSourceListEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
"System.Drawing.Design.UITypeEditor, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]
public interface IListSource
{
bool ContainsListCollection { get; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@
<Compile Include="DateTimeOffsetConverterTests.cs" />
<Compile Include="DecimalConverterTests.cs" />
<Compile Include="DefaultEventAttributeTests.cs" />
<Compile Include="EditorAttributeTests.cs" />
<Compile Include="DesignTimeVisibleAttributeTests.cs" />
<Compile Include="DefaultPropertyAttributeTests.cs" />
<Compile Include="Design\DesignerTransactionCloseEventArgsTests.cs" />
Expand Down
Loading

0 comments on commit 3130ac9

Please sign in to comment.