Skip to content

[Bug]: DateTime parsing fails on non-US locale runners in WorkflowPostProcess.ps1 #2045

@BW-PA

Description

@BW-PA

AL-Go version

8.0

Describe the issue

The WorkflowPostProcess.ps1 script reports an error when running on self-hosted GitHub runners with non-US locale settings (e.g., Australian locale).

Image

Error:

Exception calling "Parse" with "1" argument(s): "String '11/27/2025 05:17:03' was not recognized as a valid DateTime."

Location:
WorkflowPostProcess.ps1 line 71:

powershell$workflowTiming = [DateTime]::UtcNow.Subtract([DateTime]::Parse($telemetryScope.workflowStartTime)).TotalSeconds

Root Cause:
[DateTime]::Parse() uses the current culture settings. On Australian locale runners (dd/MM/yyyy format), it fails to parse US-format dates (MM/dd/yyyy) like 11/27/2025.

If timestamps are always in US format: Could consider using culture-invariant parsing, for example the below runs correctly when given a US date format on an australian locale machine

$workflowTiming = [DateTime]::Parse($telemetryScope.workflowStartTime, [System.Globalization.CultureInfo]::InvariantCulture)

Expected behavior

US date formats to work correctly when using non-US locale self hosted runners

Steps to reproduce

This Line from WorkflowPostProcess.ps1 line 71: but modified to run in powershell directly for testing.

PS C:\Windows\system32> $workflowTiming = [DateTime]::UtcNow.Subtract([DateTime]::Parse('11/27/2025 05:17:03')).TotalSeconds
Exception calling "Parse" with "1" argument(s): "String was not recognized as a valid DateTime."
At line:1 char:1
+ $workflowTiming = [DateTime]::UtcNow.Subtract([DateTime]::Parse('11/2 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FormatException

If I change to use InvariantCulture

PS C:\Windows\system32> $workflowTiming = [DateTime]::UtcNow.Subtract([DateTime]::Parse('11/27/2025 05:17:03', [System.Globalization.CultureInfo]::InvariantCulture)).TotalSeconds
$workflowTiming 
81019.7661082

Additional context (logs, screenshots, etc.)

I believe the source of the issue is Line 71 of this file https://github.com/microsoft/AL-Go/blob/main/Actions/WorkflowPostProcess/WorkflowPostProcess.ps1

when $telemetryScope.workflowStartTime contains a US date format and the script is running on an Australian Locale self hosted runner it errors.

Image

Internal work item: AB#614767

Metadata

Metadata

Labels

Fix ReadyFix ReadyacceptedThe issue has been acceptedbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions