Skip to content

Fix NullReferenceException in GetEnrollmentResult for null DCV email#9

Open
bhillkeyfactor wants to merge 2 commits into
release-1.1from
hotfix/dcv-email-null-key
Open

Fix NullReferenceException in GetEnrollmentResult for null DCV email#9
bhillkeyfactor wants to merge 2 commits into
release-1.1from
hotfix/dcv-email-null-key

Conversation

@bhillkeyfactor

@bhillkeyfactor bhillkeyfactor commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes an ArgumentNullException (Value cannot be null. Parameter 'key') thrown from RequestManager.GetEnrollmentResult on every CSC enrollment where CSC returns a DcvDetail with email=null (typical for EMAIL DCV orders that come back with actionNeeded=N, and for CNAME-only DCV).

The condition for adding DCV email entries to the cnames dictionary was inverted: when dcv.Email was null, the original code entered the branch and called cnames.Add(null, null), throwing immediately. The new condition skips null/empty values (matching the intent) and adds a ContainsKey guard symmetric to the existing CName branch above.

Test plan

  • Enroll a cert via the CSC plugin using EMAIL DCV — enrollment completes (no NRE)
  • Enroll a cert via the CSC plugin using CNAME DCV — CNAME details still surface in EnrollmentContext as before
  • Build passes on net6.0 / net8.0

bhillkeyfactor and others added 2 commits June 24, 2026 14:14
The condition for adding DCV email entries to the cnames dictionary was
inverted (string.IsNullOrEmpty instead of !string.IsNullOrEmpty), causing
cnames.Add(null, null) and an ArgumentNullException on every enrollment
where CSC returned a DcvDetail with email=null (typical for EMAIL DCV
orders that have actionNeeded=N, and for CNAME-only DCV).

Inverts the condition and adds a ContainsKey guard to mirror the existing
CName branch.
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.

1 participant