Monsieur Winner

MS D365FO || Monsieur D365FO

Technical

D365 Finance and Operations – The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly

On version 10.0.45, on a CHE environment, we discovered this error “The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly” on vendor invoice journal input. For some, the complain was on when trying to get PurchTotals.

Running the below powershell script helped.

$AOSDirectory = ‘K:\AOSService\PackagesLocalDirectory’
$AOSBinDirectory = $AOSDirectory + ‘\bin’

[Reflection.Assembly]::LoadFrom(“$AOSBinDirectory\Microsoft.Diagnostics.Tracing.EventSource.dll”)

$sharedDLL = ‘Microsoft.Dynamics.AX.Xpp.AxShared.dll’
$subledgerDLL = ‘Microsoft.Dynamics.Subledger.Instrumentation.dll’
$taxDLL = ‘Microsoft.Dynamics.Tax.Instrumentation.dll’
$prodCfgDLL = ‘Microsoft.Dynamics.ProductConfiguration.Instrumentation.dll’
$sourceDocDLL = ‘Microsoft.Dynamics.SourceDocumentation.Instrumentation.dll’

Copy-Item $(Join-Path $AOSDirectory -ChildPath “Subledger\bin” | Join-Path -ChildPath $subledgerDLL) -Destination $AOSBinDirectory
[Reflection.Assembly]::LoadFrom($(Join-Path $AOSBinDirectory -ChildPath $subledgerDLL))
[Microsoft.Dynamics.Subledger.Instrumentation.PerformanceCounterCatalog]::Setup()

Copy-Item $(Join-Path $AOSDirectory -ChildPath “Tax\bin” | Join-Path -ChildPath $taxDLL) -Destination $AOSBinDirectory
[Reflection.Assembly]::LoadFrom($(Join-Path $AOSBinDirectory -ChildPath $taxDLL))
[Microsoft.Dynamics.Tax.Instrumentation.PerformanceCounterCatalog]::Setup()

Copy-Item $(Join-Path $AOSDirectory -ChildPath “SourceDocumentation\bin” | Join-Path -ChildPath $sourceDocDLL) -Destination $AOSBinDirectory
[Reflection.Assembly]::LoadFrom($(Join-Path $AOSBinDirectory -ChildPath $sourceDocDLL))
[Microsoft.Dynamics.SourceDocumentation.Instrumentation.PerformanceCounterCatalog]::Setup()

Copy-Item $(Join-Path $AOSDirectory -ChildPath “ApplicationSuite\bin” | Join-Path -ChildPath $prodCfgDLL) -Destination $AOSBinDirectory
[Reflection.Assembly]::LoadFrom($(Join-Path $AOSBinDirectory -ChildPath $prodCfgDLL))
[Microsoft.Dynamics.ProductConfiguration.Instrumentation.PerformanceCounterCatalog]::Setup()

[Reflection.Assembly]::LoadFrom($(Join-Path $AOSBinDirectory -ChildPath $sharedDLL))
[Microsoft.Dynamics.Ax.Xpp.AxShared.AxPerformanceCounters]::InitializePerformanceCounterCategories()

Komi Siabi

Komi Siabi is a Bilingual D365FO Solution architect who loves sharing his knowledge as he works on Both Francophone and Anglophone projects around the globe. He enjoys doing some tiktok videos in his leisure time.

Leave a Reply