Skip to content

Commit

Permalink
[tests] repro breaking change with System.Drawing.Common
Browse files Browse the repository at this point in the history
This test fails to build with:

    The "LinkAssemblies" task failed unexpectedly.

    Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'System.Drawing.Color' (defined in assembly 'Acr.UserDialogs.Interface, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null') with scope 'Splat, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve System.Drawing.Color
    at Mono.Linker.Steps.MarkStep.HandleUnresolvedType (Mono.Cecil.TypeReference reference) [0x0001a] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at Mono.Linker.Steps.MarkStep.MarkType (Mono.Cecil.TypeReference reference) [0x00055] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at MonoDroid.Tuner.MonoDroidMarkStep.MarkType (Mono.Cecil.TypeReference reference) [0x00001] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at Mono.Linker.Steps.MarkStep.MarkGenericArguments (Mono.Cecil.IGenericInstance instance) [0x00018] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at Mono.Linker.Steps.MarkStep.GetOriginalType (Mono.Cecil.TypeReference type) [0x00013] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at Mono.Linker.Steps.MarkStep.MarkType (Mono.Cecil.TypeReference reference) [0x00010] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at MonoDroid.Tuner.MonoDroidMarkStep.MarkType (Mono.Cecil.TypeReference reference) [0x00001] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at Mono.Linker.Steps.MarkStep.MarkField (Mono.Cecil.FieldReference reference) [0x00058] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at Mono.Linker.Steps.MarkStep.InitializeFields (Mono.Cecil.TypeDefinition type) [0x00028] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at Mono.Linker.Steps.MarkStep.InitializeType (Mono.Cecil.TypeDefinition type) [0x0006f] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at Mono.Linker.Steps.MarkStep.InitializeAssembly (Mono.Cecil.AssemblyDefinition assembly) [0x00034] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at Mono.Linker.Steps.MarkStep.Initialize () [0x00016] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at Mono.Linker.Steps.MarkStep.Process (Mono.Linker.LinkContext context) [0x00008] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at MonoDroid.Tuner.MonoDroidMarkStep.Process (Mono.Linker.LinkContext context) [0x0000d] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at Mono.Linker.Pipeline.ProcessStep (Mono.Linker.LinkContext context, Mono.Linker.Steps.IStep step) [0x0000f] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00011] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at MonoDroid.Tuner.Linker.Run (Mono.Linker.Pipeline pipeline, Mono.Linker.LinkContext context) [0x00001] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at MonoDroid.Tuner.Linker.Process (MonoDroid.Tuner.LinkerOptions options, Mono.Linker.ILogger logger, Mono.Linker.LinkContext& context) [0x0007c] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at Xamarin.Android.Tasks.LinkAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x0030c] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    --- End of inner exception stack trace ---
    at Java.Interop.Tools.Diagnostics.Diagnostic.Error (System.Int32 code, System.Exception innerException, System.String message, System.Object[] args) [0x0000a] in <8df3e814509d4dc7bbff2ee4d062e14e>:0
    at Xamarin.Android.Tasks.LinkAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver res) [0x004cf] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at Xamarin.Android.Tasks.LinkAssemblies.Execute () [0x0001e] in <aa2861304e8349a69bf6f3dda2b1b5bd>:0
    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <1c1ea286ad81486b85647b7901984451>:0
    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x00212] in <1c1ea286ad81486b85647b7901984451>:0

Adding a `<Reference/>` to `System.Drawing.Common`, does not seem to
help either...
  • Loading branch information
jonathanpeppers committed Feb 25, 2019
1 parent 37bea6a commit 069c78f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3332,6 +3332,28 @@ public void foo()
}
}

[Test]
public void SystemDrawingCommon ()
{
var proj = new XamarinAndroidApplicationProject {
IsRelease = true,
Sources = {
new BuildItem.Source ("Foo.cs") {
TextContent = () => "class Foo { System.Drawing.Color bar; }"
}
},
PackageReferences = {
KnownPackages.Acr_UserDialogs,
KnownPackages.Xamarin_Build_Download_0_4_11,
}
};
//NOTE: doesn't fix it...
proj.References.Add (new BuildItem ("Reference", "System.Drawing.Common"));
using (var b = CreateApkBuilder (Path.Combine ("temp", TestName))) {
Assert.IsTrue (b.Build (proj), "Build should have succeeded.");
}
}

[Test]
[TestCase ("armeabi;armeabi-v7a", TestName = "XA0115")]
[TestCase ("armeabi,armeabi-v7a", TestName = "XA0115Commas")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -681,6 +681,19 @@ public static class KnownPackages
}
},
};
public static Package Acr_UserDialogs = new Package {
Id = "Acr.UserDialogs",
Version = "6.5.1",
TargetFramework = "MonoAndroid10",
References = {
new BuildItem.Reference ("Acr.UserDialogs") {
MetadataValues = "HintPath=..\\packages\\Acr.UserDialogs.6.5.1\\lib\\MonoAndroid10\\Acr.UserDialogs.dll"
},
new BuildItem.Reference ("Acr.UserDialogs.Interfaces") {
MetadataValues = "HintPath=..\\packages\\Acr.UserDialogs.6.5.1\\lib\\MonoAndroid10\\Acr.UserDialogs.Interfaces.dll"
}
},
};
}
}

0 comments on commit 069c78f

Please sign in to comment.