Skip to content

Commit fbd9f5e

Browse files
dellis1972Redth
authored andcommitted
[Xamarin.Android.Build.Tests] Fix BuildAppCheckDebugSymbols in monodroid (dotnet#987)
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 `NullReferenceException` 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 `.apk`. This will allow the test to work in both xamarin-android and monodroid.
1 parent f6f06b8 commit fbd9f5e

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

  • src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests

src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildTest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,8 @@ public Class2 ()
609609
var outputPath = Path.Combine (Root, b.ProjectDirectory, proj.OutputPath);
610610
using (var apk = ZipHelper.OpenZip (Path.Combine (outputPath, proj.PackageName + ".apk"))) {
611611
var data = ZipHelper.ReadFileFromZip (apk, "assemblies/Library1.pdb");
612+
if (data == null)
613+
data = File.ReadAllBytes (assetsPdb);
612614
var filedata = File.ReadAllBytes (linkSrc);
613615
Assert.AreEqual (filedata.Length, data.Length, "Library1.pdb in the apk should match {0}", linkSrc);
614616
}

0 commit comments

Comments
 (0)