Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit cfa36dd

Browse files
authored
Merge pull request #6486 from stephentoub/expose_updatevalue
Expose SerializationInfo.UpdateValue for corefx
2 parents 9ae2afc + 1db5d5a commit cfa36dd

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

src/mscorlib/model.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9583,6 +9583,7 @@
95839583
<Member Name="GetDecimal(System.String)" />
95849584
<Member Name="GetDateTime(System.String)" />
95859585
<Member Name="GetString(System.String)" />
9586+
<Member Name="UpdateValue(System.String,System.Object,System.Type)" />
95869587
<Member MemberType="Property" Name="FullTypeName" />
95879588
<Member MemberType="Property" Name="AssemblyName" />
95889589
<Member MemberType="Property" Name="MemberCount" />

src/mscorlib/ref/mscorlib.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11418,6 +11418,7 @@ public void AddValue(string name, ulong value) { }
1141811418
public ulong GetUInt64(string name) { throw null; }
1141911419
public object GetValue(string name, Type type) { throw null; }
1142011420
public void SetType(Type type) { }
11421+
public void UpdateValue(string name, object value, Type type) { }
1142111422
}
1142211423
[System.Runtime.InteropServices.ComVisibleAttribute(true)]
1142311424
public sealed class SerializationInfoEnumerator : System.Collections.IEnumerator

src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,16 +408,23 @@ internal void AddValueInternal(String name, Object value, Type type)
408408
/*=================================UpdateValue==================================
409409
**Action: Finds the value if it exists in the current data. If it does, we replace
410410
** the values, if not, we append it to the end. This is useful to the
411-
** ObjectManager when it's performing fixups, but shouldn't be used by
412-
** clients. Exposing out this functionality would allow children to overwrite
413-
** their parent's values.
411+
** ObjectManager when it's performing fixups.
414412
**Returns: void
415413
**Arguments: name -- the name of the data to be updated.
416414
** value -- the new value.
417415
** type -- the type of the data being added.
418-
**Exceptions: None. All error checking is done with asserts.
416+
**Exceptions: None. All error checking is done with asserts. Although public in coreclr,
417+
** it's not exposed in a contract and is only meant to be used by corefx.
419418
==============================================================================*/
420-
internal void UpdateValue(String name, Object value, Type type)
419+
#if FEATURE_CORECLR
420+
// This should not be used by clients: exposing out this functionality would allow children
421+
// to overwrite their parent's values. It is public in order to give corefx access to it for
422+
// its ObjectManager implementation, but it should not be exposed out of a contract.
423+
public
424+
#else
425+
internal
426+
#endif
427+
void UpdateValue(String name, Object value, Type type)
421428
{
422429
Contract.Assert(null != name, "[SerializationInfo.UpdateValue]name!=null");
423430
Contract.Assert(null != value, "[SerializationInfo.UpdateValue]value!=null");

0 commit comments

Comments
 (0)