[build] Drop unused protobuf-net references from Mono.AndroidTools#11592
Open
jonathanpeppers wants to merge 1 commit into
Open
[build] Drop unused protobuf-net references from Mono.AndroidTools#11592jonathanpeppers wants to merge 1 commit into
jonathanpeppers wants to merge 1 commit into
Conversation
PR #11529 inlined `Mono.AndroidTools` from android-platform-support, which carried PackageReferences to `protobuf-net` 3.2.26 and `protobuf-net.Core` 3.2.26. The original consumer of these packages was the native `tools/base/deploy/installer` binary, which was removed in the same PR. None of the inlined managed code (`Mono.AndroidTools`, `Xamarin.AndroidTools`, `Xamarin.Installer.*`, `Xamarin.Android.Build.Debugging.Tasks`) actually uses the `ProtoBuf` namespace, `[ProtoContract]` / `[ProtoMember]` attributes, or `Serializer.*` calls — so the references are dead weight. More importantly, they were actively breaking `class-parse`'s Kotlin metadata parsing. `Mono.AndroidTools.csproj` outputs to `MicrosoftAndroidSdkOutDir`, where it dropped a v3 `protobuf-net.dll` (a thin facade) that overwrote the v2 self-contained DLL shipped by Java.Interop's `Xamarin.Android.Tools.Bytecode`. Because `protobuf-net.Core.dll` is not packed into the SDK pack, `class-parse` failed at runtime with `FileNotFoundException: Could not load file or assembly 'protobuf-net.Core, Version=3.0.0.0...'`, and `KotlinFixups.Fixup` silently skipped Kotlin metadata. Bindings then regenerated unsigned types as their signed counterparts, breaking `KotlinUnsignedTypesTests.cs` with CS1503/CS0266 errors. Drop the v3 references from `Mono.AndroidTools.csproj` and the now-unused `ProtobufNetVersion` / `ProtobufNetCoreVersion` properties from `Directory.Build.props`. The v2 `protobuf-net.dll` from Java.Interop's class-parse becomes the only one in `MicrosoftAndroidSdkOutDir`, restoring Kotlin metadata parsing. The existing `_MSBuildFiles Include=...protobuf-net.dll` and `SignList.xml` `ThirdParty` entry (added in #5529) continue to ship the v2 DLL into the SDK pack. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Removes unused protobuf-net v3 package references from the inlined Mono.AndroidTools project to avoid polluting $(MicrosoftAndroidSdkOutDir) with an incompatible protobuf-net.dll, restoring class-parse runtime behavior (Kotlin metadata parsing) and preventing downstream binding/test failures.
Changes:
- Dropped
protobuf-net/protobuf-net.CorePackageReferences fromsrc/Mono.AndroidTools/Mono.AndroidTools.csproj, along with the corresponding Release-onlyNuGetFilesToSignentries. - Removed the now-dead
ProtobufNetVersion/ProtobufNetCoreVersionproperties fromDirectory.Build.props. - Verified via repository search that no other MSBuild files still reference these removed properties or packages.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Mono.AndroidTools/Mono.AndroidTools.csproj | Removes unused protobuf-net v3 package references and related signing inputs so the project no longer outputs the conflicting facade DLL into the SDK tools output directory. |
| Directory.Build.props | Deletes unused protobuf-net version properties after removing the only consumer. |
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
PR #11529 inlined
Mono.AndroidToolsfromandroid-platform-support, which carriedPackageReferences toprotobuf-net3.2.26 andprotobuf-net.Core3.2.26. The original consumer of these packages was the nativetools/base/deploy/installerbinary, which was removed in the same PR. None of the inlined managed code (Mono.AndroidTools,Xamarin.AndroidTools,Xamarin.Installer.*,Xamarin.Android.Build.Debugging.Tasks) actually uses theProtoBufnamespace,[ProtoContract]/[ProtoMember]attributes, orSerializer.*calls — so the references are dead weight.The actual bug
The unused references were also breaking
class-parse's Kotlin metadata parsing on every PR build:…manifesting downstream as:
Mono.AndroidTools.csprojoutputs to$(MicrosoftAndroidSdkOutDir), where it dropped a v3protobuf-net.dll(a thin facade) that overwrote the v2 self-contained DLL shipped by Java.Interop'sXamarin.Android.Tools.Bytecode(pinned toprotobuf-net2.4.4). Becauseprotobuf-net.Core.dllwas never added to the SDK pack file lists inbuild-tools/installers/create-installers.targetsorMicrosoft.Android.Sdk.proj,class-parsefailed at runtime andKotlinFixups.Fixupsilently skipped Kotlin metadata. Bindings then regenerated unsigned types as their signed counterparts, breaking the hand-writtenKotlinUnsignedTypesTests.cs.Fix
Drop the v3 references from
src/Mono.AndroidTools/Mono.AndroidTools.csproj(both thePackageReferences and the dependentNuGetFilesToSigngroup), and the now-unusedProtobufNetVersion/ProtobufNetCoreVersionproperties fromDirectory.Build.props. The v2protobuf-net.dllfrom Java.Interop's class-parse becomes the onlyprotobuf-net.dllin$(MicrosoftAndroidSdkOutDir)again, restoring Kotlin metadata parsing.The existing entries that ship the v2 DLL into the SDK pack —
_MSBuildFiles Include="$(MicrosoftAndroidSdkOutDir)protobuf-net.dll"inbuild-tools/installers/create-installers.targetsand<ThirdParty Include="protobuf-net.dll" />inbuild-tools/create-packs/SignList.xml, both added by #5529 — continue to do their job.Verification
src/Mono.AndroidToolsand all transitive consumers: zero usage ofusing ProtoBuf,[Proto*]attributes, orSerializer.*calls.dotnet restore src/Mono.AndroidTools/Mono.AndroidTools.csprojcompletes cleanly with no transitive protobuf-net resolution.KotlinUnsignedTypesTests.csshould compile and pass onceclass-parsecan again deserialize Kotlin metadata.