Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Xamarin.Android.Build.Tasks] avoid FileNotFoundException in LinkAssemblies #2487

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Xamarin.Android.Build.Tasks/Tasks/LinkAssemblies.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,14 @@ bool Execute (DirectoryAssemblyResolver res)
continue;

MonoAndroidHelper.CopyIfChanged (copysrc, assemblyDestination);
try {
var mdb = assembly.ItemSpec + ".mdb";
if (File.Exists (mdb)) {
var mdbDestination = assemblyDestination + ".mdb";
MonoAndroidHelper.CopyIfChanged (assembly.ItemSpec + ".mdb", mdbDestination);
} catch (Exception) { // skip it, mdb sometimes fails to read and it's optional
MonoAndroidHelper.CopyIfChanged (mdb, mdbDestination);
}
var pdb = Path.ChangeExtension (copysrc, "pdb");
if (File.Exists (pdb) && Files.IsPortablePdb (pdb)) {
var pdbDestination = Path.ChangeExtension (Path.Combine (copydst, filename), "pdb");
var pdbDestination = Path.ChangeExtension (assemblyDestination, "pdb");
MonoAndroidHelper.CopyIfChanged (pdb, pdbDestination);
}
}
Expand Down