Skip to content

Commit f30c737

Browse files
committed
Don't throw
1 parent 2f985d8 commit f30c737

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

tools/assembly-store-reader-mk2/AssemblyStore/AssemblyStoreExplorer.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,19 @@ public static (IList<AssemblyStoreExplorer>? explorers, string? errorMessage) Op
140140
ZipEntry entry = zip.ReadEntry (path);
141141
var stream = new MemoryStream ();
142142
entry.Extract (stream);
143-
ret.Add (new AssemblyStoreExplorer (stream, $"{fi.FullName}!{path}"));
143+
AssemblyStoreExplorer? explorer = null;
144+
try {
145+
// It may throw when opening an apk without any assembly stores, in which case the v2 store reader would
146+
// always find `libxamarin-app.so` and try to read the embedded store and fail, throwing from the explorer
147+
// constructor.
148+
explorer = new AssemblyStoreExplorer (stream, $"{fi.FullName}!{path}");
149+
} catch (NotSupportedException) {
150+
// Ignore
151+
}
152+
153+
if (explorer != null) {
154+
ret.Add (explorer);
155+
}
144156
}
145157

146158
if (ret.Count == 0) {

0 commit comments

Comments
 (0)