microsoft/aspire · error · InvalidOperationException

Could not determine the identity timestamp for monitor…

Error message

Could not determine the identity timestamp for monitor process {monitorProcessId}.

What it means

DcpProcessMonitor identifies the parent/monitor process by its ID plus its creation timestamp, which uniquely pins the process identity. When GetProcessIdentityTimestamp cannot determine the process start time (null returned), this InvalidOperationException is thrown rather than tracking a possibly-reused process ID. On Windows this typically comes from failing to query process times; on Linux it delegates to the /proc reader.

Solutions

  1. Re-run the AppHost; the error is usually a transient race with process exit
  2. Check that the environment grants permission to query process information (e.g., not a hardened container without /proc access)
  3. If reproducible, file a bug with OS and environment details
Defensive patterns

Strategy: try-catch

Try / catch

try
{
    var identity = DcpProcessMonitor.GetMonitorProcessIdentity(parentProcess);
}
catch (InvalidOperationException ex) when (ex.Message.Contains("identity timestamp"))
{
    // Parent likely exited or is not queryable; retry spawn/monitor or report environment issue.
}

Prevention

When it happens

Trigger: Starting the DCP process monitor when the parent process's start timestamp cannot be read: the process already exited, the OS query failed, or access to the process information is denied.

Common situations: Race where the parent process dies between spawn and monitor start; restricted environments (containers, service accounts) lacking permission to query other processes; OS-specific APIs failing unexpectedly.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of microsoft/aspire@25830f84bd (2026-09-16). Data as JSON: /api/errors/e9313e04a7699071. Report an issue: GitHub.

Appendix: source

Thrown at src/Aspire.Hosting/Dcp/DcpProcessMonitor.cs:21

using SystemProcess = System.Diagnostics.Process;

namespace Aspire.Hosting.Dcp;

internal sealed record DcpProcessIdentity(int ProcessId, DateTime Timestamp);

internal static class DcpProcessMonitor
{
    internal static DcpProcessIdentity GetMonitorProcessIdentity(SystemProcess parentProcess)
    {
        ArgumentNullException.ThrowIfNull(parentProcess);

        var monitorProcessId = parentProcess.Id;
        var timestamp = GetProcessIdentityTimestamp(parentProcess);

        if (timestamp is null)
        {
            throw new InvalidOperationException($"Could not determine the identity timestamp for monitor process {monitorProcessId}.");
        }

        return new(monitorProcessId, timestamp.Value);
    }

    private static DateTime? GetProcessIdentityTimestamp(SystemProcess parentProcess)
    {
        if (OperatingSystem.IsLinux())
        {
            return GetLinuxProcessIdentityTimestamp(parentProcess.Id);
        }

        try
        {
            return parentProcess.StartTime.ToUniversalTime();
        }
        catch (ArgumentException)
        {

View on GitHub (pinned to 25830f84bd)