Skip to content

Commit

Permalink
Move TypedReference::SetTypedReference exception throw to managed (do…
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-safar authored and jkotas committed Sep 9, 2019
1 parent aa968a6 commit 34293e8
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
1 change: 0 additions & 1 deletion src/coreclr/src/vm/ecalllist.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,6 @@ FCFuncEnd()

FCFuncStart(gTypedReferenceFuncs)
FCFuncElement("InternalToObject", ReflectionInvocation::TypedReferenceToObject)
FCFuncElement("InternalSetTypedReference", ReflectionInvocation::SetTypedReference)
FCFuncElement("InternalMakeTypedReference", ReflectionInvocation::MakeTypedReference)
FCFuncEnd()

Expand Down
15 changes: 0 additions & 15 deletions src/coreclr/src/vm/reflectioninvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/src/vm/reflectioninvocation.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 34293e8

Please sign in to comment.