Skip to content

Commit

Permalink
[Xamarin.Android.Build.Tasks] Something leaves classes.jar files open…
Browse files Browse the repository at this point in the history
… until MSBuild exits (#5457)

* [Xamarin.Android.Build.Tasks] Something leaves classes.jar files open until MSBuild exits

Fixes #5424

There is a bug in BuildApk where the Stream being passed to LibZipSharp
is NOT being disposed of. This is probably the cause of the classes.jar
file being left open.

* Add Release notes
  • Loading branch information
dellis1972 authored Jan 5, 2021
1 parent ffbba9d commit 2e92452
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Documentation/release-notes/5457.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#### Application and library build and deployment

* [GitHub Issue 5424](https://github.com/xamarin/xamarin-android/issues/5424):
Fixed a file lock on `classes.jar` when building on Windows.
3 changes: 2 additions & 1 deletion src/Xamarin.Android.Build.Tasks/Tasks/BuildApk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ void ExecuteWithAbi (string [] supportedAbis, string apkInputPath, string apkOut

count = 0;
foreach (var jarFile in jarFilePaths) {
using (var jar = ZipArchive.Open (File.OpenRead (jarFile))) {
using (var stream = File.OpenRead (jarFile))
using (var jar = ZipArchive.Open (stream)) {
foreach (var jarItem in jar) {
if (jarItem.IsDirectory)
continue;
Expand Down

0 comments on commit 2e92452

Please sign in to comment.