Views:

Applies to Product – Microsoft Dataverse


What’s happening?
Customers are unable to generate EarlyBound classes using Microsoft.Xrm.Tooling.Connector.CrmServiceClient, encountering a "502 Bad Request" error when executing the RetrieveAllEntities command.


Reason:
This arises due to the CrmSvcUtil.exe tool calling the API "RetrieveAllEntities," which fails because too much metadata is being loaded, leading to insufficient memory to handle the request. This can occur when there are a large number of customizations in the environment.


Resolution:

  • It is recommended to use the Power Platform CLI pac modelbuilder build command instead of CrmSvcUtil.exe for generating EarlyBound classes. This method is designed to handle large amounts of metadata more efficiently.
  • If using RetrieveAllEntities, consider using the RetrieveMetadataChangesRequest class to request only the necessary metadata. Set the EntityFilters property to minimize the amount of data retrieved.
  • Splitting up requests can reduce the chance of timeouts. Use the RetrieveEntityRequest class for each table definition needed instead of retrieving all entities at once.
  • Evaluate other options to retrieve schema definitions and avoid using RetrieveAllEntities as it is an expensive operation.