From 3fec63d57832162f5a9b4853db5a7080ac2dcb50 Mon Sep 17 00:00:00 2001 From: Gert Van Der Heyden <GVDerH@ferranti.be> Date: Wed, 18 Oct 2023 16:28:38 +0200 Subject: [PATCH] using try catch for runtime provider too --- 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 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