[cDAC] Multi-target managed reader to net8.0/net9.0/net10.0#129008
[cDAC] Multi-target managed reader to net8.0/net9.0/net10.0#129008max-charlamb wants to merge 1 commit into
Conversation
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Changes TargetFramework -> TargetFrameworks on the cDAC managed reader
projects so the shipped NuGet packages can be consumed by diagnostic
tools running on older shipped runtimes (net8.0, net9.0, net10.0) in
addition to $(NetCoreAppToolCurrent):
Microsoft.Diagnostics.DataContractReader[.Abstractions|.Contracts|.Legacy]
Microsoft.Diagnostics.DataContractReader.TestInfrastructure
Microsoft.Diagnostics.DataContractReader.Tests
Source-level downlevel compatibility fixes:
- Directory.Build.props: gate ExperimentalAttribute injection to net9+
(the attribute type does not exist on net8).
- X86Unwinder.cs: replace `ReadOnlySpan.Reverse()` LINQ usage with a
manual reverse loop (LINQ Reverse on ReadOnlySpan is net9+).
- ClrDataModule.cs + MetaDataImportImplTests.cs: use
`Marshal.QueryInterface(..., ref Guid, ...)` and suppress CS9191;
the `in Guid` overload is net9+.
- DumpInfo.cs: gate `Architecture.RiscV64` / `LoongArch64` to
net9+ (enum members added in net9).
- LayoutSetSource.cs / Emitter.cs: drop `params ReadOnlySpan<T>` and
emit collection-expression call sites; `params ROS` requires
C# 13 / net9.
- SOSDacImpl.cs / ISOSDacInterface.cs: rename `vtable` parameter to
`vtableAddr` to avoid downlevel codegen ambiguity.
- Tests.csproj: split mscordaccore_universal vs Legacy ProjectReference
by TFM (universal is NAOT-published only at NetCoreAppToolCurrent).
76bcb5f to
e3bb85d
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the managed cDAC reader (and its test infrastructure) to multi-target net8.0, net9.0, net10.0, and $(NetCoreAppToolCurrent), and applies small source-compatibility changes so the codebase compiles across those TFMs.
Changes:
- Multi-target several cDAC projects (product + test infra/tests) to
$(NetCoreAppToolCurrent);net10.0;net9.0;net8.0. - Gate or rewrite API usages that are not available on
net8.0(e.g.,ExperimentalAttributeinjection,ReadOnlySpanLINQReverse,Marshal.QueryInterfaceoverload selection,Architectureenum members). - Update generator-emitted callsites and helper APIs to avoid
params ReadOnlySpan<T>and to emit collection-expression-style arguments.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/native/managed/cdac/tests/UnitTests/Microsoft.Diagnostics.DataContractReader.Tests.csproj | Multi-target unit tests and conditionally reference mscordaccore_universal vs Legacy by TFM. |
| src/native/managed/cdac/tests/UnitTests/MetaDataImportImplTests.cs | Use Marshal.QueryInterface(..., ref Guid, ...) with CS9191 suppression for net8 compatibility. |
| src/native/managed/cdac/tests/TestInfrastructure/Microsoft.Diagnostics.DataContractReader.TestInfrastructure.csproj | Multi-target reusable test infrastructure library. |
| src/native/managed/cdac/tests/TestInfrastructure/DumpInfo.cs | Gate Architecture.RiscV64/LoongArch64 usage behind NET9_0_OR_GREATER. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader/Microsoft.Diagnostics.DataContractReader.csproj | Multi-target main DataContractReader project. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/SOSDacImpl.cs | Rename parameter in ISOSDacInterface.GetFrameName implementation to match interface change. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/Microsoft.Diagnostics.DataContractReader.Legacy.csproj | Multi-target Legacy project. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ISOSDacInterface.cs | Renames GetFrameName parameter (vtable → vtableAddr). |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Legacy/ClrDataModule.cs | Use Marshal.QueryInterface(..., ref Guid, ...) with CS9191 suppression for net8 compatibility. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Microsoft.Diagnostics.DataContractReader.Contracts.csproj | Multi-target Contracts project. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/Context/X86/X86Unwinder.cs | Replace LINQ Reverse() enumeration with a manual reverse loop. |
| src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Abstractions/Microsoft.Diagnostics.DataContractReader.Abstractions.csproj | Multi-target Abstractions project (and continue packing the generator analyzer). |
| src/native/managed/cdac/gen/LayoutSetSource.cs | Remove params ReadOnlySpan<string> from generated LayoutSet APIs. |
| src/native/managed/cdac/gen/Emitter.cs | Update generator output to pass name candidates as collection expressions (matching the ReadOnlySpan<string> signature). |
| src/native/managed/cdac/Directory.Build.props | Gate ExperimentalAttribute assembly attribute injection to net9+ TFMs. |
| // Frames | ||
| [PreserveSig] | ||
| int GetFrameName(ClrDataAddress vtable, uint count, char* frameName, uint* pNeeded); | ||
| int GetFrameName(ClrDataAddress vtableAddr, uint count, char* frameName, uint* pNeeded); |
|
Is SOS the only intended target for this or are there other tools you had in mind? SOS needs to be runnable against .NET Framework so downlevel targetting to 8 wouldn't be enough for that one. Multi-targetting will increase our build and test times so I'd only suggest we do it if we've got specific tool scenarios that need an older TFM. |
Note
This PR description was drafted with assistance from GitHub Copilot.
Multi-targets the cDAC managed reader transport packages so the published NuGets can be consumed by diagnostic tools running on older shipped runtimes (
net8.0,net9.0,net10.0) in addition to$(NetCoreAppToolCurrent).Projects changed to multi-target
Microsoft.Diagnostics.DataContractReaderMicrosoft.Diagnostics.DataContractReader.AbstractionsMicrosoft.Diagnostics.DataContractReader.ContractsMicrosoft.Diagnostics.DataContractReader.LegacyMicrosoft.Diagnostics.DataContractReader.TestInfrastructureMicrosoft.Diagnostics.DataContractReader.Testsmscordaccore_universaland the dump/host harnesses remain single-target at$(NetCoreAppToolCurrent).Downlevel source-compatibility fixes
ExperimentalAttributeinjection to net9+ (type does not exist on net8).ReadOnlySpan.Reverse()LINQ with a manual reverse loop (LINQReverseonReadOnlySpanis net9+).Marshal.QueryInterface(..., ref Guid, ...)and suppress CS9191 (thein Guidoverload is net9+).Architecture.RiscV64/LoongArch64to net9+ (enum members added in net9).params ReadOnlySpan<T>and emit collection-expression call sites (params ROSrequires C# 13 / net9).vtableparameter tovtableAddrto avoid downlevel codegen ambiguity.mscordaccore_universalvsLegacyProjectReferenceby TFM (universal is NAOT-published only at$(NetCoreAppToolCurrent)).