diff --git a/src/coreclr/src/System.Private.CoreLib/src/System/TypedReference.cs b/src/coreclr/src/System.Private.CoreLib/src/System/TypedReference.cs index 6f6b1724198eb0..e53f5e51e5fac3 100644 --- a/src/coreclr/src/System.Private.CoreLib/src/System/TypedReference.cs +++ b/src/coreclr/src/System.Private.CoreLib/src/System/TypedReference.cs @@ -101,14 +101,9 @@ public static RuntimeTypeHandle TargetTypeToken(TypedReference value) 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); } } diff --git a/src/coreclr/src/vm/ecalllist.h b/src/coreclr/src/vm/ecalllist.h index fca631eb639ea8..306f93939c04eb 100644 --- a/src/coreclr/src/vm/ecalllist.h +++ b/src/coreclr/src/vm/ecalllist.h @@ -193,7 +193,6 @@ FCFuncEnd() FCFuncStart(gTypedReferenceFuncs) FCFuncElement("InternalToObject", ReflectionInvocation::TypedReferenceToObject) - FCFuncElement("InternalSetTypedReference", ReflectionInvocation::SetTypedReference) FCFuncElement("InternalMakeTypedReference", ReflectionInvocation::MakeTypedReference) FCFuncEnd() diff --git a/src/coreclr/src/vm/reflectioninvocation.cpp b/src/coreclr/src/vm/reflectioninvocation.cpp index e3ee4fea23ea65..9edc3aba211a9c 100644 --- a/src/coreclr/src/vm/reflectioninvocation.cpp +++ b/src/coreclr/src/vm/reflectioninvocation.cpp @@ -2280,21 +2280,6 @@ FCIMPL4(void, ReflectionInvocation::MakeTypedReference, TypedByRef * value, Obje } FCIMPLEND -FCIMPL2(void, ReflectionInvocation::SetTypedReference, TypedByRef * target, Object* objUNSAFE) { - FCALL_CONTRACT; - - // @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. - // - 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) { diff --git a/src/coreclr/src/vm/reflectioninvocation.h b/src/coreclr/src/vm/reflectioninvocation.h index c140f089e0dd9b..89b3c5f6bec139 100644 --- a/src/coreclr/src/vm/reflectioninvocation.h +++ b/src/coreclr/src/vm/reflectioninvocation.h @@ -61,7 +61,6 @@ class ReflectionInvocation { // 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