diff --git a/d365fo.tools/functions/get-d365module.ps1 b/d365fo.tools/functions/get-d365module.ps1 index 2c603247..ae02a804 100644 --- a/d365fo.tools/functions/get-d365module.ps1 +++ b/d365fo.tools/functions/get-d365module.ps1 @@ -143,7 +143,12 @@ function Get-D365Module { Write-PSFMessage -Level Verbose -Message "MetadataProvider initialized." -Target $metadataProviderViaRuntime - $modules = $metadataProviderViaRuntime.ModelManifest.ListModulesInDependencyOrder() + try { + $modules = $metadataProviderViaRuntime.ModelManifest.ListModulesInDependencyOrder() + } catch { + Write-PSFMessage -Level Warning -Message "Failed to retrieve runtime modules in dependency order. Falling back to ListModules()." -Target $metadataProviderViaRuntime + $modules = $metadataProviderViaRuntime.ModelManifest.ListModules() + } $modules | ForEach-Object { $_ | Add-Member -MemberType NoteProperty -Name 'IsBinary' -Value $false