From c5f2c4616d459136a88fca587d44bc702c28caaa Mon Sep 17 00:00:00 2001 From: Dean Ellis Date: Fri, 27 Oct 2017 13:28:34 +0100 Subject: [PATCH] [Xamarin.Android.Build.Tests] Fix BuildAppCheckDebugSymbols for monodroid The BuildAppCheckDebugSymbols test does not take into account that when building in debug mode on monodroid the assemblies are not embedded in the apk. As a result when trying to get `Library1.pdb` from the apk we get a null back. This causes a Null Ref exception when we try to get a length. The fix is to look in the `assets` directory if we can't get the file from the zip. This will allow the test to work in both xamarin-android and monodroid. --- .../Tests/Xamarin.Android.Build.Tests/BuildTest.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs index e333398d47d..99d06e97979 100644 --- a/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs +++ b/src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs @@ -609,6 +609,8 @@ public Class2 () var outputPath = Path.Combine (Root, b.ProjectDirectory, proj.OutputPath); using (var apk = ZipHelper.OpenZip (Path.Combine (outputPath, proj.PackageName + ".apk"))) { var data = ZipHelper.ReadFileFromZip (apk, "assemblies/Library1.pdb"); + if (data == null) + data = File.ReadAllBytes (assetsPdb); var filedata = File.ReadAllBytes (linkSrc); Assert.AreEqual (filedata.Length, data.Length, "Library1.pdb in the apk should match {0}", linkSrc); }