Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update inappropriate ComVisible attributes #3388

Merged
merged 14 commits into from
Jun 17, 2020
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

using System.Runtime.CompilerServices;

[assembly: System.Runtime.InteropServices.ComVisible(false)]

// expose internal types to System.Design for type forwarding
[assembly: InternalsVisibleTo("System.Design, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

namespace System.ComponentModel.Design
{
[ComVisible(true)]
public class DesignerActionListCollection : CollectionBase
weltkante marked this conversation as resolved.
Show resolved Hide resolved
{
public DesignerActionListCollection()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,5 @@ namespace System.ComponentModel.Design
/// <summary>
/// This event is raised by the <see cref="DesignerActionService"/> when a shortcut is either added or removed to/from the related object.
/// </summary>
[ComVisible(true)]
public delegate void DesignerActionListsChangedEventHandler(object sender, DesignerActionListsChangedEventArgs e);
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace System.ComponentModel.Design
/// <summary>
/// An enum that defines what type of action happend to the related object's <see cref="DesignerActionListCollection">designer action lists collection</see>.
/// </summary>
[ComVisible(true)]
public enum DesignerActionListsChangedType
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace System.ComponentModel.Design
/// that there has been a change in MenuCommands (added or removed)
/// on the related object.
/// </summary>
[System.Runtime.InteropServices.ComVisible(true)]
public class MenuCommandsChangedEventArgs : EventArgs
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ namespace System.ComponentModel.Design
/// This event is thown by the MenuCommandService when a shortcut
/// is either added or removed to/from the related object.
/// </summary>
[System.Runtime.InteropServices.ComVisible(true)]
public delegate void MenuCommandsChangedEventHandler(object sender, MenuCommandsChangedEventArgs e);
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ namespace System.ComponentModel.Design
/// An enum that defines what time of action happend to the
/// related object's MenuCommands collection.
/// </summary>
[System.Runtime.InteropServices.ComVisible(true)]
public enum MenuCommandsChangedType
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,6 @@ private void SetFocus(Point newFocus)
}
}

[ComVisible(true)]
public class ColorPaletteAccessibleObject : ControlAccessibleObject
{
private readonly ColorCellAccessibleObject[] cells;
Expand Down Expand Up @@ -598,7 +597,6 @@ public override AccessibleObject HitTest(int x, int y)
return base.HitTest(x, y);
}

[ComVisible(true)]
public class ColorCellAccessibleObject : AccessibleObject
{
private readonly Color color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2358,7 +2358,6 @@ private int GetParentPointFromLparam(IntPtr lParam)
return PARAM.ToInt(pt.X, pt.Y);
}

[ComVisible(true)]
public class ControlDesignerAccessibleObject : AccessibleObject
{
private readonly ControlDesigner _designer = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace System.Windows.Forms.Design
/// <summary>
/// Provides access to get and set option values for a designer.
/// </summary>
[ComVisible(true)]
public class DesignerOptions
weltkante marked this conversation as resolved.
Show resolved Hide resolved
{
private const int MinGridSize = 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ namespace System.Windows.Forms.Design
/// <summary>
/// Provides an interface for a designer to support Insitu editing for selected components.
/// </summary>
[Runtime.InteropServices.ComVisible(true)]
internal interface ISupportInSituService
weltkante marked this conversation as resolved.
Show resolved Hide resolved
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

using System.Runtime.CompilerServices;

[assembly: System.Runtime.InteropServices.ComVisible(false)]

[assembly: InternalsVisibleTo("System.Windows.Forms, PublicKey=00000000000000000400000000000000")]
[assembly: InternalsVisibleTo("System.Windows.Forms.Design, PublicKey=00000000000000000400000000000000")]
[assembly: InternalsVisibleTo("System.Windows.Forms.Design.Editors, PublicKey=00000000000000000400000000000000")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

namespace System.Windows.Forms.Primitives.Tests.Interop.Mocks
{
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
internal class MockAxHost
{
private static Guid ipictureDisp_Guid = typeof(IPictureDisp).GUID;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

using System.Runtime.CompilerServices;

[assembly: System.Runtime.InteropServices.ComVisible(false)]

[assembly: InternalsVisibleTo("System.Windows.Forms.Tests, PublicKey=00000000000000000400000000000000")]
[assembly: InternalsVisibleTo("MauiMonthCalendarTests, PublicKey=00000000000000000400000000000000")]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ namespace System.Windows.Forms
/// Provides an implementation for an object that can be inspected by an
/// accessibility application.
/// </summary>
[ComVisible(true)]
public partial class AccessibleObject :
StandardOleMarshalObject,
IReflect,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace System.Windows.Forms
/// <summary>
/// Specifies the appearance of a control.
/// </summary>
[ComVisible(true)]
public enum Appearance
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace System.Windows.Forms
/// <summary>
/// Specifies the direction the system uses to arrange minimized windows.
/// </summary>
[ComVisible(true)]
[Flags]
public enum ArrangeDirection
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ namespace System.Windows.Forms
{
public abstract partial class AxHost
{
[ComVisible(false)]
weltkante marked this conversation as resolved.
Show resolved Hide resolved
public class AxComponentEditor : WindowsFormsComponentEditor
{
public override bool EditComponent(ITypeDescriptorContext context, object obj, IWin32Window parent)
Expand Down
2 changes: 0 additions & 2 deletions src/System.Windows.Forms/src/System/Windows/Forms/AxHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ namespace System.Windows.Forms
/// <summary>
/// Wraps ActiveX controls and exposes them as fully featured windows forms controls.
/// </summary>
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[ToolboxItem(false)]
[DesignTimeVisible(false)]
[DefaultEvent(nameof(Enter))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

namespace System.Windows.Forms
{
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[DefaultProperty(nameof(BindingSource))]
[DefaultEvent(nameof(RefreshItems))]
[Designer("System.Windows.Forms.Design.BindingNavigatorDesigner, " + AssemblyRef.SystemDesign)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace System.Windows.Forms
/// <summary>
/// Specifies the sides of a rectangle to apply a three-dimensional border to.
/// </summary>
[ComVisible(true)]
[Flags]
public enum Border3DSide
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ namespace System.Windows.Forms
/// <summary>
/// Specifies the style of a three-dimensional border.
/// </summary>
[ComVisible(true)]
public enum Border3DStyle
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace System.Windows.Forms
/// <summary>
/// Specifies the border style for a control or form.
/// </summary>
[ComVisible(true)]
public enum BorderStyle
{
/// <summary>
Expand Down
2 changes: 0 additions & 2 deletions src/System.Windows.Forms/src/System/Windows/Forms/Button.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ namespace System.Windows.Forms
/// Represents a
/// Windows button.
/// </summary>
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[SRDescription(nameof(SR.DescriptionButton))]
[Designer("System.Windows.Forms.Design.ButtonBaseDesigner, " + AssemblyRef.SystemDesign)]
public class Button : ButtonBase, IButtonControl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ namespace System.Windows.Forms
/// <summary>
/// Implements the basic functionality required by a button control.
/// </summary>
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[Designer("System.Windows.Forms.Design.ButtonBaseDesigner, " + AssemblyRef.SystemDesign)]
public abstract class ButtonBase : Control
{
Expand Down Expand Up @@ -1352,7 +1350,6 @@ protected override void WndProc(ref Message m)
}
}

[ComVisible(true)]
public class ButtonBaseAccessibleObject : ControlAccessibleObject
{
public ButtonBaseAccessibleObject(Control owner) : base(owner)
Expand Down
3 changes: 0 additions & 3 deletions src/System.Windows.Forms/src/System/Windows/Forms/CheckBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ namespace System.Windows.Forms
/// Represents a Windows
/// check box.
/// </summary>
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[DefaultProperty(nameof(Checked))]
[DefaultEvent(nameof(CheckedChanged))]
[DefaultBindingProperty(nameof(CheckState))]
Expand Down Expand Up @@ -648,7 +646,6 @@ public override string ToString()
return s + ", CheckState: " + checkState.ToString(CultureInfo.InvariantCulture);
}

[ComVisible(true)]
public class CheckBoxAccessibleObject : ButtonBaseAccessibleObject
{
public CheckBoxAccessibleObject(Control owner) : base(owner)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ namespace System.Windows.Forms
///
/// of each item.
/// </summary>
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[LookupBindingProperties]
[SRDescription(nameof(SR.DescriptionCheckedListBox))]
public class CheckedListBox : ListBox
Expand Down Expand Up @@ -1466,7 +1464,6 @@ internal void SetCheckedState(int index, CheckState value)

internal override bool SupportsUiaProviders => false;

[ComVisible(true)]
internal class CheckedListBoxAccessibleObject : ControlAccessibleObject
{
/// <summary>
Expand Down Expand Up @@ -1567,7 +1564,6 @@ public override AccessibleObject Navigate(AccessibleNavigation direction)
}
}

[ComVisible(true)]
internal class CheckedListBoxItemAccessibleObject : AccessibleObject
{
private string name;
Expand Down
9 changes: 0 additions & 9 deletions src/System.Windows.Forms/src/System/Windows/Forms/ComboBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ namespace System.Windows.Forms
/// list or to enter new text. Displays only the editing field until the user
/// explicitly displays the list.
/// </summary>
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[DefaultEvent(nameof(SelectedIndexChanged))]
[DefaultProperty(nameof(Items))]
[DefaultBindingProperty(nameof(Text))]
Expand Down Expand Up @@ -3943,7 +3941,6 @@ protected override void WndProc(ref Message m)
}
}

[ComVisible(true)]
private class ComboBoxChildNativeWindow : NativeWindow
Comment on lines -3946 to 3944
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea why this was ComVisible, probably was a mistake, most functionality which requires ComVisible(true) skips private classes and the functionality that doesn't also works without having the attribute.

{
private readonly ComboBox _owner;
Expand Down Expand Up @@ -4535,7 +4532,6 @@ internal void SetItemInternal(int index, object value)
}
} // end ObjectCollection

[ComVisible(true)]
public class ChildAccessibleObject : AccessibleObject
{
readonly ComboBox owner;
Expand All @@ -4560,7 +4556,6 @@ public override string Name
/// <summary>
/// Represents the ComboBox item accessible object.
/// </summary>
[ComVisible(true)]
internal class ComboBoxItemAccessibleObject : AccessibleObject
{
private readonly ComboBox _owningComboBox;
Expand Down Expand Up @@ -4876,7 +4871,6 @@ public int GetId(object item)
/// This inherits from the base ComboBoxExAccessibleObject and ComboBoxAccessibleObject
/// to have all base functionality.
/// </summary>
[ComVisible(true)]
internal class ComboBoxAccessibleObject : ControlAccessibleObject
{
private const int COMBOBOX_ACC_ITEM_INDEX = 1;
Expand Down Expand Up @@ -5342,7 +5336,6 @@ internal override int[] RuntimeId
/// <summary>
/// Represents the ComboBox's child (inner) list native window control accessible object with UI Automation provider functionality.
/// </summary>
[ComVisible(true)]
internal class ComboBoxChildListUiaProvider : ChildAccessibleObject
{
private const string COMBO_BOX_LIST_AUTOMATION_ID = "1000";
Expand Down Expand Up @@ -5584,7 +5577,6 @@ public override AccessibleStates State
/// <summary>
/// Represents the ComboBox's child text (is used instead of inner Edit when style is DropDownList but not DropDown) accessible object.
/// </summary>
[ComVisible(true)]
internal class ComboBoxChildTextUiaProvider : AccessibleObject
{
private const int COMBOBOX_TEXT_ACC_ITEM_INDEX = 1;
Expand Down Expand Up @@ -5759,7 +5751,6 @@ public override AccessibleStates State
/// <summary>
/// Represents the ComboBox child (inner) DropDown button accessible object with UI Automation functionality.
/// </summary>
[ComVisible(true)]
internal class ComboBoxChildDropDownButtonUiaProvider : AccessibleObject
{
private const int COMBOBOX_DROPDOWN_BUTTON_ACC_ITEM_INDEX = 2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ namespace System.Windows.Forms
/// <summary>
/// Defines a base class for controls that can parent other controls.
/// </summary>
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
public class ContainerControl : ScrollableControl, IContainerControl
{
private Control _activeControl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ namespace System.Windows.Forms
/// <summary>
/// This class is just a conceptual wrapper around ToolStripDropDownMenu.
/// </summary>
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[DefaultEvent(nameof(Opening))]
[SRDescription(nameof(SR.DescriptionContextMenuStrip))]
public class ContextMenuStrip : ToolStripDropDownMenu
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public partial class Control
/// <summary>
/// An implementation of AccessibleChild for use with Controls
/// </summary>
[ComVisible(true)]
public class ControlAccessibleObject : AccessibleObject
{
private static IntPtr s_oleAccAvailable = NativeMethods.InvalidIntPtr;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public partial class Control
/// <summary>
/// Collection of controls...
/// </summary>
[ListBindable(false), ComVisible(false)]
[ListBindable(false)]
public class ControlCollection : ArrangedElementCollection, IList, ICloneable
{
/// A caching mechanism for key accessor
Expand Down
2 changes: 0 additions & 2 deletions src/System.Windows.Forms/src/System/Windows/Forms/Control.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ namespace System.Windows.Forms
/// Do not add instance variables to Control absolutely necessary. Every control on a form has the overhead of
/// all of these variables.
/// </remarks>
[ComVisible(true)]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
[DefaultProperty(nameof(Text))]
[DefaultEvent(nameof(Click))]
[Designer("System.Windows.Forms.Design.ControlDesigner, " + AssemblyRef.SystemDesign)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ namespace System.Windows.Forms
{
public partial class DataGridView
{
[ComVisible(true)]
protected class DataGridViewAccessibleObject : ControlAccessibleObject
{
private int[] runtimeId = null; // Used by UIAutomation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace System.Windows.Forms
{
public partial class DataGridView
{
[ComVisible(false)]
public class DataGridViewControlCollection : ControlCollection
{
readonly DataGridView owner;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ namespace System.Windows.Forms
{
public partial class DataGridView
{
[ComVisible(true)]
protected class DataGridViewTopRowAccessibleObject : AccessibleObject
{
private int[] runtimeId;
Expand Down
Loading