Delete FriendAccessAllowedAttribute and associated dead code (#15101)
authorJan Kotas <jkotas@microsoft.com>
Sun, 19 Nov 2017 15:41:14 +0000 (07:41 -0800)
committerGitHub <noreply@github.com>
Sun, 19 Nov 2017 15:41:14 +0000 (07:41 -0800)
- Preserved commented out FriendAccessAllowed on types and methods that are still used as friends in System.Runtime.WindowsRuntime

29 files changed:
src/inc/corhdr.h
src/mscorlib/System.Private.CoreLib.csproj
src/mscorlib/shared/System/Diagnostics/Tracing/Winmeta.cs
src/mscorlib/shared/System/ObjectDisposedException.cs
src/mscorlib/src/System/AppDomain.cs
src/mscorlib/src/System/Buffer.cs
src/mscorlib/src/System/CompatibilitySwitches.cs [deleted file]
src/mscorlib/src/System/Diagnostics/Eventing/FrameworkEventSource.cs
src/mscorlib/src/System/Exception.cs
src/mscorlib/src/System/IO/MemoryStream.cs
src/mscorlib/src/System/Number.CoreCLR.cs
src/mscorlib/src/System/Resources/ResourceManager.cs
src/mscorlib/src/System/Runtime/CompilerServices/AsyncMethodBuilder.cs
src/mscorlib/src/System/Runtime/CompilerServices/FriendAccessAllowedAttribute.cs [deleted file]
src/mscorlib/src/System/Runtime/CompilerServices/YieldAwaitable.cs
src/mscorlib/src/System/Runtime/CompilerServices/jithelpers.cs
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/Attributes.cs
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EventRegistrationTokenTable.cs
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IRestrictedErrorInfo.cs
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeBufferHelper.cs [deleted file]
src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs
src/mscorlib/src/System/StubHelpers.cs
src/mscorlib/src/System/Threading/SynchronizationContext.cs
src/mscorlib/src/System/Threading/Tasks/AsyncCausalityTracer.cs
src/mscorlib/src/System/Threading/Tasks/Task.cs
src/mscorlib/src/System/Threading/Tasks/TaskContinuation.cs
src/vm/compile.cpp
src/vm/ecalllist.h

index 4b75742..e878c21 100644 (file)
@@ -1796,10 +1796,6 @@ typedef enum CorAttributeTargets
 #define FRIEND_ASSEMBLY_TYPE                     "System.Runtime.CompilerServices.InternalsVisibleToAttribute"
 #define FRIEND_ASSEMBLY_SIG                     {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 2, ELEMENT_TYPE_VOID, ELEMENT_TYPE_STRING, ELEMENT_TYPE_BOOLEAN}
 
-#define FRIEND_ACCESS_ALLOWED_ATTRIBUTE_TYPE_W  L"System.Runtime.CompilerServices.FriendAccessAllowedAttribute"
-#define FRIEND_ACCESS_ALLOWED_ATTRIBUTE_TYPE     "System.Runtime.CompilerServices.FriendAccessAllowedAttribute"
-#define FRIEND_ACCESS_ALLOWED_SIG               {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
-
 #define SUBJECT_ASSEMBLY_TYPE_W                 L"System.Runtime.CompilerServices.IgnoresAccessChecksToAttribute"
 #define SUBJECT_ASSEMBLY_TYPE                    "System.Runtime.CompilerServices.IgnoresAccessChecksToAttribute"
 #define SUBJECT_ASSEMBLY_SIG                    {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_STRING}
index 149acfd..c6a87ce 100644 (file)
   <!-- Sources -->
   <ItemGroup>
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\RuntimeHelpers.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\FriendAccessAllowedAttribute.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\TypeDependencyAttribute.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\jithelpers.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\CompilerServices\Unsafe.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\WindowsRuntime\ICustomPropertyProvider.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\WindowsRuntime\ICustomProperty.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\WindowsRuntime\CustomPropertyImpl.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\WindowsRuntime\WindowsRuntimeBufferHelper.cs" />
   </ItemGroup>
   <ItemGroup Condition="'$(FeatureCominterop)' == 'true'">
     <Compile Include="$(BclSourcesRoot)\System\Runtime\InteropServices\WindowsRuntime\IIterable.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Attribute.cs" />
     <Compile Include="$(BclSourcesRoot)\System\BadImageFormatException.CoreCLR.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Buffer.cs" />
-    <Compile Include="$(BclSourcesRoot)\System\CompatibilitySwitches.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Currency.cs" />
     <Compile Include="$(BclSourcesRoot)\System\Decimal.cs" />
     <Compile Include="$(BclSourcesRoot)\System\DefaultBinder.CanConvert.cs" />
index ac756b6..c60ca5b 100644 (file)
@@ -55,9 +55,6 @@ namespace System.Diagnostics.Tracing
     /// <summary>
     /// WindowsEventTask. Custom values must be in the range from 1 through 65534
     /// </summary>
-#if (!ES_BUILD_STANDALONE && !ES_BUILD_PN)
-    [System.Runtime.CompilerServices.FriendAccessAllowed]
-#endif
     public enum EventTask
     {
         /// <summary>
@@ -68,9 +65,6 @@ namespace System.Diagnostics.Tracing
     /// <summary>
     /// EventOpcode. Custom values must be in the range from 11 through 239
     /// </summary>
-#if (!ES_BUILD_STANDALONE && !ES_BUILD_PN)
-    [System.Runtime.CompilerServices.FriendAccessAllowed]
-#endif
     public enum EventOpcode
     {
         /// <summary>
@@ -124,9 +118,6 @@ namespace System.Diagnostics.Tracing
     /// EventChannel. Custom values must be in the range from 16 through 255. Currently only predefined values allowed.
     /// </summary>
     [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1028:EnumStorageShouldBeInt32", Justification = "Backwards compatibility")]
-#if (!ES_BUILD_STANDALONE && !ES_BUILD_PN)
-    [System.Runtime.CompilerServices.FriendAccessAllowed]
-#endif
     public enum EventChannel : byte
     {
         /// <summary>
index be80c6d..3daed13 100644 (file)
@@ -72,7 +72,7 @@ namespace System
         {
             get
             {
-                if ((_objectName == null)) // && !CompatibilitySwitches.IsAppEarlierThanWindowsPhone8)
+                if (_objectName == null)
                 {
                     return String.Empty;
                 }
index 302d623..813b2b5 100644 (file)
@@ -242,8 +242,6 @@ namespace System
             // case where the compat flags have been setup.
             Debug.Assert(!_compatFlagsInitialized);
             _compatFlagsInitialized = true;
-
-            CompatibilitySwitches.InitializeSwitches();
         }
 
         /// <summary>
index 4fef6f9..a015e56 100644 (file)
@@ -243,7 +243,6 @@ namespace System
         // This behavioral difference is unfortunate but intentional because
         // 1. This method is given access to other internal dlls and this close to release we do not want to change it.
         // 2. It is difficult to get this right for arm and again due to release dates we would like to visit it later.
-        [FriendAccessAllowed]
 #if ARM
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         internal unsafe static extern void Memcpy(byte* dest, byte* src, int len);
diff --git a/src/mscorlib/src/System/CompatibilitySwitches.cs b/src/mscorlib/src/System/CompatibilitySwitches.cs
deleted file mode 100644 (file)
index 58dd640..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Runtime.CompilerServices;
-
-namespace System
-{
-    [FriendAccessAllowed]
-    internal static class CompatibilitySwitches
-    {
-        private static bool s_AreSwitchesSet;
-
-        public static bool IsCompatibilityBehaviorDefined
-        {
-            get
-            {
-                return s_AreSwitchesSet;
-            }
-        }
-
-        internal static void InitializeSwitches()
-        {
-            s_AreSwitchesSet = true;
-        }
-    }
-}
index d746f58..1afe82d 100644 (file)
@@ -27,7 +27,7 @@ namespace System.Diagnostics.Tracing
     //
     // This will produce an XML file, where each event is pretty-printed with all its arguments nicely parsed.
     //
-    [FriendAccessAllowed]
+    // [FriendAccessAllowed]
     [EventSource(Guid = "8E9F5090-2D75-4d03-8A81-E5AFBF85DAF1", Name = "System.Diagnostics.Eventing.FrameworkEventSource")]
     sealed internal class FrameworkEventSource : EventSource
     {
@@ -52,7 +52,6 @@ namespace System.Diagnostics.Tracing
         }
 
         /// <summary>ETW tasks that have start/stop events.</summary>
-        [FriendAccessAllowed]
         public static class Tasks // this name is important for EventSource
         {
             /// <summary>Begin / End - GetResponse.</summary>
@@ -63,7 +62,6 @@ namespace System.Diagnostics.Tracing
             public const EventTask ThreadTransfer = (EventTask)3;
         }
 
-        [FriendAccessAllowed]
         public static class Opcodes
         {
             public const EventOpcode ReceiveHandled = (EventOpcode)11;
index 3de41ca..625f006 100644 (file)
@@ -183,7 +183,7 @@ namespace System
             }
         }
 
-        [FriendAccessAllowed]
+        // [FriendAccessAllowed]
         internal void AddExceptionDataForRestrictedErrorInfo(
             string restrictedError,
             string restrictedErrorReference,
@@ -335,7 +335,7 @@ namespace System
             return remoteStackTraceString + tempStackTraceString;
         }
 
-        [FriendAccessAllowed]
+        // [FriendAccessAllowed]
         internal void SetErrorCode(int hr)
         {
             HResult = hr;
index 6039dc7..85930df 100644 (file)
@@ -232,15 +232,6 @@ namespace System.IO
             return _buffer;
         }
 
-        // PERF: Get origin and length - used in ResourceWriter.
-        [FriendAccessAllowed]
-        internal void InternalGetOriginAndLength(out int origin, out int length)
-        {
-            if (!_isOpen) __Error.StreamIsClosed();
-            origin = _origin;
-            length = _length;
-        }
-
         // PERF: True cursor position, we don't need _origin for direct access
         internal int InternalGetPosition()
         {
index 6104ebe..24dcc3d 100644 (file)
@@ -275,7 +275,6 @@ namespace System
     // by the Parse methods if the NumberStyles.Any style is
     // specified. Note, however, that the Parse methods do not accept
     // NaNs or Infinities.
-    [FriendAccessAllowed]
     internal static partial class Number
     {
         [MethodImpl(MethodImplOptions.InternalCall)]
index 490a322..f730d86 100644 (file)
@@ -38,25 +38,24 @@ namespace System.Resources
     // allowing us to ask for a WinRT-specific ResourceManager.
     // It is important to have WindowsRuntimeResourceManagerBase as regular class with virtual methods and default implementations. 
     // Defining WindowsRuntimeResourceManagerBase as abstract class or interface will cause issues when adding more methods to it 
-    // because it�ll create dependency between mscorlib and System.Runtime.WindowsRuntime which will require always shipping both DLLs together. 
-    // Also using interface or abstract class will not play nice with FriendAccessAllowed.
+    // because it'll create dependency between mscorlib and System.Runtime.WindowsRuntime which will require always shipping both DLLs together. 
     //
-    [FriendAccessAllowed]
-    internal class WindowsRuntimeResourceManagerBase
+    // [FriendAccessAllowed]
+    internal abstract class WindowsRuntimeResourceManagerBase
     {
-        public virtual bool Initialize(string libpath, string reswFilename, out PRIExceptionInfo exceptionInfo) { exceptionInfo = null; return false; }
+        public abstract bool Initialize(string libpath, string reswFilename, out PRIExceptionInfo exceptionInfo);
 
-        public virtual String GetString(String stringName, String startingCulture, String neutralResourcesCulture) { return null; }
+        public abstract String GetString(String stringName, String startingCulture, String neutralResourcesCulture);
 
-        public virtual CultureInfo GlobalResourceContextBestFitCultureInfo
+        public abstract CultureInfo GlobalResourceContextBestFitCultureInfo
         {
-            get { return null; }
+            get;
         }
 
-        public virtual bool SetGlobalResourceContextDefaultCulture(CultureInfo ci) { return false; }
+        public abstract bool SetGlobalResourceContextDefaultCulture(CultureInfo ci);
     }
 
-    [FriendAccessAllowed]
+    // [FriendAccessAllowed]
     internal class PRIExceptionInfo
     {
         public string _PackageSimpleName;
index 85eb17c..0a61b68 100644 (file)
@@ -38,7 +38,7 @@ namespace System.Runtime.CompilerServices
         /// <returns>The initialized <see cref="AsyncVoidMethodBuilder"/>.</returns>
         public static AsyncVoidMethodBuilder Create()
         {
-            SynchronizationContext sc = SynchronizationContext.CurrentNoFlow;
+            SynchronizationContext sc = SynchronizationContext.Current;
             sc?.OperationStarted();
             return new AsyncVoidMethodBuilder() { _synchronizationContext = sc };
         }
diff --git a/src/mscorlib/src/System/Runtime/CompilerServices/FriendAccessAllowedAttribute.cs b/src/mscorlib/src/System/Runtime/CompilerServices/FriendAccessAllowedAttribute.cs
deleted file mode 100644 (file)
index 9d380e1..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-namespace System.Runtime.CompilerServices
-{
-    /// <summary>
-    ///     If AllInternalsVisible is not true for a friend assembly, the FriendAccessAllowed attribute
-    ///     indicates which internals are shared with that friend assembly.
-    /// </summary>
-    [AttributeUsage(AttributeTargets.Class |
-                    AttributeTargets.Constructor |
-                    AttributeTargets.Enum |
-                    AttributeTargets.Event |
-                    AttributeTargets.Field |
-                    AttributeTargets.Interface |
-                    AttributeTargets.Method |
-                    AttributeTargets.Property |
-                    AttributeTargets.Struct,
-        AllowMultiple = false,
-        Inherited = false)]
-    [FriendAccessAllowed]
-    internal sealed class FriendAccessAllowedAttribute : Attribute
-    {
-    }
-}
index e2e4374..3bf6e8c 100644 (file)
@@ -85,7 +85,7 @@ namespace System.Runtime.CompilerServices
                 // post the continuation to it.  However, treat the base type
                 // as if there wasn't a SynchronizationContext, since that's what it
                 // logically represents.
-                var syncCtx = SynchronizationContext.CurrentNoFlow;
+                var syncCtx = SynchronizationContext.Current;
                 if (syncCtx != null && syncCtx.GetType() != typeof(SynchronizationContext))
                 {
                     syncCtx.Post(s_sendOrPostCallbackRunAction, continuation);
index f89f201..1441593 100644 (file)
@@ -66,7 +66,6 @@ namespace System.Runtime.CompilerServices
         public byte m_arrayData;
     }
 
-    [FriendAccessAllowed]
     internal static class JitHelpers
     {
         // The special dll name to be used for DllImport of QCalls
index d78aae2..d11b436 100644 (file)
@@ -32,7 +32,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
     // implement the CLR's support for WinRT, so this type is internal as marking tdWindowsRuntime should
     // generally be done via winmdexp for user code.
     [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Enum | AttributeTargets.Struct | AttributeTargets.Delegate, Inherited = false)]
-    [System.Runtime.CompilerServices.FriendAccessAllowed]
+    // [System.Runtime.CompilerServices.FriendAccessAllowed]
     internal sealed class WindowsRuntimeImportAttribute : Attribute
     {
         internal WindowsRuntimeImportAttribute()
index 9747385..ccbb1f1 100644 (file)
@@ -49,9 +49,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         // the get_Value property, allocate an appropriately-sized managed object, marshal the native object
         // to the managed object, and free the native method.  Also we want the return value boxed (aka normal value type boxing).
         //
-        // This method is called by VM. Mark the method with FriendAccessAllowed attribute to ensure that the unreferenced method
-        // optimization skips it and the code will be saved into NGen image.
-        [System.Runtime.CompilerServices.FriendAccessAllowed]
+        // This method is called by VM.
         internal static Object UnboxHelper(Object wrapper)
         {
             Debug.Assert(wrapper != null);
@@ -212,9 +210,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         // the get_Value property, allocate an appropriately-sized managed object, marshal the native object
         // to the managed object, and free the native method.
         //
-        // This method is called by VM. Mark the method with FriendAccessAllowed attribute to ensure that the unreferenced method
-        // optimization skips it and the code will be saved into NGen image.
-        [System.Runtime.CompilerServices.FriendAccessAllowed]
+        // This method is called by VM.
         internal static Object UnboxHelper(Object wrapper)
         {
             Debug.Assert(wrapper != null);
index 2ecd418..1a210a0 100644 (file)
@@ -95,7 +95,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         // Get the delegate associated with an event registration token if it exists.  Additionally,
         // remove the registration from the table at the same time.  If the token is not registered,
         // Extract returns null and does not modify the table.
-        [System.Runtime.CompilerServices.FriendAccessAllowed]
+        // [System.Runtime.CompilerServices.FriendAccessAllowed]
         internal T ExtractHandler(EventRegistrationToken token)
         {
             T handler = null;
index 9de5e3f..ca19d94 100644 (file)
@@ -8,7 +8,7 @@ using System;
 
 namespace System.Runtime.InteropServices.WindowsRuntime
 {
-    [System.Runtime.CompilerServices.FriendAccessAllowed]
+    // [System.Runtime.CompilerServices.FriendAccessAllowed]
     [ComImport]
     [Guid("82BA7092-4C88-427D-A7BC-16DD93FEB67E")]
     [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
diff --git a/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeBufferHelper.cs b/src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeBufferHelper.cs
deleted file mode 100644 (file)
index f871d94..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System.Runtime.CompilerServices;
-using System.Runtime.ConstrainedExecution;
-using System.Runtime.Versioning;
-using System.Security;
-using System.Threading;
-
-
-namespace System.Runtime.InteropServices.WindowsRuntime
-{
-    /// <summary>
-    /// Exposes a helper method that allows <code>WindowsRuntimeBuffer : IBuffer, IBufferInternal</code> which is implemented in
-    /// <code>System.Runtime.WindowsRuntime.dll</code> to call into the VM.
-    /// </summary>
-    [FriendAccessAllowed]
-    internal static class WindowsRuntimeBufferHelper
-    {
-        [DllImport(JitHelpers.QCall)]
-        private unsafe extern static void StoreOverlappedPtrInCCW(ObjectHandleOnStack windowsRuntimeBuffer, NativeOverlapped* overlapped);
-
-
-        [FriendAccessAllowed]
-        internal unsafe static void StoreOverlappedInCCW(Object windowsRuntimeBuffer, NativeOverlapped* overlapped)
-        {
-            StoreOverlappedPtrInCCW(JitHelpers.GetObjectHandleOnStack(ref windowsRuntimeBuffer), overlapped);
-        }
-    }  // class WindowsRuntimeBufferHelper
-}  // namespace
-
-// WindowsRuntimeBufferHelper.cs
index 2d23c31..684a9c0 100644 (file)
@@ -1125,7 +1125,7 @@ namespace System.Runtime.InteropServices.WindowsRuntime
         /// for the application to be invoked to process the error.
         /// </summary>
         /// <returns>true if the error was reported, false if not (ie running on Win8)</returns>
-        [FriendAccessAllowed]
+        // [FriendAccessAllowed]
         internal static bool ReportUnhandledError(Exception e)
         {
             // Only report to the WinRT global exception handler in modern apps
index 2c7bc04..888f25c 100644 (file)
@@ -624,7 +624,7 @@ namespace System.StubHelpers
     }  // class DateMarshaler
 
 #if FEATURE_COMINTEROP
-    [FriendAccessAllowed]
+    // [FriendAccessAllowed]
     internal static class InterfaceMarshaler
     {
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
@@ -636,7 +636,7 @@ namespace System.StubHelpers
         [DllImport(JitHelpers.QCall)]
         static internal extern void ClearNative(IntPtr pUnk);
 
-        [FriendAccessAllowed]
+        // [FriendAccessAllowed]
         [MethodImplAttribute(MethodImplOptions.InternalCall)]
         static internal extern object ConvertToManagedWithoutUnboxing(IntPtr pNative);
     }  // class InterfaceMarshaler
@@ -660,10 +660,10 @@ namespace System.StubHelpers
         }
     }  // class InterfaceMarshaler
 
-    [FriendAccessAllowed]
+    // [FriendAccessAllowed]
     internal static class EventArgsMarshaler
     {
-        [FriendAccessAllowed]
+        // [FriendAccessAllowed]
         static internal IntPtr CreateNativeNCCEventArgsInstance(int action, object newItems, object oldItems, int newIndex, int oldIndex)
         {
             IntPtr newItemsIP = IntPtr.Zero;
@@ -688,7 +688,7 @@ namespace System.StubHelpers
             }
         }
 
-        [FriendAccessAllowed]
+        // [FriendAccessAllowed]
         [DllImport(JitHelpers.QCall)]
         static extern internal IntPtr CreateNativePCEventArgsInstance([MarshalAs(UnmanagedType.HString)]string name);
 
index f4ca1ae..07bcdb7 100644 (file)
@@ -35,12 +35,11 @@ namespace System.Threading
 #if FEATURE_COMINTEROP && FEATURE_APPX
     //
     // This is implemented in System.Runtime.WindowsRuntime, allowing us to ask that assembly for a WinRT-specific SyncCtx.
-    // I'd like this to be an interface, or at least an abstract class - but neither seems to play nice with FriendAccessAllowed.
     //
-    [FriendAccessAllowed]
-    internal class WinRTSynchronizationContextFactoryBase
+    // [FriendAccessAllowed]
+    internal abstract class WinRTSynchronizationContextFactoryBase
     {
-        public virtual SynchronizationContext Create(object coreDispatcher) { return null; }
+        public abstract SynchronizationContext Create(object coreDispatcher);
     }
 #endif //FEATURE_COMINTEROP
 
@@ -172,16 +171,6 @@ namespace System.Threading
             }
         }
 
-        // Get the last SynchronizationContext that was set explicitly (not flowed via ExecutionContext.Capture/Run)        
-        internal static SynchronizationContext CurrentNoFlow
-        {
-            [FriendAccessAllowed]
-            get
-            {
-                return Current; // SC never flows
-            }
-        }
-
 #if FEATURE_APPX
         private static SynchronizationContext GetWinRTContext()
         {
index 2b14f37..322b4f8 100644 (file)
@@ -20,7 +20,7 @@ using WFD = Windows.Foundation.Diagnostics;
 
 namespace System.Threading.Tasks
 {
-    [FriendAccessAllowed]
+    // [FriendAccessAllowed]
     internal enum CausalityTraceLevel
     {
 #if FEATURE_COMINTEROP
@@ -34,7 +34,7 @@ namespace System.Threading.Tasks
 #endif
     }
 
-    [FriendAccessAllowed]
+    // [FriendAccessAllowed]
     internal enum AsyncCausalityStatus
     {
 #if FEATURE_COMINTEROP
@@ -80,7 +80,7 @@ namespace System.Threading.Tasks
 #endif
     }
 
-    [FriendAccessAllowed]
+    // [FriendAccessAllowed]
     internal static class AsyncCausalityTracer
     {
         static internal void EnableToETW(bool enabled)
@@ -93,10 +93,9 @@ namespace System.Threading.Tasks
 #endif
         }
 
-        [FriendAccessAllowed]
         internal static bool LoggingOn
         {
-            [FriendAccessAllowed]
+            // [FriendAccessAllowed]
             get
             {
 #if FEATURE_COMINTEROP
@@ -175,7 +174,7 @@ namespace System.Threading.Tasks
         // The TraceXXX methods should be called only if LoggingOn property returned true
         //
 
-        [FriendAccessAllowed]
+        // [FriendAccessAllowed]
         [MethodImplAttribute(MethodImplOptions.NoInlining)] // Tracking is slow path. Disable inlining for it.
         internal static void TraceOperationCreation(CausalityTraceLevel traceLevel, int taskId, string operationName, ulong relatedContext)
         {
@@ -195,7 +194,7 @@ namespace System.Threading.Tasks
 #endif
         }
 
-        [FriendAccessAllowed]
+        // [FriendAccessAllowed]
         [MethodImplAttribute(MethodImplOptions.NoInlining)]
         internal static void TraceOperationCompletion(CausalityTraceLevel traceLevel, int taskId, AsyncCausalityStatus status)
         {
index 37ae347..5c9754f 100644 (file)
@@ -200,7 +200,7 @@ namespace System.Threading.Tasks
 
         // A private flag that would be set (only) by the debugger
         // When true the Async Causality logging trace is enabled as well as a dictionary to relate operation ids with Tasks
-        [FriendAccessAllowed]
+        // [FriendAccessAllowed]
         internal static bool s_asyncDebuggingEnabled; //false by default
 
         // This dictonary relates the task id, from an operation id located in the Async Causality log to the actual
@@ -210,7 +210,7 @@ namespace System.Threading.Tasks
 
         // These methods are a way to access the dictionary both from this class and for other classes that also
         // activate dummy tasks. Specifically the AsyncTaskMethodBuilder and AsyncTaskMethodBuilder<>
-        [FriendAccessAllowed]
+        // [FriendAccessAllowed]
         internal static bool AddToActiveTasks(Task task)
         {
             Debug.Assert(task != null, "Null Task objects can't be added to the ActiveTasks collection");
@@ -222,7 +222,7 @@ namespace System.Threading.Tasks
             return true;
         }
 
-        [FriendAccessAllowed]
+        // [FriendAccessAllowed]
         internal static void RemoveFromActiveTasks(int taskId)
         {
             lock (s_activeTasksLock)
@@ -2580,7 +2580,7 @@ namespace System.Threading.Tasks
                 // then ignore it.  This helps with performance by avoiding unnecessary posts and queueing
                 // of work items, but more so it ensures that if code happens to publish the default context 
                 // as current, it won't prevent usage of a current task scheduler if there is one.
-                var syncCtx = SynchronizationContext.CurrentNoFlow;
+                var syncCtx = SynchronizationContext.Current;
                 if (syncCtx != null && syncCtx.GetType() != typeof(SynchronizationContext))
                 {
                     tc = new SynchronizationContextAwaitTaskContinuation(syncCtx, continuationAction, flowExecutionContext);
@@ -2641,7 +2641,7 @@ namespace System.Threading.Tasks
             // fall back to using the state machine's delegate.
             if (continueOnCapturedContext)
             {
-                SynchronizationContext syncCtx = SynchronizationContext.CurrentNoFlow;
+                SynchronizationContext syncCtx = SynchronizationContext.Current;
                 if (syncCtx != null && syncCtx.GetType() != typeof(SynchronizationContext))
                 {
                     var tc = new SynchronizationContextAwaitTaskContinuation(syncCtx, stateMachineBox.MoveNextAction, flowExecutionContext: false);
@@ -5151,25 +5151,6 @@ namespace System.Threading.Tasks
             return task;
         }
 
-        /// <summary>Creates a <see cref="Task"/> that's completed due to cancellation with the specified token.</summary>
-        /// <param name="cancellationToken">The token with which to complete the task.</param>
-        /// <returns>The canceled task.</returns>
-        [FriendAccessAllowed]
-        internal static Task FromCancellation(CancellationToken cancellationToken)
-        {
-            return FromCanceled(cancellationToken);
-        }
-
-        /// <summary>Creates a <see cref="Task{TResult}"/> that's completed due to cancellation with the specified token.</summary>
-        /// <typeparam name="TResult">The type of the result returned by the task.</typeparam>
-        /// <param name="cancellationToken">The token with which to complete the task.</param>
-        /// <returns>The canceled task.</returns>
-        [FriendAccessAllowed]
-        internal static Task<TResult> FromCancellation<TResult>(CancellationToken cancellationToken)
-        {
-            return FromCanceled<TResult>(cancellationToken);
-        }
-
         #endregion
 
         #region Run methods
@@ -6138,7 +6119,6 @@ namespace System.Threading.Tasks
         }
         #endregion
 
-        [FriendAccessAllowed]
         internal static Task<TResult> CreateUnwrapPromise<TResult>(Task outerTask, bool lookForOce)
         {
             Debug.Assert(outerTask != null);
index 8835eb5..42fc40e 100644 (file)
@@ -401,7 +401,7 @@ namespace System.Threading.Tasks
         {
             // If we're allowed to inline, run the action on this thread.
             if (canInlineContinuationTask &&
-                m_syncContext == SynchronizationContext.CurrentNoFlow)
+                m_syncContext == SynchronizationContext.Current)
             {
                 RunCallback(GetInvokeActionCallback(), m_action, ref Task.t_currentTask);
             }
@@ -614,7 +614,7 @@ namespace System.Threading.Tasks
             {
                 // If there's a SynchronizationContext, we'll be conservative and say 
                 // this is a bad location to inline.
-                var ctx = SynchronizationContext.CurrentNoFlow;
+                var ctx = SynchronizationContext.Current;
                 if (ctx != null && ctx.GetType() != typeof(SynchronizationContext)) return false;
 
                 // Similarly, if there's a non-default TaskScheduler, we'll be conservative
index 327f0f1..7040ffc 100644 (file)
@@ -4903,10 +4903,7 @@ static bool IsMethodAccessibleOutsideItsAssembly(MethodDesc * pMD)
 {
     STANDARD_VM_CONTRACT;
 
-    // Note that this ignores unrestricted friend access. This friend access allowed attribute can be used to 
-    // prevent methods from getting trimmed if necessary.
-    if (pMD->GetMDImport()->GetCustomAttributeByName(pMD->GetMemberDef(), FRIEND_ACCESS_ALLOWED_ATTRIBUTE_TYPE, NULL, NULL) == S_OK)
-        return true;
+    // Note that this ignores friend access.
 
     switch (pMD->GetAttrs() & mdMemberAccessMask)
     {
index b1f9b2b..f3118f4 100644 (file)
@@ -1196,13 +1196,6 @@ FCFuncStart(gStreamFuncs)
 FCFuncEnd()
 
 
-#ifdef FEATURE_COMINTEROP
-FCFuncStart(gWindowsRuntimeBufferHelperFuncs)
-    QCFuncElement("StoreOverlappedPtrInCCW", WindowsRuntimeBufferHelper::StoreOverlappedPtrInCCW) 
-    //QCFuncElement("ReleaseOverlapped", WindowsRuntimeBufferHelper::ReleaseOverlapped) 
-FCFuncEnd()
-#endif // ifdef FEATURE_COMINTEROP
-
 #if defined(FEATURE_EVENTSOURCE_XPLAT)
 FCFuncStart(gEventLogger)
     QCFuncElement("IsEventSourceLoggingEnabled", XplatEventSourceLogger::IsEventSourceLoggingEnabled)
@@ -1431,11 +1424,6 @@ FCClassElement("WeakReference`1", "System", gWeakReferenceOfTFuncs)
 FCClassElement("WinRTTypeNameConverter", "System.StubHelpers", gWinRTTypeNameConverterFuncs)
 #endif // FEATURE_COMINTEROP
 
-#ifdef FEATURE_COMINTEROP
-FCClassElement("WindowsRuntimeBufferHelper", "System.Runtime.InteropServices.WindowsRuntime", gWindowsRuntimeBufferHelperFuncs)                    
-#endif
-
-
 
 #if defined(FEATURE_EVENTSOURCE_XPLAT)
 FCClassElement("XplatEventLogger", "System.Diagnostics.Tracing", gEventLogger)