Avoid Microsoft.Bcl.Memory on modern .NET targets - #7703
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The TFM additions and conditional dependency updates are consistent with central package management and are scoped to preserve netstandard2.0 while removing Microsoft.Bcl.Memory from modern targets.
Pull request overview
This PR updates packaging/TFM targeting to keep .NET Standard 2.0 compatibility while avoiding Microsoft.Bcl.Memory in modern dependency graphs by adding net8.0 targets and scoping the Microsoft.Bcl.Memory reference to legacy TFMs only.
Changes:
- Multi-target several packages/projects with
netstandard2.0;net8.0to produce modern TFMs and reduce legacyMicrosoft.Bcl.*dependencies for modern consumers. - Restrict
Microsoft.Bcl.Memoryusage inMicrosoft.ML.TorchSharptonetstandard2.0only, and bump the centrally-managed version to9.0.14. - Add an explicit
System.Text.Jsonpackage reference toMicrosoft.ML.AutoMLto keep the dependency explicit after dependency-graph reshaping.
File summaries
| File | Description |
|---|---|
| src/Microsoft.ML.TorchSharp/Microsoft.ML.TorchSharp.csproj | Adds net8.0 TFM and conditions Microsoft.Bcl.Memory to netstandard2.0 only. |
| src/Microsoft.ML.Tokenizers.Data.R50kBase/Microsoft.ML.Tokenizers.Data.R50kBase.csproj | Adds net8.0 targeting to remove legacy-only dependency impact for modern consumers. |
| src/Microsoft.ML.Tokenizers.Data.P50kBase/Microsoft.ML.Tokenizers.Data.P50kBase.csproj | Adds net8.0 targeting for modern dependency graphs. |
| src/Microsoft.ML.Tokenizers.Data.O200kBase/Microsoft.ML.Tokenizers.Data.O200kBase.csproj | Adds net8.0 targeting for modern dependency graphs. |
| src/Microsoft.ML.Tokenizers.Data.Gpt2/Microsoft.ML.Tokenizers.Data.Gpt2.csproj | Adds net8.0 targeting for modern dependency graphs. |
| src/Microsoft.ML.Tokenizers.Data.Cl100kBase/Microsoft.ML.Tokenizers.Data.Cl100kBase.csproj | Adds net8.0 targeting for modern dependency graphs. |
| src/Microsoft.ML.Fairlearn/Microsoft.ML.Fairlearn.csproj | Adds net8.0 targeting to reduce legacy-only dependency impact for modern consumers. |
| src/Microsoft.ML.CodeGenerator/Microsoft.ML.CodeGenerator.csproj | Adds net8.0 targeting to avoid legacy-only dependency impact for modern consumers. |
| src/Microsoft.ML.AutoML/Microsoft.ML.AutoML.csproj | Adds net8.0 targeting and explicitly references System.Text.Json. |
| eng/Versions.props | Updates the centrally-managed Microsoft.Bcl.Memory version to 9.0.14. |
Review details
- Files reviewed: 10/10 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7703 +/- ##
=======================================
Coverage 69.88% 69.89%
=======================================
Files 1487 1487
Lines 276253 276253
Branches 28291 28291
=======================================
+ Hits 193053 193077 +24
+ Misses 75710 75685 -25
- Partials 7490 7491 +1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Summary
Remove
Microsoft.Bcl.Memoryfrom modern .NET dependency graphs while keeping .NET Standard 2.0 support.net8.0targets to the five Tokenizers.Data packages, TorchSharp, AutoML, CodeGenerator, and Fairlearn.Microsoft.Bcl.Memoryreference only fornetstandard2.0, and update the shared version to the patched9.0.14.System.Text.Jsonreference to AutoML. AutoML and its bundled SearchSpace assembly still need this dependency after it stops arriving through Tokenizers.Fixes #7589. Contributes to #7590; this change addresses
Microsoft.Bcl.Memory, not everyMicrosoft.Bcl.*package.Validation
netstandard2.0andnet8.0, with package validation enabled.netstandard2.0,net8.0, andnet10.0with zero warnings or errors. The modern graphs contain noMicrosoft.Bcl.Memory; the legacy graph selects9.0.14.Existing published package versions are unchanged. A new release is required to deliver the fix to consumers.