Jens-G opened a new pull request, #3477:
URL: https://github.com/apache/thrift/pull/3477

   ## Summary
   
   Two netstd code-generator bugs found and fixed during a codegen test run
   against all 201 Thrift IDL files in the repository (603 test executions
   across net8/net9/net10 — all passing after these fixes).
   
   ### THRIFT-5997 — `binary` and `uuid` consts must use `static readonly`
   
   C# does not permit `const` for `byte[]` (Thrift `binary`) or `System.Guid`
   (Thrift `uuid`). The generator unconditionally emitted `public const` for
   all base types, producing CS0283/CS0134 compile errors for any IDL file
   containing a `const binary` or `const uuid` field.
   
   **Fix:** check the base type before emitting `const`; fall back to
   `public static readonly` (or `public static` on older targets).
   
   This commit also improves the netstd codegen test script:
   - Fix cross-platform path handling (use `Path::Combine` throughout)
   - Auto-detect cmake-built thrift compiler (`cmake_build_compiler/`)
   - Expand `NET_VERSIONS` to `@("net8", "net9", "net10")`
   - Reduce `FAIL_THRIFT` / `KNOWN_BUGS` to accurately reflect current state
   
   ### THRIFT-5998 — duplicate extension methods from included programs (CS0121)
   
   When a Thrift IDL file included another, `collect_extensions_types()`
   recursed into structs from the included program. This caused the same
   container extension methods (`DeepCopy`, `Equals`, `GetHashCode`) to be
   emitted in both the including and the included file's `*Extensions.cs`,
   producing CS0121 "ambiguous call" errors at C# compile time.
   
   **Fix:** stop recursion at the program boundary. Each program's generator
   only walks its own structs; the included program's generator handles its
   own internal container types.
   
   ## Test plan
   
   - [x] 201 × 3 (net8/net9/net10) = 603 codegen + compile + exec tests — all 
pass
   - [x] Verified on Linux with pwsh, dotnet SDK, and cmake-built thrift 
compiler
   
   🤖 Generated with [Claude Code](https://claude.ai/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to