Move TypedReference::SetTypedReference exception throw to managed (dotnet/coreclr...
authorMarek Safar <marek.safar@gmail.com>
Mon, 9 Sep 2019 16:58:25 +0000 (18:58 +0200)
committerJan Kotas <jkotas@microsoft.com>
Mon, 9 Sep 2019 16:58:25 +0000 (09:58 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/7c9432c3ee874d8d5c4b1e5f38670ebef43bfb3f

src/coreclr/src/System.Private.CoreLib/src/System/TypedReference.cs
src/coreclr/src/vm/ecalllist.h
src/coreclr/src/vm/reflectioninvocation.cpp
src/coreclr/src/vm/reflectioninvocation.h

index 6f6b172..e53f5e5 100644 (file)
@@ -101,14 +101,9 @@ namespace System
             return __reftype(value).TypeHandle;
         }
 
-        // This may cause the type to be changed.
-        [CLSCompliant(false)]
-        public static unsafe void SetTypedReference(TypedReference target, object? value)
+        public static void SetTypedReference(TypedReference target, object? value)
         {
-            InternalSetTypedReference(&target, value);
+            throw new NotSupportedException();
         }
-
-        [MethodImplAttribute(MethodImplOptions.InternalCall)]
-        internal static extern unsafe void InternalSetTypedReference(void* target, object? value);
     }
 }
index fca631e..306f939 100644 (file)
@@ -193,7 +193,6 @@ FCFuncEnd()
 
 FCFuncStart(gTypedReferenceFuncs)
     FCFuncElement("InternalToObject", ReflectionInvocation::TypedReferenceToObject)
-    FCFuncElement("InternalSetTypedReference", ReflectionInvocation::SetTypedReference)
     FCFuncElement("InternalMakeTypedReference", ReflectionInvocation::MakeTypedReference)
 FCFuncEnd()
 
index e3ee4fe..9edc3ab 100644 (file)
@@ -2280,21 +2280,6 @@ FCIMPL4(void, ReflectionInvocation::MakeTypedReference, TypedByRef * value, Obje
 }
 FCIMPLEND
 
-FCIMPL2(void, ReflectionInvocation::SetTypedReference, TypedByRef * target, Object* objUNSAFE) {
-    FCALL_CONTRACT;
-    
-    // <TODO>@TODO: We fixed serious bugs in this method very late in the endgame
-    // for V1 RTM. So it was decided to disable this API (nobody would seem to
-    // be using it anyway). If this API is enabled again, the implementation should 
-    // be similar to COMArrayInfo::SetValue.
-    // </TODO>
-    HELPER_METHOD_FRAME_BEGIN_0();
-    COMPlusThrow(kNotSupportedException);
-    HELPER_METHOD_FRAME_END();
-}
-FCIMPLEND
-
-
 // This is an internal helper function to TypedReference class.
 // It extracts the object from the typed reference.
 FCIMPL1(Object*, ReflectionInvocation::TypedReferenceToObject, TypedByRef * value) {
index c140f08..89b3c5f 100644 (file)
@@ -61,7 +61,6 @@ public:
 
     // TypedReference functions, should go somewhere else
     static FCDECL4(void, MakeTypedReference, TypedByRef * value, Object* targetUNSAFE, ArrayBase* fldsUNSAFE, ReflectClassBaseObject *pFieldType);
-    static FCDECL2(void, SetTypedReference, TypedByRef * target, Object* objUNSAFE);
     static FCDECL1(Object*, TypedReferenceToObject, TypedByRef * value);
 
 #ifdef FEATURE_COMINTEROP