Repository navigation
[build] Exclude SourceLink runtime assets to pin System.IO.Hashing - #12034
Merged
Merged
Conversation
Microsoft.SourceLink.GitHub is a build-time only package (PrivateAssets="All"), but in 10.x its Microsoft.Build.Tasks.Git dependency pulls System.IO.Hashing in as a *runtime* asset (e.g. 10.0.300 -> 10.0.8). Projects that reference System.IO.Hashing only transitively would then ship that version into the SDK pack's `tools/` directory, where it collides with the pinned $(SystemIOHashingPackageVersion) the build tasks are compiled against (System.IO.Hashing bumps its AssemblyVersion every patch: 10.0.0.8 vs 10.0.0.9), producing an XACRP7000 MissingMethodException on System.IO.Hashing.Crc64.Hash at build time. Add ExcludeAssets="runtime" to the repo-wide SourceLink reference so it can never contribute a floating System.IO.Hashing. Source linking is unaffected (it runs via SourceLink's build assets). This mirrors the pin already present in external/Java.Interop/Directory.Build.targets and future-proofs the main repo against a SourceLink bump to 10.x. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 527f04b6-c95a-4a66-b90f-4c52ba5496f3
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the repo’s SourceLink configuration to prevent Microsoft.SourceLink.GitHub from ever contributing transitive runtime assets (notably System.IO.Hashing) into SDK/tool outputs, avoiding System.IO.Hashing assembly version mismatches that can surface as XACRP7000/MissingMethodException during app builds.
Changes:
- Add
ExcludeAssets="runtime"to the repo-wideMicrosoft.SourceLink.GitHubPackageReferenceinDirectory.Build.targets. - Add an explanatory comment documenting the
System.IO.Hashingtransitive runtime-asset failure mode and noting parity withexternal/Java.Interop/Directory.Build.targets.
Show a summary per file
| File | Description |
|---|---|
| Directory.Build.targets | Excludes SourceLink runtime assets repo-wide (while keeping build assets) to prevent transitive System.IO.Hashing runtime DLLs from flowing into SDK/tool outputs. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
jonathanpeppers
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Microsoft.SourceLink.GitHubis a build-time-only package (PrivateAssets="All"), but in its 10.x line itsMicrosoft.Build.Tasks.Gitdependency pullsSystem.IO.Hashingin as a runtime asset (e.g.Microsoft.Build.Tasks.Git 10.0.300→System.IO.Hashing 10.0.8). Any project that referencesSystem.IO.Hashingonly transitively then ships that version into the .NET for Android SDK pack'stools/directory, where it collides with the pinned$(SystemIOHashingPackageVersion)(currently10.0.9) that the build tasks are compiled against.Because
System.IO.Hashingbumps itsAssemblyVersionevery patch (10.0.0.8vs10.0.0.9), the mismatched assembly produces a hardXACRP7000/MissingMethodException: System.IO.Hashing.Crc64.Hash(...)at app build time.Fix
Add
ExcludeAssets="runtime"to the repo-wideMicrosoft.SourceLink.GitHubreference in the rootDirectory.Build.targets, so SourceLink can never contribute a floatingSystem.IO.Hashingruntime asset. Source linking is unaffected — it runs via SourceLink's build assets, which are untouched.This mirrors the pin already present in
external/Java.Interop/Directory.Build.targets(which fixed the same float forclass-parse/jcw-gen/generatorafter those hit it).Why now (future-proofing)
The main repo currently references SourceLink 8.0.0, whose
Microsoft.Build.Tasks.Git 8.0.0does not depend onSystem.IO.Hashing— so the float isn't active onmaintoday. But the moment the repo bumps SourceLink to 10.x (as Java.Interop already has), the transitiveSystem.IO.Hashing 10.0.8would reappear and reintroduce theXACRP7000failures. This tiny, precedent-matching pin makes the repo robust against that regression.Verification
dotnet restoresucceeds;System.IO.Hashingstill resolves to the pinned10.0.9.ExcludeAssets="runtime"only excludes runtime assets — SourceLink's build/targets assets (which perform source linking) are unaffected.