Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1167,4 +1167,7 @@
<data name="ReadOnlyCollectionDeserialization" xml:space="preserve">
<value>Collection type '{0}' cannot be deserialized since it</value>
</data>
<data name="UnknownNullType" xml:space="preserve">
<value>Unknown Type for null value</value>
</data>
</root>
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,9 @@ public void ReplaceDeserializedObject(string id, object? oldObj, object? newObj)
// throw in such cases to allow us add fix-up support in the future if we need to.
if (DeserializedObjects.IsObjectReferenced(id))
{
// https://github.com/dotnet/runtime/issues/41465 - oldObj or newObj may be null below - suppress compiler error by asserting non-null
Debug.Assert(oldObj != null && newObj != null);
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(SR.Format(SR.FactoryObjectContainsSelfReference, DataContract.GetClrTypeFullName(oldObj.GetType()), DataContract.GetClrTypeFullName(newObj.GetType()), id)));
string oldType = (oldObj != null) ? DataContract.GetClrTypeFullName(oldObj.GetType()) : SR.UnknownNullType;
string newType = (newObj != null) ? DataContract.GetClrTypeFullName(newObj.GetType()) : SR.UnknownNullType;
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(SR.Format(SR.FactoryObjectContainsSelfReference, oldType, newType, id)));
}
DeserializedObjects.Remove(id);
DeserializedObjects.Add(id, newObj);
Expand Down