dotnet / android-libraries

.NET for Android bindings for Google's libraries, such as AndroidX, GooglePlayServices, Firebase, and MLKit and their 3rd party dependency libraries.
MIT License
231 stars 50 forks source link

Project Build fails at Cecilify Step After Upgrading Microsoft.Extension.* Nugets #215

Closed adamhill closed 2 years ago

adamhill commented 3 years ago

Version Information

Describe your Issue:

We have had our project migrated to AndroidX for a while. Many App Store releases. While upgrading some Microsoft.Extension Nugets, I now get an error at the Cecilify step when compiling for Android. (iOS is building fine)

Steps to Reproduce (with link to sample solution if possible):

Upgraded the Microsoft.Extension.* hierarchy, via Nuget Package Manager (not the command line) to 5.0.0

Note If I back out Extensions.DependencyInjection to the original v3.1.5, with its dependencies as determained by Nuget. It will compile again.

Include any relevant Exception Stack traces, build logs, adb logs:

Failed to resolve assembly: 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.1.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'   at Mono.Cecil.BaseAssemblyResolver.Resolve(AssemblyNameReference name, ReaderParameters parameters)   at Mono.Cecil.DefaultAssemblyResolver.Resolve(AssemblyNameReference name)   at Mono.Cecil.MetadataResolver.Resolve(TypeReference type)   at Mono.Cecil.TypeReference.Resolve()   at Mono.Cecil.Mixin.CheckedResolve(TypeReference self)   at Mono.Cecil.MetadataBuilder.GetConstantType(TypeReference constant_type, Object constant)   at Mono.Cecil.MetadataBuilder.AddConstant(IConstantProvider owner, TypeReference type)   at Mono.Cecil.MetadataBuilder.AddParameter(UInt16 sequence, ParameterDefinition parameter, ParamTable table)   at Mono.Cecil.MetadataBuilder.AddParameters(MethodDefinition method)   at Mono.Cecil.MetadataBuilder.AddMethod(MethodDefinition method)   at Mono.Cecil.MetadataBuilder.AddMethods(TypeDefinition type)   at Mono.Cecil.MetadataBuilder.AddType(TypeDefinition type)   at Mono.Cecil.MetadataBuilder.AddTypes()   at Mono.Cecil.MetadataBuilder.BuildTypes()   at Mono.Cecil.MetadataBuilder.BuildModule()   at Mono.Cecil.MetadataBuilder.BuildMetadata()   at Mono.Cecil.ModuleWriter.<>c.<BuildMetadata>b__2_0(MetadataBuilder builder, MetadataReader _)   at Mono.Cecil.ModuleDefinition.Read[TItem,TRet](TItem item, Func3 read)   at Mono.Cecil.ModuleWriter.BuildMetadata(ModuleDefinition module, MetadataBuilder metadata)   at Mono.Cecil.ModuleWriter.Write(ModuleDefinition module, Disposable1 stream, WriterParameters parameters)   at Mono.Cecil.ModuleWriter.WriteModule(ModuleDefinition module, Disposable1 stream, WriterParameters parameters)   at Mono.Cecil.ModuleDefinition.Write(Stream stream, WriterParameters parameters)   at Mono.Cecil.ModuleDefinition.Write(WriterParameters parameters)   at Xamarin.AndroidX.Migration.CecilMigrator.Migrate(String source, String destination)   at Xamarin.AndroidX.Migration.CecilMigrator.Migrate(IEnumerable`1 assemblies)   at Xamarin.AndroidX.Migration.BuildTasks.CecilfyFiles.Execute()

'

jpobst commented 3 years ago

Sounds like one of your referenced assemblies is compiled against Microsoft.Extensions.DependencyInjection 3.1.5. One option would be to find that assembly and compile it against the update DependencyInjection assembly.

I don't know what options are available for controlling the migration process. @mattleibow is there any workaround for this?

adamhill commented 3 years ago

Is there any tool or script that I can spelunk with? Will the the Nuget Manager tell me in the Dependencies section if I click on them one at a time?

moljac commented 3 years ago

And (looking at packages.config):

  1. migrate packages.config to ProjectReferences (nuget dependencies handling is better)
  2. get rid of AndroidSupport packages (mixing will most likely cause problems)
  3. try bumping GPS-FB to 1xx versions instead of 71.xxx

these steps will keep you safe from headaches in the future. Otherwise you will come here more and more often...

jpobst commented 2 years ago

AndroidX Migration tooling has been deprecated. It is highly recommended that you complete the migration to AndroidX if you have not.

We will no longer be providing updates or support to the AndroidX Migration tooling.