Skip to content

[NativeAot] System.IO.Hashing versions conflict #10606

@tranb3r

Description

@tranb3r

Android framework version

36.x

Affected platform version

VS 2026

Description

When using System.IO.Hashing 10.0.0 in an app and building it with NativeAot, the build fails with an exception caused by multiple versions of System.IO.Hashing being used.
This is probably caused by System.IO.Hashing version pin to 9.0.4: #10043

Steps to Reproduce

  • dotnet new maui -n TestNativeAOT
  • cd TestNativeAOT
  • dotnet add package System.IO.Hashing => should add 10.0.0 version
  • dotnet build -bl -f net10.0-android -c Release -r android-arm64 -p:PublishAot=true

Did you find any workaround?

When using package version 9.0.4 instead of 10.0.0 in the app, there is no exception.

Relevant log output

C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\36.1.2\tools\Xamarin.Android.Common.targets(1498,3): error XAAMP7004:
  System.ArgumentException: An item with the same key has already been added. Key: System.IO.Hashing
     at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
     at Xamarin.Android.Tasks.MonoAndroidHelper.GetPerArchAssemblies(IEnumerable`1 input, HashSet`1 supportedTargetArches, Boolean validate, Func`2 shouldSkip)
     at Xamarin.Android.Tasks.MonoAndroidHelper.GetPerArchAssemblies(IEnumerable`1 input, ICollection`1 supportedAbis, Boolean validate, Func`2 shouldSkip)
     at Xamarin.Android.Tasks.AssemblyModifierPipeline.RunTask()
     at Microsoft.Android.Build.Tasks.AndroidTask.Execute()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: App+Library BuildIssues when building Library projects or Application projects.Area: NativeAOTIssues that only occur when using NativeAOT.bugComponent does not function as intended.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions