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] Extract resources with S.I.C.ZipFile. #41

Merged

Conversation

jonpryor
Copy link
Member

Ionic.Zip.dll, as provided by the Unofficial.Ionic.Zip 1.9.1.8 NuGet
package, is broken. It hardcodes \ as directory separator char,
which breaks all manner of things, and when we try to extract and
unzip embedded resources from assemblies, it fails:

Error executing task ResolveLibraryProjectImports: System.ArgumentException: Path is empty
  at System.IO.Directory.CreateDirectory (System.String path) <0x1a20ca0 + 0x0011c> in <filename unknown>:0
  at Ionic.Zip.ZipEntry.InternalExtract (System.String baseDir, System.IO.Stream outstream, System.String password) <0x3af4b78 + 0x002e7> in <filename unknown>:0

I'm not sure why "path is empty" -- the callstack isn't very
helpful -- but it is empty, which means if a project references an
assembly which contains e.g. @(AndroidResource), everthing breaks.

Fix the ResolveLibraryProjectImports task so that instead of using
Ionic.Zip.dll to extract embedded resources we instead use
System.IO.Compression.ZipFile (in
System.IO.Compression.FileSystem.dll, new in .NET 4.5).

Note: Other uses of Ionic.Zip.dll are similarly suspect but
are not fixed. Fixing (removing?) Ionic.Zip.dll will be done later.

Ionic.Zip.dll, as provided by the Unofficial.Ionic.Zip 1.9.1.8 NuGet
package, is broken. [It hardcodes `\` as directory separator char][0],
which breaks all manner of things, and when we try to extract and
unzip embedded resources from assemblies, it fails:

	Error executing task ResolveLibraryProjectImports: System.ArgumentException: Path is empty
	  at System.IO.Directory.CreateDirectory (System.String path) <0x1a20ca0 + 0x0011c> in <filename unknown>:0
	  at Ionic.Zip.ZipEntry.InternalExtract (System.String baseDir, System.IO.Stream outstream, System.String password) <0x3af4b78 + 0x002e7> in <filename unknown>:0

I'm not sure *why* "path is empty" -- the callstack isn't very
helpful -- but it *is* empty, which means if a project references an
assembly which contains e.g. @(AndroidResource), everthing breaks.

Fix the `ResolveLibraryProjectImports` task so that instead of using
Ionic.Zip.dll to extract embedded resources we instead use
System.IO.Compression.ZipFile (in
System.IO.Compression.FileSystem.dll, new in .NET 4.5).

Note: *Other* uses of Ionic.Zip.dll are similarly suspect but
*are not fixed*. Fixing (removing?) Ionic.Zip.dll will be done later.

[0]: https://gitter.im/xamarin/xamarin-android?at=572d97caf36daf63798d6033
@dellis1972 dellis1972 merged commit 4c81668 into dotnet:master May 16, 2016
dellis1972 referenced this pull request in dellis1972/xamarin-android Sep 30, 2016
Add `/app/lib/mandroid` to directory search paths for FlatPak support.
jonpryor pushed a commit that referenced this pull request Oct 5, 2016
…) (#243)

Add `/app/lib/mandroid` to directory search paths for FlatPak support.
@github-actions github-actions bot locked and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants