Calling PbmQueryAssociatedProfiles method fails with the error "Query associated profiles failed ---> System.InvalidOperationException: The specified type was not recognized: name='PbmProfileQueryProfileResultInternal', namespace='urn:pbm'.
book
Article ID: 301560
calendar_today
Updated On:
Products
VMware vSphere ESXi
Issue/Introduction
This article provides information about the scenario where the error is seen.
Symptoms:
User gets below deserialization error when calling this PbmQueryAssociatedProfiles method using VMware-vSphere-SDK
ERROR 2023-02-22T09:37:57 Replay.Common.Implementation.Virtualization.VSphereApi.EsxVirtualMachine () Failed to obtain storage profiles for virtual machine 'windows11-ENTR-exp-ah' on server '10.35.21.42' Replay.Common.Implementation.Virtualization.VSphereApi.PbmProfileQueryFailedException: Query associated profiles failed ---> System.InvalidOperationException: There is an error in XML document (1, 359). ---> System.InvalidOperationException: The specified type was not recognized: name='PbmProfileQueryProfileResultInternal', namespace='urn:pbm', at <returnval xmlns='urn:pbm'>. at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPbmServiceInternal.Read2985_PbmQueryProfileResult(Boolean isNullable, Boolean checkType) at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderPbmServiceInternal.Read3087_Item() at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
Cause
This is caused by a bug in the VMware vCenter server which fails to filter the response by upcasting the internal result i.e. PbmProfileQueryProfileResultInternal to the public result i.e. PbmQueryAssociatedProfileResult that is why it is not able to deserialize the PbmQueryProfileResult as it receives PbmProfileQueryProfileResultInternal type in response instead of the expected PbmProfileQueryProfileResult when PbmQueryAssociatedProfiles method is called.
Resolution
To be fixed in future version of vCenter
Workaround:
This is a known issue affecting vCenter 7.X. There is currently no resolution
Additional Information
Impact/Risks:
User will not be able to call and get results from the PbmQueryAssociatedProfiles method.