Skip to main content

System.Threading.Tasks.Parallel API in Acumatica Application Code is Forbidden

  • August 6, 2025
  • 0 replies
  • 46 views

snikomarov36
Acumatica Employee
Forum|alt.badge.img

The use of System.Threading.Tasks.Parallel type (https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.parallel?view=netframework-4.8.1) in Acumatica business logic is currently not supported by the Acumatica Framework. This includes such methods of the Parallel type as Parallel.For and Parallel.ForEach.

The current best practices are:

  • The usage Parallel type should be forbidden in the new functionality.,
  • It is advised to rework the existing code that uses this construct to replace it with supported mechanisms.,
  • The usage of Parallel type and its members in customizations is also not supported.,

Acumatica ISV support team will require a justification for every usage of the Parallel type. In addition, in the next Acuminator version all calls to the Parallel type and its members will be reported by the new diagnostic PX1099: https://github.com/Acumatica/Acuminator/blob/dev/docs/diagnostics/PX1099.md

In many cases, Parallel mechanisms are misused. The intended goals can often be achieved more effectively through other means. For example, executing multiple HTTP requests concurrently can be done using asynchronous methods within a single-threaded context.

The usage scenarios where the Parallel type can be safely used are extremely rare. For example, you probably can use Parallel.ForEach calculation of a CPU-intensive task that allows to effectively parallelize at least part of the computation, and the task does not use any Acumatica APIs and mechanisms at all. I believe, such tasks are very rarely encountered in the development for Acumatica Framework.

Problems with the Parallel Type

  • Data consistency issues may appear due to a multi-threaded access to shared system objects from within the operation context. DC issues may appear even in cases where the parallelized code appears not to interact with any shared resources.,
  • Inaccurate resource tracking in Acumatica Telemetry and Request Profiler tools. These tools do not support this kind of parallelism.,
  • Resource monopolization on SaaS servers leads to the service denial due to a limited capacity reserved for a server . Parallel execution of code with the Parallel type significantly increases the likelihood of the resource exhaustion.,
  • System configuration dependencies. Usually, an explicit Acumatica Platform support is required to determine an appropriate degree of parallelism.