Skip to content

Log warning when perpetual license cannot be applied due to missing build date#1163

Merged
jbogard merged 3 commits intoperpetualfrom
copilot/sub-pr-1162
Feb 24, 2026
Merged

Log warning when perpetual license cannot be applied due to missing build date#1163
jbogard merged 3 commits intoperpetualfrom
copilot/sub-pr-1162

Conversation

Copy link
Contributor

Copilot AI commented Feb 24, 2026

When BuildInfo.BuildDate returns null (assembly metadata not embedded), a perpetual license silently fell through to the standard expiration error with no diagnostic signal.

Changes

  • LicenseValidator.cs

    • Added LogWarning when IsPerpetual is true but _buildDate is null, indicating that perpetual licensing was attempted but could not be applied due to missing BuildDateUtc assembly metadata
    • Split single constructor with ??-fallback default parameter into two overloads, allowing explicit null to be passed independently of BuildInfo.BuildDate
  • LicenseValidatorTests.cs

    • Fixed build error: Validate(license, null) (non-existent overload) → Validate(license) with validator constructed using (DateTimeOffset?)null
    • Fixed bool.TrueString ("True") → "true" to match the license parser's case-sensitive comparison
    • Added assertion for the new warning log
// Before: silently added expiration error with no context
else
{
    errors.Add($"Your license ... expired {diff} days ago.");
}

// After: warns that perpetual was attempted but build date is unavailable
else
{
    if (license.IsPerpetual)
    {
        _logger.LogWarning(
            "...perpetual licensing enabled, but the build date could not be determined...");
    }
    errors.Add($"Your license ... expired {diff} days ago.");
}

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…error in test

Co-authored-by: jbogard <104498+jbogard@users.noreply.github.com>
Copilot AI changed the title [WIP] Update perpetual licensing pull request based on feedback Log warning when perpetual license cannot be applied due to missing build date Feb 24, 2026
Copilot AI requested a review from jbogard February 24, 2026 16:14
This was referenced Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants