Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
Change System.Object to ClassInterface.None
Browse files Browse the repository at this point in the history
Prevents .NET Framework legacy interfaces from leaking out.

Fixes https://github.com/dotnet/corefx/issues/33638
  • Loading branch information
jkotas committed Nov 21, 2018
1 parent 0197d4e commit d2749f1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
20 changes: 8 additions & 12 deletions src/System.Private.CoreLib/src/System/Delegate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,16 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;

namespace System
{
using System;
using System.Reflection;
using System.Runtime;
using System.Threading;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Diagnostics;

[ClassInterface(ClassInterfaceType.AutoDual)]
[System.Runtime.InteropServices.ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[ComVisible(true)]
public abstract class Delegate : ICloneable, ISerializable
{
// _target is the object we will invoke on
Expand Down
6 changes: 3 additions & 3 deletions src/System.Private.CoreLib/src/System/MulticastDelegate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Reflection;
using System.Runtime.Serialization;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.Serialization;

using Internal.Runtime.CompilerServices;

namespace System
Expand Down
8 changes: 4 additions & 4 deletions src/System.Private.CoreLib/src/System/Object.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ namespace System
//
//This class contains no data and does not need to be serializable
[Serializable]
[ClassInterface(ClassInterfaceType.AutoDual)]
[System.Runtime.InteropServices.ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[ComVisible(true)]
[System.Runtime.CompilerServices.TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")]
public class Object
{
Expand Down Expand Up @@ -200,8 +200,8 @@ private FieldInfo GetFieldInfo(string typeName, string fieldName)
// The name "__Canon" will never been seen by users but it will appear a lot in debugger stack traces
// involving generics so it is kept deliberately short as to avoid being a nuisance.

[ClassInterface(ClassInterfaceType.AutoDual)]
[System.Runtime.InteropServices.ComVisible(true)]
[ClassInterface(ClassInterfaceType.None)]
[ComVisible(true)]
internal class __Canon
{
}
Expand Down

0 comments on commit d2749f1

Please sign in to comment.