Skip to content

Add Singleton lifecycle diagnostics and async initialization #224

Description

@Skymly

Background

The project currently has Singleton generation and DI lifetime diagnostics, but lacks a cohesive lifecycle model for async initialization and several common double-owner/mutable-state cases.

Scope

  • Add GenerateSingletonAttribute.InitializeAsync with Task/ValueTask signature validation (DP067).
  • Generate GetInstanceAsync() backed by a lazy async singleton.
  • Add analyzer diagnostics for generated-singleton + DI double registration (DP068), non-thread-safe mutable instance state (DP069), mutable static singleton candidates (DP070), and mutable static singleton + DI registration (DP071).
  • Register the new diagnostics and add generator, analyzer, integration, packaging, and CI coverage.

Acceptance criteria

  • CiPack passes with zero test failures and zero compile warnings/errors.
  • NuGet package and net8.0/net48 consumer smoke verification pass.
  • Diagnostic IDs and unshipped release tracking remain synchronized.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions