MvvmCross 4.1 upgrade issue IsFragmentCacheable no

2019-07-23 10:02发布

问题:

Getting a compilation error after upgrade to mvvmcross 4.1 in Linker task:

The "LinkAssemblies" task failed unexpectedly. Xamarin.Android.XamarinAndroidException: error XA2006: Reference to metadata item 'System.Boolean MvvmCross.Droid.Shared.Attributes.MvxFragmentAttributeExtensionMethods::IsFragmentCacheable(System.Type)' (defined in 'MvvmCross.Droid.Support.V7.Fragging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') from 'MvvmCross.Droid.Support.V7.Fragging, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' could not be resolved. ---> Mono.Cecil.ResolutionException: Failed to resolve System.Boolean MvvmCross.Droid.Shared.Attributes.MvxFragmentAttributeExtensionMethods::IsFragmentCacheable(System.Type) at Mono.Linker.Steps.MarkStep.MarkMethod(MethodReference reference) at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction) at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body) at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method) at Mono.Linker.Steps.MarkStep.ProcessQueue() at Mono.Linker.Steps.MarkStep.Process() at Mono.Linker.Steps.MarkStep.Process(LinkContext context) at Mono.Linker.Pipeline.Process(LinkContext context) at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context) at Xamarin.Android.Tasks.LinkAssemblies.Execute() --- End of inner exception stack trace --- at Xamarin.Android.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args) at Xamarin.Android.Tasks.LinkAssemblies.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()

What could be the reason for it? All referenced assemblies are updated to 4.1.

回答1:

You should remove the MvvmCross.Droid.Support.V7.Fragging package since this is included in MvvmCross.Droid.Support.V4 now.

After that update your namespaces, and the app will work again!