Resolving Performance Counter Error on D365 FSCM version 10.0.46

When working with a local virtual machine (VM) downloaded from the LCS portal (VHD image), I encountered an issue despite completing all installation and build steps successfully.

Problem Description

During the creation of a Purchase Order or Free Text Invoice, the system immediately displayed the following error message and prevented record creation:

“The requested Performance Counter is not a custom counter, it has to be initialized as ReadOnly.”



Root Cause

This error occurs due to improper initialization of performance counters within the AOSService environment. The counters are expected to be read-only, but the system attempts to access them incorrectly.

Resolution

The issue can be resolved by executing a PowerShell script that reinitializes the performance counters for the AOSService.

Steps:

  • Backup your code, data, any pending works.
  • Stop all the related services.
  • Open PowerShell with administrative privileges.



Note: If your AOSService folder is located on a different drive, update the path accordingly.

Example: D:\AOSService\PackagesLocalDirectory

$AOSDirectory = 'C:\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()

Conclusion:

By reinitializing the performance counters via PowerShell, the error is resolved, and the system allows creation of new Purchase Orders and Free Text Invoices without interruption.

Appreciated Monsieur D365FO for the fix.

References:

https://community.dynamics.com/forums/thread/details/?threadid=6f360e04-3a06-f111-8407-7c1e521ae596  

https://fix.lcs.dynamics.com/Issue/Details/1732437?bugId=1064117&dbType=3&qc=112a6db043f508a2a16af14658ceb3d7c14ced84ccc1572a93dff963269808c8

https://blog.monsieurwinner.com/2025/11/20/d365-finance-and-operations-the-requested-performance-counter-is-not-a-custom-counter-it-has-to-be-initialized-as-readonly/ 

Disclaimer – The content published on this blog is provided solely for informational purposes. Dynamics 365 EZ makes no guarantees regarding the accuracy, completeness, timeliness, suitability, or validity of any information presented. We accept no responsibility for any errors, omissions, or delays, nor for any losses, injuries, or damages that may result from the use or display of this information.


Comments

Popular posts from this blog

Overview of unified ERP provisioning in Power Platform (Dynamics 365 F&O/D365 FSCM)