Skip to content

fix(build): replace obsolete WebClient with HttpClient (SYSLIB0014) — zéro-warning résiduel - #706

Merged
jsboige merged 1 commit into
masterfrom
fix/syslib0014-webclient-httpclient
Jul 5, 2026
Merged

fix(build): replace obsolete WebClient with HttpClient (SYSLIB0014) — zéro-warning résiduel#706
jsboige merged 1 commit into
masterfrom
fix/syslib0014-webclient-httpclient

Conversation

@jsboige

@jsboige jsboige commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

fix(build): replace obsolete WebClient with HttpClient (SYSLIB0014)

Base: 70bd1605 · Dispatch: ka7vl5 (TERTIAIRE — zéro-warning résiduel lane) · Scope: non-Cards (release freeze is on Cards/ only).

The warning

TranslationCoverageReport.LoadTaxonomyData used new System.Net.WebClient() + DownloadStringTaskAsync to fetch the taxonomy CSV from an http URL. WebClient is obsolete since .NET 6 (SYSLIB0014: use HttpClient). This was the only source-level CS warning left in the converter project — the build is otherwise zero-warning (#587), but this one SYSLIB0014 had survived.

Tests/TranslationCoverageReport.cs(128,41): warning SYSLIB0014: 'WebClient.WebClient()' est obsolète.

The fix

Static readonly HttpClient field (the recommended pattern — HttpClient is meant to be instantiated once and reused; per-use instantiation risks socket exhaustion under load) + GetStringAsync. The enclosing method is already async Task<List<Fallacy>>, so the swap is a 1:1 behavioral equivalent (download a string from a URL, then ParseCsvContent).

// before
using (var client = new System.Net.WebClient())
{
    string csvContent = await client.DownloadStringTaskAsync(taxonomyFilePath);
    fallacies = ParseCsvContent(csvContent);
}

// after
private static readonly HttpClient _httpClient = new HttpClient();
...
string csvContent = await _httpClient.GetStringAsync(taxonomyFilePath);
fallacies = ParseCsvContent(csvContent);

Behavior: unchanged. The http branch still downloads then parses; the local-file branch is untouched.

Verification

Remaining warning (NOT fixed here — flagged)

MSB3073 + SGEN: "Failed to generate the serializer for Argumentum.AssetConverter.dll"
(from Microsoft.XmlSerializer.Generator)

This is a build-time tooling warning (sgen config / XmlSerializer generation), not a source-level CS warning, and fixing it is build-config territory (likely: review whether the Microsoft.XmlSerializer.Generator package is even needed, or fix the type that fails to serialize). Riskier during release freeze → deferred to a post-release tooling pass. Surfaced here so it's tracked.

What this does NOT do

  • ❌ No Cards/ write (release freeze).
  • ❌ No SGEN/MSB3073 fix (tooling, deferred).
  • ❌ No behavior change (1:1 API swap in an async method).

Relates to #587 (zéro-warning), dispatch ka7vl5 TERTIAIRE. Base 70bd1605.

🤖 Generated with Claude Code

… zéro-warning résiduel

TranslationCoverageReport.LoadTaxonomyData used `new System.Net.WebClient()` +
DownloadStringTaskAsync to fetch the taxonomy CSV from an http URL. WebClient is obsolete
since .NET 6 (SYSLIB0014: use HttpClient). This was the only source-level CS warning left in
the converter project — the build is otherwise zero-warning (#587), but this one SYSLIB0014
had survived.

Fix: static readonly HttpClient field (the recommended pattern — HttpClient is meant to be
instantiated once and reused; per-use instantiation risks socket exhaustion under load) +
GetStringAsync. The enclosing method is already async Task<List<Fallacy>>, so the swap is a
1:1 behavioral equivalent (download a string from a URL, then ParseCsvContent).

Behavior: unchanged. The http branch still downloads then parses; the local-file branch is
untouched.

Scope: non-Cards (release freeze is on Cards/ only). One file, one method.

REMAINING warning (NOT fixed here, out of scope):
  MSB3073 + SGEN "Failed to generate the serializer for Argumentum.AssetConverter.dll"
  from Microsoft.XmlSerializer.Generator. This is a build-time tooling warning (sgen config /
  XmlSerializer generation), not a source-level CS warning, and fixing it is build-config
  territory — riskier during release freeze. Flagged for a post-release tooling pass.

Verified: dotnet build (no SYSLIB0014 remains), dotnet test = 578 pass / 1 fail (pre-existing
OWL #133 known-fail, unrelated) / 5 skip / 584 total — baseline preserved.

Dispatch ka7vl5 (TERTIAIRE — zéro-warning résiduel lane). Base 70bd160.

Co-authored-by: Claude-Code <noreply@anthropic.com>

@clusterManager-Myia clusterManager-Myia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[NanoClaw] — LGTM (COMMENT only, décision merge = Emerjesse)

Correctif byte-vérifié firsthand au head d1a663be (vs base 70bd1605) :

SYSLIB0014 était RÉEL sur baseTests/TranslationCoverageReport.cs:128 utilisait new System.Net.WebClient() + DownloadStringTaskAsync. Pas une claim fabriquée.

Swap 1:1 vérifié byte-pour-byte :

  • Base L128-131 : using (var client = new WebClient()) { csvContent = await client.DownloadStringTaskAsync(...); fallacies = ParseCsvContent(csvContent); }
  • Head L133-135 : csvContent = await _httpClient.GetStringAsync(...); fallacies = ParseCsvContent(csvContent);
  • 0 résidu WebClient au head (grep WebClient|DownloadString = 0 hit sur le fichier au head).
  • private static readonly HttpClient _httpClient (L25) au niveau classe = pattern recommandé (une instance réutilisée, évite l'épuisement des sockets), using System.Net.Http; ajouté (L4).
  • Méthode LoadTaxonomyData toujours async Task<List<Fallacy>> (L106) → await valide.
  • Branche locale (fichier non-http, L147) intacteParseCsvContent préservée des deux côtés.

Comportement inchangé : téléchargement string puis parse, l'unique call site GenerateTranslationCoverageReport (L74) inchangé.

△ Nit non-bloquant : GetStringAsync sans CancellationToken/timeout — mais WebClient n'en avait pas non plus (parité 1:1 stricte), et c'est du code de test (récupération taxonomy CSV http). Pas de régression.

Corroboration test count : body claim « 578 pass / 1 fail OWL #133 / 5 skip » = matche ma validation firsthand du 04/07 (#689, même projet Argumentum.AssetConverter, 578 empirique). Honnête le flag SGEN/MSB3073 deferred (tooling build-time, pas source-level CS, hors-scope release freeze).

Dispatch ka7vl5 TERTIAIRE, scope non-Cards respecté (release freeze). Clean fix racine un warning CS résiduel.

@jsboige
jsboige merged commit 02f7033 into master Jul 5, 2026
3 checks passed
@jsboige
jsboige deleted the fix/syslib0014-webclient-httpclient branch July 5, 2026 17:09
jsboige added a commit that referenced this pull request Jul 5, 2026
…tag lane (gated) (#710)

Plan-only doc for the post-v0.9.0-tag tech-debt lane dispatched by ai-01 (awhj8g tertiaire):
"documente le plan nullable-cleanup Tests/ (CS86xx) en docs/repo/, plan gated, PAS d'exécution
pendant freeze."

Empirical inventory on master 34c7702 (dotnet build Tests.csproj --no-incremental): 96 source-level
warnings across 20 files. Breakdown:
- CS8625 (22) null-to-non-nullable
- CS8618 (20) non-nullable property uninitialized
- CS8602 (16) possible-null dereference
- CS8620 (14) null to generic type param
- CS8600 (6), CS8619 (4), CS8604 (4), CS8603 (2), CS8605 (2) nullable-flow
- CS0108 (4) member hiding, CS0219 (2) dead store
By category: 90 nullable-flow (CS86xx) + 4 hiding + 2 dead-store. Top files: UpdateTableFromRecordsTests
(20), PdfAlternateFaceAndBackContractTests (14) — 35% of total.

Recommended approach: 3 slices, smallest-blast-radius first, each a separate PR with full test
re-run after (a wrong ? annotation on a test entity can silently change CsvHelper behavior — the
exact fragility CLAUDE.md documents):
- Slice A (CS0108+CS0219, 6 warnings): mechanical, ~15 min, 1 PR.
- Slice B (CS8618, 20): constructor-init, ?/= null!/required case-by-case, ~1h, ~3 PRs.
- Slice C (CS86xx flow, 70): assertion/arrange judgment, ~3-4h, ~8-10 PRs.
Estimated total ~5h, ~12-14 PRs, spread across post-tag idle ticks.

Explicit NONOS:
- No <Nullable>enable</Nullable> project-wide flip (would surface hundreds of SUT warnings,
  exploding blast radius).
- No blanket #pragma warning disable (hides the signal).

Why not during freeze: risk of silently changing test behavior (CsvHelper null/missing-field
distinction), low value for v0.9.0 (warnings pre-existing, don't block build, don't affect assets).
Bundle with the SGEN/MSB3073 tooling warning deferred from PR #706 in the same post-tag window.

Plan-only: 0 code change, 0 build, 0 test run. Reproducible via dotnet build on 34c7702.

Dispatch awhj8g (TERTIAIRE). Base 34c7702.

Co-authored-by: Your <your.email@example.com>
Co-authored-by: Claude-Code <noreply@anthropic.com>
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