Skip to content

Fix SSOv2 HttpClient null bug, remove pointless try-catches, minor code quality#166

Draft
Copilot wants to merge 2 commits intomasterfrom
copilot/review-repo-for-improvements
Draft

Fix SSOv2 HttpClient null bug, remove pointless try-catches, minor code quality#166
Copilot wants to merge 2 commits intomasterfrom
copilot/review-repo-for-improvements

Conversation

Copy link
Contributor

Copilot AI commented Feb 28, 2026

Several issues identified during codebase review — ranging from a silent null-assignment bug to noise code patterns.

Bug: SSOv2._httpClient never assigned when caller provides a client

// Before: custom httpClient silently discarded; _httpClient stays null on first use → NullReferenceException
if (httpClient == null)
{
    _httpClient = new HttpClient();
}

// After
_httpClient = httpClient ?? new HttpClient();

Additionally, _httpClient was static, meaning all SSOv2 instances shared one client — a second instantiation would silently overwrite it. Changed to an instance field.

Code quality

  • Removed two try { ... } catch (Exception) { throw; } blocks in APIBase.RequestAsync and APIBase.ProcessSuccess — they re-throw unchanged with no side effects.
  • TRANQUILITY_ESI_BASE / SERENITY_ESI_BASE promoted from mutable static fields to const.
  • CheckAuth was throwing new ArgumentNullException() with no message or parameter name; replaced with ArgumentException carrying a descriptive message covering all validated inputs.
  • <PackageLicenseUrl></PackageLicenseUrl> removed from .csproj — deprecated and already superseded by the existing <PackageLicenseExpression>.

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…ity improvements

Co-authored-by: gehnster <7077730+gehnster@users.noreply.github.com>
Copilot AI changed the title [WIP] Review repository for potential improvements and issues Fix SSOv2 HttpClient null bug, remove pointless try-catches, minor code quality Feb 28, 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