Clean up of SPC to match ref assembly public surface for Mono and CoreCLR (#75954)
authorMarek Safar <marek.safar@gmail.com>
Sat, 24 Sep 2022 17:37:02 +0000 (19:37 +0200)
committerGitHub <noreply@github.com>
Sat, 24 Sep 2022 17:37:02 +0000 (10:37 -0700)
* Clean up of SPC to match ref assembly public surface for Mono and CoreCLR

Contributes to #72594

* Remove TypeDependencyAttribute

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
40 files changed:
src/coreclr/System.Private.CoreLib/MatchingRefApiCompatBaseline.txt
src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj
src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivationContextInternal.cs
src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.PlatformNotSupported.cs
src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComActivator.cs
src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.CoreCLR.cs
src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/InMemoryAssemblyLoader.PlatformNotSupported.cs
src/coreclr/System.Private.CoreLib/src/Internal/Runtime/InteropServices/InMemoryAssemblyLoader.cs
src/coreclr/System.Private.CoreLib/src/System/Collections/Generic/ArraySortHelper.CoreCLR.cs
src/coreclr/System.Private.CoreLib/src/System/Collections/Generic/Comparer.CoreCLR.cs
src/coreclr/System.Private.CoreLib/src/System/Collections/Generic/EqualityComparer.CoreCLR.cs
src/coreclr/System.Private.CoreLib/src/System/Environment.CoreCLR.cs
src/coreclr/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.cs
src/coreclr/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs
src/coreclr/System.Private.CoreLib/src/System/Runtime/CompilerServices/TypeDependencyAttribute.cs [deleted file]
src/coreclr/System.Private.CoreLib/src/System/WeakReference.CoreCLR.cs
src/coreclr/nativeaot/System.Private.CoreLib/src/MatchingRefApiCompatBaseline.txt
src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Runtime/Modules/RuntimeModule.cs
src/coreclr/vm/classnames.h
src/coreclr/vm/methodtablebuilder.cpp
src/libraries/System.Collections/src/MatchingRefApiCompatBaseline.txt
src/libraries/System.Private.CoreLib/src/ILLink/ILLink.Descriptors.LibraryBuild.xml
src/libraries/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.cs
src/libraries/System.Private.CoreLib/src/System/AppContext.cs
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventCounter.cs
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/EventSource.cs
src/libraries/System.Private.CoreLib/src/System/Diagnostics/Tracing/TraceLogging/TraceLoggingEventTypes.cs
src/libraries/System.Private.CoreLib/src/System/IO/DirectoryInfo.cs
src/libraries/System.Private.CoreLib/src/System/IO/FileInfo.cs
src/libraries/System.Private.CoreLib/src/System/IO/FileSystemInfo.cs
src/libraries/System.Private.CoreLib/src/System/Reflection/Module.cs
src/libraries/System.Private.CoreLib/src/System/Resources/ResourceManager.cs
src/libraries/System.Private.CoreLib/src/System/Resources/ResourceSet.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/UnmanagedFunctionPointerAttribute.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/Serialization/SerializationInfo.SerializationGuard.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/Serialization/SerializationInfo.cs
src/mono/System.Private.CoreLib/MatchingRefApiCompatBaseline.txt
src/mono/System.Private.CoreLib/src/System/Environment.Mono.cs
src/mono/System.Private.CoreLib/src/System/Reflection/Emit/ModuleBuilder.Mono.cs
src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeModule.cs

index 0a2be8f..99b72c1 100644 (file)
@@ -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<System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs>)' 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<System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs>)' 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<T>' in the implementation but not the reference.
-CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.TypeDependencyAttribute' exists on 'System.Collections.Generic.EqualityComparer<T>' 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
index 1b53110..76870f0 100644 (file)
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\ICastableHelpers.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\RuntimeFeature.CoreCLR.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\RuntimeHelpers.CoreCLR.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\TypeDependencyAttribute.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\ControlledExecution.CoreCLR.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\DependentHandle.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\GCSettings.CoreCLR.cs" />
index c16a56e..fd88d8e 100644 (file)
@@ -8,8 +8,7 @@ using System.Runtime.InteropServices;
 namespace Internal.Runtime.InteropServices
 {
     [StructLayout(LayoutKind.Sequential)]
-    [CLSCompliant(false)]
-    public unsafe struct ComActivationContextInternal
+    internal unsafe struct ComActivationContextInternal
     {
         public Guid ClassId;
         public Guid InterfaceId;
index 4492eac..e634ebd 100644 (file)
@@ -8,7 +8,7 @@ using System.Runtime.InteropServices;
 
 namespace Internal.Runtime.InteropServices
 {
-    public static class ComActivator
+    internal static class ComActivator
     {
         /// <summary>
         /// Internal entry point for unmanaged COM activation API from native code
index f33a450..476ff22 100644 (file)
@@ -78,7 +78,7 @@ namespace Internal.Runtime.InteropServices
     }
 
     [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.
index 3e89bca..961c426 100644 (file)
@@ -6,7 +6,7 @@ using System.Runtime.InteropServices;
 
 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.
index 1a0881c..042f256 100644 (file)
@@ -10,7 +10,7 @@ namespace Internal.Runtime.InteropServices
     /// <summary>
     /// This class enables the .NET IJW host to load an in-memory module as a .NET assembly
     /// </summary>
-    public static class InMemoryAssemblyLoader
+    internal static class InMemoryAssemblyLoader
     {
         /// <summary>
         /// Loads into an isolated AssemblyLoadContext an assembly that has already been loaded into memory by the OS loader as a native module.
index 34b6d24..c7c2e98 100644 (file)
@@ -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
     /// </summary>
     [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;
index 7fb9c93..9903731 100644 (file)
@@ -12,7 +12,6 @@ namespace System.Collections.Generic
         int BinarySearch(TKey[] keys, int index, int length, TKey value, IComparer<TKey>? comparer);
     }
 
-    [TypeDependency("System.Collections.Generic.GenericArraySortHelper`1")]
     internal sealed partial class ArraySortHelper<T>
         : IArraySortHelper<T>
     {
@@ -46,7 +45,6 @@ namespace System.Collections.Generic
         void Sort(Span<TKey> keys, Span<TValue> values, IComparer<TKey>? comparer);
     }
 
-    [TypeDependency("System.Collections.Generic.GenericArraySortHelper`2")]
     internal sealed partial class ArraySortHelper<TKey, TValue>
         : IArraySortHelper<TKey, TValue>
     {
index a2790cb..f6d5314 100644 (file)
@@ -5,7 +5,6 @@ using System.Runtime.CompilerServices;
 
 namespace System.Collections.Generic
 {
-    [TypeDependency("System.Collections.Generic.ObjectComparer`1")]
     public abstract partial class Comparer<T> : IComparer, IComparer<T>
     {
         // To minimize generic instantiation overhead of creating the comparer per type, we keep the generic portion of the code as small
index 03b7ab1..2377566 100644 (file)
@@ -6,7 +6,6 @@ using System.Diagnostics;
 
 namespace System.Collections.Generic
 {
-    [TypeDependency("System.Collections.Generic.ObjectEqualityComparer`1")]
     public abstract partial class EqualityComparer<T> : IEqualityComparer, IEqualityComparer<T>
     {
         // To minimize generic instantiation overhead of creating the comparer per type, we keep the generic portion of the code as small
index 1ab95bc..cd7a1a3 100644 (file)
@@ -59,7 +59,7 @@ namespace System
 
         [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;
 
index 927b1aa..5737bfc 100644 (file)
@@ -297,7 +297,7 @@ namespace System.Reflection.Emit
 
         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)
         {
index 8512a96..f1d6c67 100644 (file)
@@ -531,7 +531,7 @@ namespace System.Reflection
             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 (file)
index 50d292e..0000000
+++ /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;
-        }
-    }
-}
index 3624f28..0deef24 100644 (file)
@@ -14,13 +14,6 @@ namespace System
         // 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.
         //
index 5a44b79..a00ad23 100644 (file)
@@ -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<TKey, TValue>' does not exist in the reference but it does exist in the implementation.
-MembersMustExist : Member 'public void System.AppContext.add_FirstChanceException(System.EventHandler<System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs>)' 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<System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs>)' 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<T>' 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
index c98f84c..8326281 100644 (file)
@@ -93,6 +93,6 @@ namespace System.Reflection.Runtime.Modules
         [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);
     }
 }
index 9a4d4e3..00a192f 100644 (file)
 #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"
index b0c0c1c..19d1164 100644 (file)
@@ -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
 
index a8dcfef..ab97ed0 100644 (file)
@@ -1,6 +1,4 @@
 Compat issues with assembly System.Collections:
-CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.TypeDependencyAttribute' exists on 'System.Collections.Generic.Comparer<T>' in the implementation but not the reference.
-CannotRemoveAttribute : Attribute 'System.Runtime.CompilerServices.TypeDependencyAttribute' exists on 'System.Collections.Generic.EqualityComparer<T>' in the implementation but not the reference.
 TypesMustExist : Type 'System.Collections.Generic.SortedDictionary<TKey, TValue>.KeyValuePairComparer' does not exist in the reference but it does exist in the implementation.
 TypesMustExist : Type 'System.Collections.Generic.SortedList<TKey, TValue>.KeyList' does not exist in the reference but it does exist in the implementation.
 TypesMustExist : Type 'System.Collections.Generic.SortedList<TKey, TValue>.ValueList' does not exist in the reference but it does exist in the implementation.
index ee28b6e..d738043 100644 (file)
@@ -8,5 +8,27 @@
       <!-- Used by VS4Mac via reflection to symbolize stack traces -->
       <method name="GetMethodFromNativeIP" />
     </type>
+    <type fullname="System.Runtime.Serialization.SerializationInfo">
+      <!-- Used by System.Runtime.Serialization.Formatters via reflection -->
+      <method name="UpdateValue" />
+      <method name="ThrowIfDeserializationInProgress" />
+    </type>
+    <type fullname="Internal.Runtime.InteropServices.ComActivator">
+      <!-- Used by hostpolicy.cpp -->
+      <method name="GetClassFactoryForTypeInternal" />
+      <method name="RegisterClassForTypeInternal" />
+      <method name="UnregisterClassForTypeInternal" />
+    </type>
+    <type fullname="Internal.Runtime.InteropServices.InMemoryAssemblyLoader">
+      <!-- Used by hostpolicy.cpp -->
+      <method name="LoadInMemoryAssembly" />
+      <!-- Used by ijwhost.cpp -->
+      <method name="LoadInMemoryAssemblyInContext" />
+    </type>
+    <type fullname="Internal.Runtime.InteropServices.ComponentActivator">
+      <!-- Used by hostpolicy.cpp -->
+      <method name="LoadAssemblyAndGetFunctionPointer" />
+      <method name="GetFunctionPointer" />
+    </type>
   </assembly>
 </linker>
index 50f7a5e..12961f1 100644 (file)
@@ -11,7 +11,7 @@ using System.Runtime.Versioning;
 
 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.";
index d851869..534922c 100644 (file)
@@ -68,13 +68,13 @@ namespace System
 
 #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<FirstChanceExceptionEventArgs>? FirstChanceException;
+        internal static event EventHandler<FirstChanceExceptionEventArgs>? FirstChanceException;
 #pragma warning restore CS0067
 
-        public static event EventHandler? ProcessExit;
+        internal static event EventHandler? ProcessExit;
 
         internal static void OnProcessExit()
         {
index 2838cfc..a2fa85a 100644 (file)
@@ -171,7 +171,7 @@ namespace System.Diagnostics.Tracing
             }
         }
 
-        protected void Flush()
+        private void Flush()
         {
             Debug.Assert(Monitor.IsEntered(this));
             for (int i = 0; i < _bufferedValues.Length; i++)
index fbb6e56..e716950 100644 (file)
@@ -3923,7 +3923,7 @@ namespace System.Diagnostics.Tracing
     /// created.
     /// </para>
     /// </summary>
-    public class EventListener : IDisposable
+    public abstract class EventListener : IDisposable
     {
         private event EventHandler<EventSourceCreatedEventArgs>? _EventSourceCreated;
 
@@ -3963,7 +3963,7 @@ namespace System.Diagnostics.Tracing
         /// Create a new EventListener in which all events start off turned off (use EnableEvents to turn
         /// them on).
         /// </summary>
-        public EventListener()
+        protected EventListener()
         {
             // This will cause the OnEventSourceCreated callback to fire.
             CallBackForExistingEventSources(true, (obj, args) =>
@@ -4100,7 +4100,7 @@ namespace System.Diagnostics.Tracing
         /// and EventSourceIndex allows this extra information to be efficiently stored in a
         /// (growable) array (eg List(T)).
         /// </summary>
-        public static int EventSourceIndex(EventSource eventSource) { return eventSource.m_id; }
+        protected internal static int EventSourceIndex(EventSource eventSource) { return eventSource.m_id; }
 
         /// <summary>
         /// This method is called whenever a new eventSource is 'attached' to the dispatcher.
index 9c1857f..7494a74 100644 (file)
@@ -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.
     /// </summary>
-    public class TraceLoggingEventTypes
+    internal sealed class TraceLoggingEventTypes
     {
         internal readonly TraceLoggingTypeInfo[] typeInfos;
 #if FEATURE_PERFTRACING
index 5139505..c3ac9ef 100644 (file)
@@ -227,5 +227,20 @@ namespace System.IO
             FileSystem.RemoveDirectory(FullPath, recursive);
             Invalidate();
         }
+
+        public override bool Exists
+        {
+            get
+            {
+                try
+                {
+                    return ExistsCore;
+                }
+                catch
+                {
+                    return false;
+                }
+            }
+        }
     }
 }
index a1f7df8..fb455e0 100644 (file)
@@ -113,6 +113,21 @@ namespace System.IO
             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);
 
index 5c64fc4..da70b06 100644 (file)
@@ -56,30 +56,10 @@ namespace System.IO
             }
         }
 
-        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();
index 9efb2ac..30f47a9 100644 (file)
@@ -24,7 +24,7 @@ namespace System.Reflection
         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; }
 
index 0693779..20f0715 100644 (file)
@@ -98,7 +98,7 @@ namespace System.Resources
             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<string, ResourceSet>? _resourceSets;
index 981a390..65689f7 100644 (file)
@@ -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<object, object?>? _table;
         private Dictionary<string, object?>? _caseInsensitiveTable;  // For case-insensitive lookups.
index 998ce79..f99e734 100644 (file)
@@ -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;
index 6cc4c80..bef1d6b 100644 (file)
@@ -19,7 +19,7 @@ namespace System.Runtime.Serialization
             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 @@ namespace System.Runtime.Serialization
             }
         }
 
-        // 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));
index 7d9a728..a0699e4 100644 (file)
@@ -258,7 +258,7 @@ namespace System.Runtime.Serialization
         /// <param name="name"> The name of the data to be updated.</param>
         /// <param name="value"> The new value.</param>
         /// <param name="type"> The type of the data being added.</param>
-        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");
index baf962e..99b72c1 100644 (file)
@@ -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<System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs>)' 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<System.Runtime.ExceptionServices.FirstChanceExceptionEventArgs>)' 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
index 43350fe..e7303f9 100644 (file)
@@ -57,6 +57,6 @@ namespace System
 
         [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);
     }
 }
index 0389ca0..67b975b 100644 (file)
@@ -788,7 +788,7 @@ namespace System.Reflection.Emit
 
         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)
index 19aa452..a4ee059 100644 (file)
@@ -394,7 +394,7 @@ namespace System.Reflection
 
         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)]