From aad5434faeac9d73654b6c1d28abae06a1789ce6 Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Sat, 24 Sep 2022 19:37:02 +0200 Subject: [PATCH] Clean up of SPC to match ref assembly public surface for Mono and CoreCLR (#75954) * Clean up of SPC to match ref assembly public surface for Mono and CoreCLR Contributes to #72594 * Remove TypeDependencyAttribute Co-authored-by: Jan Kotas --- .../MatchingRefApiCompatBaseline.txt | 34 ++----------------- .../System.Private.CoreLib.csproj | 1 - .../ComActivationContextInternal.cs | 3 +- .../ComActivator.PlatformNotSupported.cs | 2 +- .../Runtime/InteropServices/ComActivator.cs | 2 +- .../ComponentActivator.CoreCLR.cs | 2 +- ...moryAssemblyLoader.PlatformNotSupported.cs | 2 +- .../InteropServices/InMemoryAssemblyLoader.cs | 2 +- .../Generic/ArraySortHelper.CoreCLR.cs | 2 -- .../Collections/Generic/Comparer.CoreCLR.cs | 1 - .../Generic/EqualityComparer.CoreCLR.cs | 1 - .../src/System/Environment.CoreCLR.cs | 2 +- .../System/Reflection/Emit/ModuleBuilder.cs | 2 +- .../src/System/Reflection/RuntimeModule.cs | 2 +- .../TypeDependencyAttribute.cs | 20 ----------- .../src/System/WeakReference.CoreCLR.cs | 7 ---- .../src/MatchingRefApiCompatBaseline.txt | 24 +------------ .../Runtime/Modules/RuntimeModule.cs | 2 +- src/coreclr/vm/classnames.h | 2 -- src/coreclr/vm/methodtablebuilder.cpp | 7 ---- .../src/MatchingRefApiCompatBaseline.txt | 2 -- .../ILLink.Descriptors.LibraryBuild.xml | 22 ++++++++++++ .../InteropServices/ComponentActivator.cs | 2 +- .../src/System/AppContext.cs | 6 ++-- .../Diagnostics/Tracing/EventCounter.cs | 2 +- .../System/Diagnostics/Tracing/EventSource.cs | 6 ++-- .../TraceLogging/TraceLoggingEventTypes.cs | 2 +- .../src/System/IO/DirectoryInfo.cs | 15 ++++++++ .../src/System/IO/FileInfo.cs | 15 ++++++++ .../src/System/IO/FileSystemInfo.cs | 24 ++----------- .../src/System/Reflection/Module.cs | 2 +- .../src/System/Resources/ResourceManager.cs | 2 +- .../src/System/Resources/ResourceSet.cs | 2 +- .../UnmanagedFunctionPointerAttribute.cs | 5 --- .../SerializationInfo.SerializationGuard.cs | 14 ++------ .../Serialization/SerializationInfo.cs | 2 +- .../MatchingRefApiCompatBaseline.txt | 28 ++------------- .../src/System/Environment.Mono.cs | 2 +- .../Reflection/Emit/ModuleBuilder.Mono.cs | 2 +- .../src/System/Reflection/RuntimeModule.cs | 2 +- 40 files changed, 87 insertions(+), 190 deletions(-) delete mode 100644 src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/TypeDependencyAttribute.cs diff --git a/src/coreclr/System.Private.CoreLib/MatchingRefApiCompatBaseline.txt b/src/coreclr/System.Private.CoreLib/MatchingRefApiCompatBaseline.txt index 0a2be8fdccd42..99b72c1b4394a 100644 --- a/src/coreclr/System.Private.CoreLib/MatchingRefApiCompatBaseline.txt +++ b/src/coreclr/System.Private.CoreLib/MatchingRefApiCompatBaseline.txt @@ -1,35 +1,5 @@ Compat issues with assembly System.Private.CoreLib: TypesMustExist : Type 'Internal.Console' does not exist in the reference but it does exist in the implementation. -TypesMustExist : Type 'Internal.Runtime.InteropServices.ComActivationContextInternal' does not exist in the reference but it does exist in the implementation. -TypesMustExist : Type 'Internal.Runtime.InteropServices.ComActivator' does not exist in the reference but it does exist in the implementation. -TypesMustExist : Type 'Internal.Runtime.InteropServices.ComponentActivator' does not exist in the reference but it does exist in the implementation. -TypesMustExist : Type 'Internal.Runtime.InteropServices.InMemoryAssemblyLoader' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.AppContext.add_FirstChanceException(System.EventHandler)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.AppContext.add_ProcessExit(System.EventHandler)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.AppContext.add_UnhandledException(System.UnhandledExceptionEventHandler)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.AppContext.remove_FirstChanceException(System.EventHandler)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.AppContext.remove_ProcessExit(System.EventHandler)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.AppContext.remove_UnhandledException(System.UnhandledExceptionEventHandler)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.Environment.FailFast(System.String, System.Exception, System.String)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'protected void System.WeakReference..ctor()' does not exist in the reference but it does exist in the implementation. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.TypeDependencyAttribute' exists on 'System.Collections.Generic.Comparer' in the implementation but not the reference. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.TypeDependencyAttribute' exists on 'System.Collections.Generic.EqualityComparer' in the implementation but not the reference. -MembersMustExist : Member 'protected void System.Diagnostics.Tracing.EventCounter.Flush()' does not exist in the reference but it does exist in the implementation. -CannotMakeTypeAbstract : Type 'System.Diagnostics.Tracing.EventListener' is abstract in the reference but is not abstract in the implementation. -CannotMakeMoreVisible : Visibility of member 'System.Diagnostics.Tracing.EventListener..ctor()' is 'protected' in the reference but 'public' in the implementation. -CannotMakeMoreVisible : Visibility of member 'System.Diagnostics.Tracing.EventListener.EventSourceIndex(System.Diagnostics.Tracing.EventSource)' is 'protected' in the reference but 'public' in the implementation. -TypesMustExist : Type 'System.Diagnostics.Tracing.TraceLoggingEventTypes' does not exist in the reference but it does exist in the implementation. -CannotMakeMemberAbstract : Member 'public System.Boolean System.IO.FileSystemInfo.Exists' is abstract in the reference but is not abstract in the implementation. -CannotMakeMemberAbstract : Member 'public System.String System.IO.FileSystemInfo.Name' is abstract in the reference but is not abstract in the implementation. -CannotMakeMemberAbstract : Member 'public System.Boolean System.IO.FileSystemInfo.Exists.get()' is abstract in the reference but is not abstract in the implementation. -CannotMakeMemberAbstract : Member 'public System.String System.IO.FileSystemInfo.Name.get()' is abstract in the reference but is not abstract in the implementation. -MembersMustExist : Member 'protected System.ModuleHandle System.Reflection.Module.GetModuleHandleImpl()' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'protected System.ModuleHandle System.Reflection.Emit.ModuleBuilder.GetModuleHandleImpl()' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'protected System.String System.String System.Resources.ResourceManager.BaseNameField' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'protected System.Resources.IResourceReader System.Resources.IResourceReader System.Resources.ResourceSet.Reader' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Runtime.CompilerServices.ICastable' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute..ctor()' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public System.Boolean System.Runtime.Serialization.SerializationInfo.DeserializationInProgress.get()' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.Runtime.Serialization.SerializationInfo.ThrowIfDeserializationInProgress()' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.Runtime.Serialization.SerializationInfo.ThrowIfDeserializationInProgress(System.String, System.Int32)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.Runtime.Serialization.SerializationInfo.UpdateValue(System.String, System.Object, System.Type)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'protected System.Resources.IResourceReader System.Resources.IResourceReader System.Resources.ResourceSet.Reader' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'protected System.String System.String System.Resources.ResourceManager.BaseNameField' does not exist in the reference but it does exist in the implementation. \ No newline at end of file diff --git a/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj index 1b53110951957..76870f0bf9472 100644 --- a/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -209,7 +209,6 @@ - diff --git a/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivationContextInternal.cs b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivationContextInternal.cs index c16a56efc4fdd..fd88d8edad3ce 100644 --- a/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivationContextInternal.cs +++ b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivationContextInternal.cs @@ -8,8 +8,7 @@ namespace Internal.Runtime.InteropServices { [StructLayout(LayoutKind.Sequential)] - [CLSCompliant(false)] - public unsafe struct ComActivationContextInternal + internal unsafe struct ComActivationContextInternal { public Guid ClassId; public Guid InterfaceId; diff --git a/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.PlatformNotSupported.cs b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.PlatformNotSupported.cs index 4492eac6d3ada..e634ebd6d47e5 100644 --- a/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.PlatformNotSupported.cs +++ b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.PlatformNotSupported.cs @@ -8,7 +8,7 @@ namespace Internal.Runtime.InteropServices { - public static class ComActivator + internal static class ComActivator { /// /// Internal entry point for unmanaged COM activation API from native code diff --git a/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs index f33a45061ea6d..476ff22862ec0 100644 --- a/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs +++ b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs @@ -78,7 +78,7 @@ public static unsafe ComActivationContext Create(ref ComActivationContextInterna } [SupportedOSPlatform("windows")] - public static class ComActivator + internal static class ComActivator { // Collection of all ALCs used for COM activation. In the event we want to support // unloadable COM server ALCs, this will need to be changed. diff --git a/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.CoreCLR.cs index 3e89bca82e0f2..961c426b4700f 100644 --- a/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.CoreCLR.cs @@ -6,7 +6,7 @@ namespace Internal.Runtime.InteropServices { - public static partial class ComponentActivator + internal static partial class ComponentActivator { // This hook for when GetFunctionPointer is called when the feature is disabled allows us to // provide error messages for known hosting scenarios such as C++/CLI. diff --git a/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/InMemoryAssemblyLoader.PlatformNotSupported.cs b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/InMemoryAssemblyLoader.PlatformNotSupported.cs index 1a0881cd414fe..042f256f79f3d 100644 --- a/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/InMemoryAssemblyLoader.PlatformNotSupported.cs +++ b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/InMemoryAssemblyLoader.PlatformNotSupported.cs @@ -10,7 +10,7 @@ namespace Internal.Runtime.InteropServices /// /// This class enables the .NET IJW host to load an in-memory module as a .NET assembly /// - public static class InMemoryAssemblyLoader + internal static class InMemoryAssemblyLoader { /// /// Loads into an isolated AssemblyLoadContext an assembly that has already been loaded into memory by the OS loader as a native module. diff --git a/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/InMemoryAssemblyLoader.cs b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/InMemoryAssemblyLoader.cs index 34b6d24d8dfb6..c7c2e98a837bd 100644 --- a/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/InMemoryAssemblyLoader.cs +++ b/src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/InMemoryAssemblyLoader.cs @@ -13,7 +13,7 @@ namespace Internal.Runtime.InteropServices /// This class enables the .NET IJW host to load an in-memory module as a .NET assembly /// [SupportedOSPlatform("windows")] - public static class InMemoryAssemblyLoader + internal static class InMemoryAssemblyLoader { private static bool IsSupported { get; } = InitializeIsSupported(); private static bool InitializeIsSupported() => AppContext.TryGetSwitch("System.Runtime.InteropServices.EnableCppCLIHostActivation", out bool isSupported) ? isSupported : true; diff --git a/src/coreclr/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.CoreCLR.cs index 7fb9c931d0405..9903731a5e0ec 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.CoreCLR.cs @@ -12,7 +12,6 @@ internal interface IArraySortHelper int BinarySearch(TKey[] keys, int index, int length, TKey value, IComparer? comparer); } - [TypeDependency("System.Collections.Generic.GenericArraySortHelper`1")] internal sealed partial class ArraySortHelper : IArraySortHelper { @@ -46,7 +45,6 @@ internal interface IArraySortHelper void Sort(Span keys, Span values, IComparer? comparer); } - [TypeDependency("System.Collections.Generic.GenericArraySortHelper`2")] internal sealed partial class ArraySortHelper : IArraySortHelper { diff --git a/src/coreclr/System.Private.CoreLib/src/System/Collections/Generic/Comparer.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/Collections/Generic/Comparer.CoreCLR.cs index a2790cbd121de..f6d531485b292 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Collections/Generic/Comparer.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Collections/Generic/Comparer.CoreCLR.cs @@ -5,7 +5,6 @@ namespace System.Collections.Generic { - [TypeDependency("System.Collections.Generic.ObjectComparer`1")] public abstract partial class Comparer : IComparer, IComparer { // To minimize generic instantiation overhead of creating the comparer per type, we keep the generic portion of the code as small diff --git a/src/coreclr/System.Private.CoreLib/src/System/Collections/Generic/EqualityComparer.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/Collections/Generic/EqualityComparer.CoreCLR.cs index 03b7ab1011cfe..2377566a05312 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Collections/Generic/EqualityComparer.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Collections/Generic/EqualityComparer.CoreCLR.cs @@ -6,7 +6,6 @@ namespace System.Collections.Generic { - [TypeDependency("System.Collections.Generic.ObjectEqualityComparer`1")] public abstract partial class EqualityComparer : IEqualityComparer, IEqualityComparer { // To minimize generic instantiation overhead of creating the comparer per type, we keep the generic portion of the code as small diff --git a/src/coreclr/System.Private.CoreLib/src/System/Environment.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/Environment.CoreCLR.cs index 1ab95bc582a8a..cd7a1a3560de1 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Environment.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Environment.CoreCLR.cs @@ -59,7 +59,7 @@ public static extern int ExitCode [DoesNotReturn] [MethodImpl(MethodImplOptions.InternalCall)] - public static extern void FailFast(string? message, Exception? exception, string? errorMessage); + internal static extern void FailFast(string? message, Exception? exception, string? errorMessage); private static string[]? s_commandLineArgs; diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs index 927b1aaae13b9..5737bfc484baa 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs @@ -297,7 +297,7 @@ internal int InternalGetConstructorToken(ConstructorInfo con, bool usingRef) internal RuntimeModule InternalModule => _internalModule; - protected override ModuleHandle GetModuleHandleImpl() => new ModuleHandle(InternalModule); + private protected override ModuleHandle GetModuleHandleImpl() => new ModuleHandle(InternalModule); internal static RuntimeModule GetRuntimeModuleFromModule(Module? m) { diff --git a/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs b/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs index 8512a968b6c72..f1d6c6777289a 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs @@ -531,7 +531,7 @@ internal RuntimeAssembly GetRuntimeAssembly() return m_runtimeAssembly; } - protected override ModuleHandle GetModuleHandleImpl() + private protected override ModuleHandle GetModuleHandleImpl() { return new ModuleHandle(this); } diff --git a/src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/TypeDependencyAttribute.cs b/src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/TypeDependencyAttribute.cs deleted file mode 100644 index 50d292e10dfcd..0000000000000 --- a/src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/TypeDependencyAttribute.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -namespace System.Runtime.CompilerServices -{ - // We might want to make this inherited someday. But I suspect it shouldn't - // be necessary. - [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true, Inherited = false)] - internal sealed class TypeDependencyAttribute : Attribute - { - private readonly string typeName; - - public TypeDependencyAttribute(string typeName) - { - ArgumentNullException.ThrowIfNull(typeName); - - this.typeName = typeName; - } - } -} diff --git a/src/coreclr/System.Private.CoreLib/src/System/WeakReference.CoreCLR.cs b/src/coreclr/System.Private.CoreLib/src/System/WeakReference.CoreCLR.cs index 3624f28aace55..0deef24348dd5 100644 --- a/src/coreclr/System.Private.CoreLib/src/System/WeakReference.CoreCLR.cs +++ b/src/coreclr/System.Private.CoreLib/src/System/WeakReference.CoreCLR.cs @@ -14,13 +14,6 @@ public partial class WeakReference : ISerializable // This field is not a regular GC handle. It can have a special values that are used to prevent a race condition between setting the target and finalization. internal IntPtr m_handle; - // Migrating InheritanceDemands requires this default ctor, so we can mark it SafeCritical - protected WeakReference() - { - Debug.Fail("WeakReference's protected default ctor should never be used!"); - throw new NotImplementedException(); - } - // Determines whether or not this instance of WeakReference still refers to an object // that has not been collected. // diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/MatchingRefApiCompatBaseline.txt b/src/coreclr/nativeaot/System.Private.CoreLib/src/MatchingRefApiCompatBaseline.txt index 5a44b79d56903..a00ad23f61fb2 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/MatchingRefApiCompatBaseline.txt +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/MatchingRefApiCompatBaseline.txt @@ -195,15 +195,8 @@ TypesMustExist : Type 'Internal.Runtime.CompilerServices.OpenMethodResolver' doe TypesMustExist : Type 'Internal.Runtime.CompilerServices.RuntimeFieldHandleInfo' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'Internal.Runtime.CompilerServices.RuntimeMethodHandleInfo' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'Internal.Runtime.CompilerServices.RuntimeSignature' does not exist in the reference but it does exist in the implementation. -TypesMustExist : Type 'Internal.Runtime.InteropServices.ComponentActivator' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'Internal.TypeSystem.ExceptionStringID' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'Internal.TypeSystem.LockFreeReaderHashtable' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.AppContext.add_FirstChanceException(System.EventHandler)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.AppContext.add_ProcessExit(System.EventHandler)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.AppContext.add_UnhandledException(System.UnhandledExceptionEventHandler)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.AppContext.remove_FirstChanceException(System.EventHandler)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.AppContext.remove_ProcessExit(System.EventHandler)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.AppContext.remove_UnhandledException(System.UnhandledExceptionEventHandler)' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Array' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.MDArray' does not exist in the reference but it does exist in the implementation. MembersMustExist : Member 'public void System.ModuleHandle..ctor(System.Reflection.Module)' does not exist in the reference but it does exist in the implementation. @@ -212,23 +205,13 @@ TypesMustExist : Type 'System.RuntimeType' does not exist in the reference but i MembersMustExist : Member 'public System.Boolean System.TypedReference.IsNull.get()' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Diagnostics.DebugAnnotations' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Diagnostics.DebuggerGuidedStepThroughAttribute' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'protected void System.Diagnostics.Tracing.EventCounter.Flush()' does not exist in the reference but it does exist in the implementation. -CannotMakeTypeAbstract : Type 'System.Diagnostics.Tracing.EventListener' is abstract in the reference but is not abstract in the implementation. -CannotMakeMoreVisible : Visibility of member 'System.Diagnostics.Tracing.EventListener..ctor()' is 'protected' in the reference but 'public' in the implementation. -CannotMakeMoreVisible : Visibility of member 'System.Diagnostics.Tracing.EventListener.EventSourceIndex(System.Diagnostics.Tracing.EventSource)' is 'protected' in the reference but 'public' in the implementation. TypesMustExist : Type 'System.Diagnostics.Tracing.PropertyValue' does not exist in the reference but it does exist in the implementation. -TypesMustExist : Type 'System.Diagnostics.Tracing.TraceLoggingEventTypes' does not exist in the reference but it does exist in the implementation. -CannotMakeMemberAbstract : Member 'public System.Boolean System.IO.FileSystemInfo.Exists' is abstract in the reference but is not abstract in the implementation. -CannotMakeMemberAbstract : Member 'public System.String System.IO.FileSystemInfo.Name' is abstract in the reference but is not abstract in the implementation. -CannotMakeMemberAbstract : Member 'public System.Boolean System.IO.FileSystemInfo.Exists.get()' is abstract in the reference but is not abstract in the implementation. -CannotMakeMemberAbstract : Member 'public System.String System.IO.FileSystemInfo.Name.get()' is abstract in the reference but is not abstract in the implementation. TypesMustExist : Type 'System.Reflection.AssemblyRuntimeNameHelpers' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Reflection.BinderBundle' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Reflection.DynamicInvokeInfo' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Reflection.EnumInfo' does not exist in the reference but it does exist in the implementation. MembersMustExist : Member 'public System.Reflection.ParameterInfo[] System.Reflection.MethodBase.GetParametersNoCopy()' does not exist in the reference but it does exist in the implementation. MembersMustExist : Member 'public System.Reflection.MethodBase System.Reflection.MethodBase.MetadataDefinitionMethod.get()' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'protected System.ModuleHandle System.Reflection.Module.GetModuleHandleImpl()' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Reflection.RuntimeAssembly' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Reflection.RuntimeAssemblyName' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Reflection.Runtime.General.MetadataReaderExtensions' does not exist in the reference but it does exist in the implementation. @@ -239,8 +222,8 @@ TypesMustExist : Type 'System.Reflection.Runtime.General.QMethodDefinition' does TypesMustExist : Type 'System.Reflection.Runtime.General.QSignatureTypeHandle' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Reflection.Runtime.General.QTypeDefinition' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Reflection.Runtime.General.QTypeDefRefOrSpec' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'protected System.String System.String System.Resources.ResourceManager.BaseNameField' does not exist in the reference but it does exist in the implementation. MembersMustExist : Member 'protected System.Resources.IResourceReader System.Resources.IResourceReader System.Resources.ResourceSet.Reader' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'protected System.String System.String System.Resources.ResourceManager.BaseNameField' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Resources.RuntimeResourceSet' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Runtime.ExceptionIDs' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Runtime.RhFailFastReason' does not exist in the reference but it does exist in the implementation. @@ -257,12 +240,7 @@ TypesMustExist : Type 'System.Runtime.CompilerServices.StaticClassConstructionCo TypesMustExist : Type 'System.Runtime.InteropServices.InteropExtensions' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Runtime.InteropServices.NativeFunctionPointerWrapper' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Runtime.InteropServices.PInvokeMarshal' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute..ctor()' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Runtime.InteropServices.UnsafeGCHandle' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public System.Boolean System.Runtime.Serialization.SerializationInfo.DeserializationInProgress.get()' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.Runtime.Serialization.SerializationInfo.ThrowIfDeserializationInProgress()' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.Runtime.Serialization.SerializationInfo.ThrowIfDeserializationInProgress(System.String, System.Int32)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.Runtime.Serialization.SerializationInfo.UpdateValue(System.String, System.Object, System.Type)' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Threading.Condition' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Threading.Lock' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Threading.LockHolder' does not exist in the reference but it does exist in the implementation. \ No newline at end of file diff --git a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/Modules/RuntimeModule.cs b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/Modules/RuntimeModule.cs index c98f84cb4f6d3..832628114097b 100644 --- a/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/Modules/RuntimeModule.cs +++ b/src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/Modules/RuntimeModule.cs @@ -93,6 +93,6 @@ public sealed override Type[] GetTypes() [RequiresUnreferencedCode("Trimming changes metadata tokens")] public sealed override Type ResolveType(int metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) { throw new PlatformNotSupportedException(); } - protected sealed override ModuleHandle GetModuleHandleImpl() => new ModuleHandle(this); + private protected sealed override ModuleHandle GetModuleHandleImpl() => new ModuleHandle(this); } } diff --git a/src/coreclr/vm/classnames.h b/src/coreclr/vm/classnames.h index 9a4d4e35845af..00a192fd36f39 100644 --- a/src/coreclr/vm/classnames.h +++ b/src/coreclr/vm/classnames.h @@ -112,8 +112,6 @@ #define g_UnmanagedCallersOnlyAttribute "System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute" #define g_FixedBufferAttribute "System.Runtime.CompilerServices.FixedBufferAttribute" -#define g_CompilerServicesTypeDependencyAttribute "System.Runtime.CompilerServices.TypeDependencyAttribute" - #define g_ReferenceAssemblyAttribute "System.Runtime.CompilerServices.ReferenceAssemblyAttribute" #define g_CriticalFinalizerObjectName "CriticalFinalizerObject" diff --git a/src/coreclr/vm/methodtablebuilder.cpp b/src/coreclr/vm/methodtablebuilder.cpp index b0c0c1ce749d3..19d1164dc94a3 100644 --- a/src/coreclr/vm/methodtablebuilder.cpp +++ b/src/coreclr/vm/methodtablebuilder.cpp @@ -575,13 +575,6 @@ MethodTableBuilder::LoadApproxInterfaceMap() // Use the same injection status as typical instantiation bmtInterface->dbg_fShouldInjectInterfaceDuplicates = bmtGenerics->Debug_GetTypicalMethodTable()->Debug_HasInjectedInterfaceDuplicates(); - - if (GetModule() == g_pObjectClass->GetModule()) - { // CoreLib has some weird hardcoded information about interfaces (e.g. - // code:CEEPreloader::ApplyTypeDependencyForSZArrayHelper), so we don't inject duplicates into - // CoreLib types - bmtInterface->dbg_fShouldInjectInterfaceDuplicates = FALSE; - } } #endif //_DEBUG diff --git a/src/libraries/System.Collections/src/MatchingRefApiCompatBaseline.txt b/src/libraries/System.Collections/src/MatchingRefApiCompatBaseline.txt index a8dcfef40cbf8..ab97ed0345af5 100644 --- a/src/libraries/System.Collections/src/MatchingRefApiCompatBaseline.txt +++ b/src/libraries/System.Collections/src/MatchingRefApiCompatBaseline.txt @@ -1,6 +1,4 @@ Compat issues with assembly System.Collections: -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.TypeDependencyAttribute' exists on 'System.Collections.Generic.Comparer' in the implementation but not the reference. -CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.TypeDependencyAttribute' exists on 'System.Collections.Generic.EqualityComparer' in the implementation but not the reference. TypesMustExist : Type 'System.Collections.Generic.SortedDictionary.KeyValuePairComparer' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Collections.Generic.SortedList.KeyList' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Collections.Generic.SortedList.ValueList' does not exist in the reference but it does exist in the implementation. diff --git a/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.LibraryBuild.xml b/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.LibraryBuild.xml index ee28b6e38cfe6..d7380437c86f8 100644 --- a/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.LibraryBuild.xml +++ b/src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.LibraryBuild.xml @@ -8,5 +8,27 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/libraries/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.cs b/src/libraries/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.cs index 50f7a5eff1305..12961f17bdb63 100644 --- a/src/libraries/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.cs +++ b/src/libraries/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.cs @@ -11,7 +11,7 @@ namespace Internal.Runtime.InteropServices { - public static partial class ComponentActivator + internal static partial class ComponentActivator { private const string TrimIncompatibleWarningMessage = "Native hosting is not trim compatible and this warning will be seen if trimming is enabled."; private const string NativeAOTIncompatibleWarningMessage = "The native code for the method requested might not be available at runtime."; diff --git a/src/libraries/System.Private.CoreLib/src/System/AppContext.cs b/src/libraries/System.Private.CoreLib/src/System/AppContext.cs index d851869aae28a..534922c8c24f3 100644 --- a/src/libraries/System.Private.CoreLib/src/System/AppContext.cs +++ b/src/libraries/System.Private.CoreLib/src/System/AppContext.cs @@ -68,13 +68,13 @@ public static void SetData(string name, object? data) #pragma warning disable CS0067 // events raised by the VM [field: DynamicDependency(DynamicallyAccessedMemberTypes.PublicConstructors, typeof(UnhandledExceptionEventArgs))] - public static event UnhandledExceptionEventHandler? UnhandledException; + internal static event UnhandledExceptionEventHandler? UnhandledException; [field: DynamicDependency(DynamicallyAccessedMemberTypes.PublicConstructors, typeof(FirstChanceExceptionEventArgs))] - public static event EventHandler? FirstChanceException; + internal static event EventHandler? FirstChanceException; #pragma warning restore CS0067 - public static event EventHandler? ProcessExit; + internal static event EventHandler? ProcessExit; internal static void OnProcessExit() { diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventCounter.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventCounter.cs index 2838cfc946885..a2fa85a262be4 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventCounter.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventCounter.cs @@ -171,7 +171,7 @@ private void Enqueue(double value) } } - protected void Flush() + private void Flush() { Debug.Assert(Monitor.IsEntered(this)); for (int i = 0; i < _bufferedValues.Length; i++) diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs index fbb6e56b361b9..e716950341476 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs @@ -3923,7 +3923,7 @@ public enum EventSourceSettings /// created. /// /// - public class EventListener : IDisposable + public abstract class EventListener : IDisposable { private event EventHandler? _EventSourceCreated; @@ -3963,7 +3963,7 @@ public event EventHandler? EventSourceCreated /// Create a new EventListener in which all events start off turned off (use EnableEvents to turn /// them on). /// - public EventListener() + protected EventListener() { // This will cause the OnEventSourceCreated callback to fire. CallBackForExistingEventSources(true, (obj, args) => @@ -4100,7 +4100,7 @@ public void DisableEvents(EventSource eventSource) /// and EventSourceIndex allows this extra information to be efficiently stored in a /// (growable) array (eg List(T)). /// - public static int EventSourceIndex(EventSource eventSource) { return eventSource.m_id; } + protected internal static int EventSourceIndex(EventSource eventSource) { return eventSource.m_id; } /// /// This method is called whenever a new eventSource is 'attached' to the dispatcher. diff --git a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/TraceLoggingEventTypes.cs b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/TraceLoggingEventTypes.cs index 9c1857fdef926..7494a74b76779 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/TraceLoggingEventTypes.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/TraceLoggingEventTypes.cs @@ -9,7 +9,7 @@ namespace System.Diagnostics.Tracing /// TraceLogging: Used when calling EventSource.WriteMultiMerge. /// Stores the type information to use when writing the event fields. /// - public class TraceLoggingEventTypes + internal sealed class TraceLoggingEventTypes { internal readonly TraceLoggingTypeInfo[] typeInfos; #if FEATURE_PERFTRACING diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/DirectoryInfo.cs b/src/libraries/System.Private.CoreLib/src/System/IO/DirectoryInfo.cs index 51395058018b9..c3ac9efeb92c8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/DirectoryInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/DirectoryInfo.cs @@ -227,5 +227,20 @@ public void Delete(bool recursive) FileSystem.RemoveDirectory(FullPath, recursive); Invalidate(); } + + public override bool Exists + { + get + { + try + { + return ExistsCore; + } + catch + { + return false; + } + } + } } } diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/FileInfo.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileInfo.cs index a1f7df8bbc6b4..fb455e0e64652 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/FileInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/FileInfo.cs @@ -113,6 +113,21 @@ public override void Delete() Invalidate(); } + public override bool Exists + { + get + { + try + { + return ExistsCore; + } + catch + { + return false; + } + } + } + public FileStream Open(FileMode mode) => Open(mode, (mode == FileMode.Append ? FileAccess.Write : FileAccess.ReadWrite), FileShare.None); diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/FileSystemInfo.cs b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystemInfo.cs index 5c64fc4fcdc8c..da70b06ed5039 100644 --- a/src/libraries/System.Private.CoreLib/src/System/IO/FileSystemInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/IO/FileSystemInfo.cs @@ -56,30 +56,10 @@ public string Extension } } - public virtual string Name - { - get - { - Debug.Fail("Property is abstract in the ref assembly and both Directory/FileInfo override it."); - return _name!; - } - } + public abstract string Name { get; } // Whether a file/directory exists - public virtual bool Exists - { - get - { - try - { - return ExistsCore; - } - catch - { - return false; - } - } - } + public abstract bool Exists { get; } // Delete a file/directory public abstract void Delete(); diff --git a/src/libraries/System.Private.CoreLib/src/System/Reflection/Module.cs b/src/libraries/System.Private.CoreLib/src/System/Reflection/Module.cs index 9efb2ac1803f0..30f47a9e21a8d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Reflection/Module.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Reflection/Module.cs @@ -24,7 +24,7 @@ protected Module() { } public virtual Guid ModuleVersionId => throw NotImplemented.ByDesign; public virtual string ScopeName => throw NotImplemented.ByDesign; public ModuleHandle ModuleHandle => GetModuleHandleImpl(); - protected virtual ModuleHandle GetModuleHandleImpl() => ModuleHandle.EmptyHandle; // Not an api but declared protected because of Reflection.Core/Corelib divide (when built by NativeAOT) + private protected virtual ModuleHandle GetModuleHandleImpl() => ModuleHandle.EmptyHandle; public virtual void GetPEKind(out PortableExecutableKinds peKind, out ImageFileMachine machine) { throw NotImplemented.ByDesign; } public virtual bool IsResource() { throw NotImplemented.ByDesign; } diff --git a/src/libraries/System.Private.CoreLib/src/System/Resources/ResourceManager.cs b/src/libraries/System.Private.CoreLib/src/System/Resources/ResourceManager.cs index 0693779839403..20f07154bdec5 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Resources/ResourceManager.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Resources/ResourceManager.cs @@ -98,7 +98,7 @@ internal sealed class CultureNameResourceSetPair public ResourceSet? lastResourceSet; } - protected string BaseNameField; + protected string BaseNameField; // The field is protected for .NET Framework compatibility protected Assembly? MainAssembly; // Need the assembly manifest sometimes. private Dictionary? _resourceSets; diff --git a/src/libraries/System.Private.CoreLib/src/System/Resources/ResourceSet.cs b/src/libraries/System.Private.CoreLib/src/System/Resources/ResourceSet.cs index 981a390ef9489..65689f7ab1ef4 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Resources/ResourceSet.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Resources/ResourceSet.cs @@ -18,7 +18,7 @@ namespace System.Resources // public class ResourceSet : IDisposable, IEnumerable { - protected IResourceReader Reader = null!; + protected IResourceReader? Reader; // The field is protected for .NET Framework compatibility private Dictionary? _table; private Dictionary? _caseInsensitiveTable; // For case-insensitive lookups. diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/UnmanagedFunctionPointerAttribute.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/UnmanagedFunctionPointerAttribute.cs index 998ce790402db..f99e73460af57 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/UnmanagedFunctionPointerAttribute.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/UnmanagedFunctionPointerAttribute.cs @@ -6,11 +6,6 @@ namespace System.Runtime.InteropServices [AttributeUsage(AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] public sealed class UnmanagedFunctionPointerAttribute : Attribute { - public UnmanagedFunctionPointerAttribute() - { - CallingConvention = CallingConvention.Winapi; - } - public UnmanagedFunctionPointerAttribute(CallingConvention callingConvention) { CallingConvention = callingConvention; diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Serialization/SerializationInfo.SerializationGuard.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Serialization/SerializationInfo.SerializationGuard.cs index 6cc4c808a5ecf..bef1d6b0240e5 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Serialization/SerializationInfo.SerializationGuard.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Serialization/SerializationInfo.SerializationGuard.cs @@ -19,7 +19,7 @@ private static DeserializationTracker GetThreadDeserializationTracker() => t_deserializationTracker ??= new DeserializationTracker(); // Returns true if deserialization is currently in progress - public static bool DeserializationInProgress + internal static bool DeserializationInProgress { get { @@ -34,23 +34,13 @@ public static bool DeserializationInProgress } } - // Throws a SerializationException if dangerous deserialization is currently - // in progress - public static void ThrowIfDeserializationInProgress() - { - if (DeserializationInProgress) - { - throw new SerializationException(SR.Serialization_DangerousDeserialization); - } - } - // Throws a DeserializationBlockedException if dangerous deserialization is currently // in progress and the AppContext switch Switch.System.Runtime.Serialization.SerializationGuard.{switchSuffix} // is not true. The value of the switch is cached in cachedValue to avoid repeated lookups: // 0: No value cached // 1: The switch is true // -1: The switch is false - public static void ThrowIfDeserializationInProgress(string switchSuffix, ref int cachedValue) + internal static void ThrowIfDeserializationInProgress(string switchSuffix, ref int cachedValue) { const string SwitchPrefix = "Switch.System.Runtime.Serialization.SerializationGuard."; Debug.Assert(!string.IsNullOrWhiteSpace(switchSuffix)); diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Serialization/SerializationInfo.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Serialization/SerializationInfo.cs index 7d9a728f351cc..a0699e47cbb28 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Serialization/SerializationInfo.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Serialization/SerializationInfo.cs @@ -258,7 +258,7 @@ internal void AddValueInternal(string name, object? value, Type type) /// The name of the data to be updated. /// The new value. /// The type of the data being added. - public void UpdateValue(string name, object value, Type type) + internal void UpdateValue(string name, object value, Type type) { Debug.Assert(null != name, "[SerializationInfo.UpdateValue]name!=null"); Debug.Assert(null != value, "[SerializationInfo.UpdateValue]value!=null"); diff --git a/src/mono/System.Private.CoreLib/MatchingRefApiCompatBaseline.txt b/src/mono/System.Private.CoreLib/MatchingRefApiCompatBaseline.txt index baf962e85e9b6..99b72c1b4394a 100644 --- a/src/mono/System.Private.CoreLib/MatchingRefApiCompatBaseline.txt +++ b/src/mono/System.Private.CoreLib/MatchingRefApiCompatBaseline.txt @@ -1,29 +1,5 @@ Compat issues with assembly System.Private.CoreLib: TypesMustExist : Type 'Internal.Console' does not exist in the reference but it does exist in the implementation. -TypesMustExist : Type 'Internal.Runtime.InteropServices.ComponentActivator' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.AppContext.add_FirstChanceException(System.EventHandler)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.AppContext.add_ProcessExit(System.EventHandler)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.AppContext.add_UnhandledException(System.UnhandledExceptionEventHandler)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.AppContext.remove_FirstChanceException(System.EventHandler)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.AppContext.remove_ProcessExit(System.EventHandler)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.AppContext.remove_UnhandledException(System.UnhandledExceptionEventHandler)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.Environment.FailFast(System.String, System.Exception, System.String)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'protected void System.Diagnostics.Tracing.EventCounter.Flush()' does not exist in the reference but it does exist in the implementation. -CannotMakeTypeAbstract : Type 'System.Diagnostics.Tracing.EventListener' is abstract in the reference but is not abstract in the implementation. -CannotMakeMoreVisible : Visibility of member 'System.Diagnostics.Tracing.EventListener..ctor()' is 'protected' in the reference but 'public' in the implementation. -CannotMakeMoreVisible : Visibility of member 'System.Diagnostics.Tracing.EventListener.EventSourceIndex(System.Diagnostics.Tracing.EventSource)' is 'protected' in the reference but 'public' in the implementation. -TypesMustExist : Type 'System.Diagnostics.Tracing.TraceLoggingEventTypes' does not exist in the reference but it does exist in the implementation. -CannotMakeMemberAbstract : Member 'public System.Boolean System.IO.FileSystemInfo.Exists' is abstract in the reference but is not abstract in the implementation. -CannotMakeMemberAbstract : Member 'public System.String System.IO.FileSystemInfo.Name' is abstract in the reference but is not abstract in the implementation. -CannotMakeMemberAbstract : Member 'public System.Boolean System.IO.FileSystemInfo.Exists.get()' is abstract in the reference but is not abstract in the implementation. -CannotMakeMemberAbstract : Member 'public System.String System.IO.FileSystemInfo.Name.get()' is abstract in the reference but is not abstract in the implementation. -MembersMustExist : Member 'protected System.ModuleHandle System.Reflection.Module.GetModuleHandleImpl()' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'protected System.ModuleHandle System.Reflection.Emit.ModuleBuilder.GetModuleHandleImpl()' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'protected System.String System.String System.Resources.ResourceManager.BaseNameField' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'protected System.Resources.IResourceReader System.Resources.IResourceReader System.Resources.ResourceSet.Reader' does not exist in the reference but it does exist in the implementation. TypesMustExist : Type 'System.Runtime.CompilerServices.ICastable' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute..ctor()' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public System.Boolean System.Runtime.Serialization.SerializationInfo.DeserializationInProgress.get()' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.Runtime.Serialization.SerializationInfo.ThrowIfDeserializationInProgress()' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.Runtime.Serialization.SerializationInfo.ThrowIfDeserializationInProgress(System.String, System.Int32)' does not exist in the reference but it does exist in the implementation. -MembersMustExist : Member 'public void System.Runtime.Serialization.SerializationInfo.UpdateValue(System.String, System.Object, System.Type)' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'protected System.Resources.IResourceReader System.Resources.IResourceReader System.Resources.ResourceSet.Reader' does not exist in the reference but it does exist in the implementation. +MembersMustExist : Member 'protected System.String System.String System.Resources.ResourceManager.BaseNameField' does not exist in the reference but it does exist in the implementation. \ No newline at end of file diff --git a/src/mono/System.Private.CoreLib/src/System/Environment.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Environment.Mono.cs index 43350fe683f2b..e7303f9129fb4 100644 --- a/src/mono/System.Private.CoreLib/src/System/Environment.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Environment.Mono.cs @@ -57,6 +57,6 @@ public static void FailFast(string? message, Exception? exception) [MethodImplAttribute(MethodImplOptions.InternalCall)] [DoesNotReturn] - public static extern void FailFast(string? message, Exception? exception, string? errorSource); + internal static extern void FailFast(string? message, Exception? exception, string? errorSource); } } diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs index 0389ca0b85358..67b975b658a57 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs @@ -788,7 +788,7 @@ public override bool IsResource() internal IntPtr GetUnderlyingNativeHandle() { return _impl; } - protected override ModuleHandle GetModuleHandleImpl() => new ModuleHandle(_impl); + private protected override ModuleHandle GetModuleHandleImpl() => new ModuleHandle(_impl); [RequiresUnreferencedCode("Methods might be removed")] protected override MethodInfo? GetMethodImpl(string name, BindingFlags bindingAttr, Binder? binder, CallingConventions callConvention, Type[]? types, ParameterModifier[]? modifiers) diff --git a/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs b/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs index 19aa452fe5f65..a4ee059ee1616 100644 --- a/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs +++ b/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs @@ -394,7 +394,7 @@ internal static Exception resolve_token_exception(string name, int metadataToken internal IntPtr GetUnderlyingNativeHandle() { return _impl; } - protected override ModuleHandle GetModuleHandleImpl() => new ModuleHandle(_impl); + private protected override ModuleHandle GetModuleHandleImpl() => new ModuleHandle(_impl); // This calls ves_icall_reflection_get_token, so needs a Module argument [MethodImplAttribute(MethodImplOptions.InternalCall)]