From 62809a05d38b0edd7bdc1eddfbf25685fa8a4706 Mon Sep 17 00:00:00 2001 From: Florian Hopfner Date: Sat, 14 Oct 2023 18:01:28 +0200 Subject: [PATCH] add fallback for failing ListModulesInDependencyOrder #753 See also #745 --- d365fo.tools/functions/get-d365module.ps1 | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/d365fo.tools/functions/get-d365module.ps1 b/d365fo.tools/functions/get-d365module.ps1 index 567e9b4a..2c603247 100644 --- a/d365fo.tools/functions/get-d365module.ps1 +++ b/d365fo.tools/functions/get-d365module.ps1 @@ -161,7 +161,12 @@ function Get-D365Module { Write-PSFMessage -Level Verbose -Message "MetadataProvider initialized." -Target $metadataProviderViaDisk - $diskModules = $metadataProviderViaDisk.ModelManifest.ListModulesInDependencyOrder() + try { + $diskModules = $metadataProviderViaDisk.ModelManifest.ListModulesInDependencyOrder() + } catch { + Write-PSFMessage -Level Warning -Message "Failed to retrieve disk modules in dependency order. Falling back to ListModules()." -Target $metadataProviderViaDisk + $diskModules = $metadataProviderViaDisk.ModelManifest.ListModules() + } foreach ($module in $modules) { if ($diskModules.Name -NotContains $module.Name) {