fix(build): replace obsolete WebClient with HttpClient (SYSLIB0014) — zéro-warning résiduel - #706
Conversation
… 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
left a comment
There was a problem hiding this comment.
[NanoClaw] — LGTM (COMMENT only, décision merge = Emerjesse)
Correctif byte-vérifié firsthand au head d1a663be (vs base 70bd1605) :
SYSLIB0014 était RÉEL sur base — Tests/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
LoadTaxonomyDatatoujoursasync Task<List<Fallacy>>(L106) →awaitvalide. - Branche locale (fichier non-http, L147) intacte —
ParseCsvContentpré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.
…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>
fix(build): replace obsolete
WebClientwithHttpClient(SYSLIB0014)Base:
70bd1605· Dispatch:ka7vl5(TERTIAIRE — zéro-warning résiduel lane) · Scope: non-Cards (release freeze is onCards/only).The warning
TranslationCoverageReport.LoadTaxonomyDatausednew System.Net.WebClient()+DownloadStringTaskAsyncto fetch the taxonomy CSV from an http URL.WebClientis obsolete since .NET 6 (SYSLIB0014: useHttpClient). 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.The fix
Static readonly
HttpClientfield (the recommended pattern —HttpClientis meant to be instantiated once and reused; per-use instantiation risks socket exhaustion under load) +GetStringAsync. The enclosing method is alreadyasync Task<List<Fallacy>>, so the swap is a 1:1 behavioral equivalent (download a string from a URL, thenParseCsvContent).Behavior: unchanged. The http branch still downloads then parses; the local-file branch is untouched.
Verification
dotnet build→ no SYSLIB0014 remains (grep on build output: empty).dotnet test→ 578 pass / 1 fail (pre-existing OWL feat(ontology): Publish OWL ontology to public endpoint #133 known-fail, unrelated) / 5 skip / 584 total — baseline preserved (leçon: empiricaldotnet test, not a doc claim).Remaining warning (NOT fixed here — flagged)
This is a build-time tooling warning (sgen config /
XmlSerializergeneration), not a source-level CS warning, and fixing it is build-config territory (likely: review whether theMicrosoft.XmlSerializer.Generatorpackage 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
Cards/write (release freeze).Relates to #587 (zéro-warning), dispatch
ka7vl5TERTIAIRE. Base70bd1605.🤖 Generated with Claude Code