fix(shim): resolve real org version instead of hardcoded 9.2.0.0 fallback#168
Merged
TomProkop merged 1 commit intoJul 3, 2026
Merged
Conversation
…back CrmServiceClient's ConnectedOrgVersion hardcoded a 9.2.0.0 fallback whenever the base ServiceClient returned its own default of 9.0.0.0, which happens under the token-provider (ExternalTokenManagement) constructor path. That constant is below CMT's UpsertMultiple batch-mode version gate (9.2.23083.00120), so CMT silently fell back to slow, one-by-one Create/Update calls through our shim regardless of how modern the real connected org actually is. Confirmed live against a current Dataverse online environment (real version 9.2.26061.150, SDK 1.2.10): - ConnectedOrgVersion initially reports the SDK's stub default 9.0.0.0. - ServiceClient.OrganizationDetail (public property, forces a real RefreshInstanceDetails) correctly returns the real version. - Execute(new RetrieveVersionRequest()) also correctly returns the real version, as a further fallback. Replaced the hardcoded constant with a cascade using only public SDK APIs: base property -> OrganizationDetail -> RetrieveVersionRequest, falling back to the honest SDK default only if every mechanism fails. Filed upstream: microsoft/PowerPlatform-DataverseServiceClient#538 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
CrmServiceClient(ourMicrosoft.Xrm.Tooling.Connector.CrmServiceClient-compatible shim overMicrosoft.PowerPlatform.Dataverse.Client.ServiceClient) hardcodedConnectedOrgVersionto9.2.0.0whenever the base SDK returned its own stub default of9.0.0.0— which happens under the token-provider (ExternalTokenManagement) constructor path used byCmtImportRunner,CmtExportRunner, andPackageDeployerRunner.9.2.0.0is below CMT'sUpsertMultiplebatch-mode version gate (9.2.23083.00120), so the Configuration Migration Tool import path silently fell back to slow, one-by-oneCreate/Updatecalls through our wrapper — regardless of how modern the real connected org actually is.Root cause
The underlying SDK's
ExternalTokenManagementauth path setsOrganizationVersion = 9.0.0.0at connect time and skips normal server-version discovery. This was previously worked around (see history of this file) by hardcoding a fallback constant, after earlier attempts usingRetrieveVersion/OrganizationDetailwere believed to fail silently in that auth mode.That belief no longer holds for the SDK version we consume (
1.2.10) — confirmed live against a real Dataverse online environment (actual org version9.2.26061.150):ConnectedOrgVersioninitially reports the SDK's stub default9.0.0.0.ServiceClient.OrganizationDetail(public property, forces a realRefreshInstanceDetails) correctly returns the real version (9.2.26061.150).Execute(new RetrieveVersionRequest())also correctly returns the real version.Filed upstream for the SDK-level bug: microsoft/PowerPlatform-DataverseServiceClient#538
Fix
Replaced the hardcoded
9.2.0.0constant inCrmServiceClient.ConnectedOrgVersionwith a cascade using only public SDK APIs:OrganizationDetail(forces a real refresh).Execute(new RetrieveVersionRequest())(last resort, strongly-typed request).If every mechanism still returns the SDK default, the base value is returned honestly instead of substituting a hardcoded constant.
Related
UpsertMultiple), fix(data/import): pre-populate LookupKeys cache and newId to eliminate redundant CMT server lookups #167 removes redundant per-record lookup calls.