During a Business Central 25 to 28.5 on-prem upgrade, Invoke-NAVApplicationDatabaseConversion failed with an OpenTelemetry error before it even touched the database. Here's the problem and the fix.
The
problem
I ran this
in PowerShell ISE as administrator:
Import-Module
"C:\Program Files\Microsoft Dynamics 365 Business
Central\280\Service\NavAdminTool.ps1"
Invoke-NAVApplicationDatabaseConversion -DatabaseServer GAF-BC-UPG -DatabaseName BC28TEST -Force -ErrorAction Stop
And this is
what came back:
WARNING:
UnhandledErrorMessage
Invoke-NAVApplicationDatabaseConversion
: The type initializer for
'OpenTelemetry.Instrumentation.Http.Implementation.HttpHandlerDiagnosticListener'
threw an exception.
+ CategoryInfo : NotSpecified: (:)
[Invoke-NAVApplicationDatabaseConversion], TypeInitializationException
+ FullyQualifiedErrorId :
System.TypeInitializationException,Microsoft.Dynamics.Nav.Management.Cmdlets.InvokeNAVApplicationDatabaseConversion
The cause
This is a
regression in BC 28.5. The platform upgraded OpenTelemetry.Instrumentation.Http
from 1.9 to 1.16, and the new version needs newer .NET dependencies than
Windows PowerShell 5.1 resolves. The binding redirects that would fix this ship
in Microsoft.Dynamics.Nav.Management.dll.config, but .NET Framework only reads
the host's .exe.config, so inside powershell.exe or ISE they never apply. The
service tier itself runs fine; only the admin cmdlets break. Full details are
in BCApps
issue #11216.
The fix
Update
PowerShell 7 to PowerShell 7.6.6 or newer.
Run
Microsoft's install script from an admin PowerShell window:
Invoke-Expression
"& { $(Invoke-RestMethod https://aka.ms/install-powershell.ps1) }
-UseMSI"
Close ISE,
open PowerShell 7 as administrator, confirm the version is 7.6.6 or
newer with $PSVersionTable.PSVersion, then:
Import-Module
"C:\Program Files\Microsoft Dynamics 365 Business
Central\280\Service\NavAdminTool.ps1"
Invoke-NAVApplicationDatabaseConversion
-DatabaseServer GAF-BC-UPG -DatabaseName BC28TEST -ErrorAction Stop
After
installing PowerShell 7.6.6 or newer, the conversion successfully ran from PowerShell ISE.

No comments:
Post a Comment