internal object GetExistingObject(string id, Type?type, string?name, string?ns)
        {
            object?retObj = DeserializedObjects.GetObject(id);

            if (retObj == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(XmlObjectSerializer.CreateSerializationException(SR.Format(SR.DeserializedObjectWithIdNotFound, id)));
            }
            return(retObj);
        }
        private object GetExistingObjectOrExtensionData(string id)
        {
            object?retObj = DeserializedObjects.GetObject(id);

            if (retObj == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                          XmlObjectSerializer.CreateSerializationException(SR.Format(SR.DeserializedObjectWithIdNotFound, id)));
            }

            return(retObj);
        }