[Prometheus.HttpListener] Fix shutdown hang

Merged
MA
3mo ago
+74-13

Changes

Avoid disposal race in PrometheusHttpListener that can cause shutdown to hang indefinitely and flaky tests (1, 2, 3).

Merge requirement checklist

  • CONTRIBUTING guidelines followed (license requirements, nullable enabled, static analysis, etc.)
  • Unit tests added/updated
  • Appropriate CHANGELOG.md files updated for non-trivial changes
  • Changes in public API reviewed (if applicable)