Caught exception when loading from zip

Hello! I’ve been testing out your pathfinding asset for use in a WiiU game, and I’m very impressed by it so far. I’ve got it running smoothly in the Unity editor, but as soon as I run it on the console itself I’m faced with this error and can’t proceed.

I’ve tried debugging it myself, but I’m stuck. Found a similar thread in the forums, but with a bit different error here.

Any idea what the cause is, or if there is a way to bypass the entire zip functionality somehow?

Caught exception when loading from zip Pathfinding.Ionic.Zip.ZipException: Cannot read that as a ZipFile ---> Pathfinding.Ionic.Zip.BadReadException: Bad signature (0x00000000) at position 0x3DABFFFC at Pathfinding.Ionic.Zip.ZipEntry.ReadDirEntry (Pathfinding.Ionic.Zip.ZipFile zf, System.Collections.Generic.Dictionary2 previouslySeen) [0x00000] in :0
at Pathfinding.Ionic.Zip.ZipFile.ReadCentralDirectory (Pathfinding.Ionic.Zip.ZipFile zf) [0x00000] in :0
at Pathfinding.Ionic.Zip.ZipFile.ReadIntoInstance (Pathfinding.Ionic.Zip.ZipFile zf) [0x00000] in :0
— End of inner exception stack trace —
at Pathfinding.Ionic.Zip.ZipFile.ReadIntoInstance (Pathfinding.Ionic.Zip.ZipFile zf) [0x00000] in :0
at Pathfinding.Ionic.Zip.ZipFile.Read (System.IO.Stream zipStream, System.IO.TextWriter statusMessageWriter, System.Text.Encoding encoding, System.EventHandler`1 readProgress) [0x00000] in :0
at Pathfinding.Ionic.Zip.ZipFile.Read (System.IO.Stream zipStream) [0x00000] in :0
at Pathfinding.Serialization.AstarSerializer.OpenDeserialize (System.Byte[] bytes) [0x00000] in :0 Invalid data file (cannot read zip).
The data is either corrupt or it was saved using a 3.0.x or earlier version of the system
Unhandled Exception: System.ExecutionEngineException: Attempting to JIT compile method ‘(wrapper managed-to-native) System.Threading.Interlocked:Exchange (Pathfinding.Path&,Pathfinding.Path)’ while running with --aot-only.

at Pathfinding.Util.LockFreeStack.PopAll () [0x00000] in :0
at AstarPath.ReturnPaths (Boolean timeSlice) [0x00000] in :0
at AstarPath.PerformBlockingActions (Boolean force, Boolean unblockOnComplete) [0x00000] in :0
at AstarPath.FlushWorkItems (Boolean unblockOnComplete, Boolean block) [0x00000] in :0
at AstarPath.Awake () [0x00000] in :0

----------`

Hm… I am not sure if the zip library even works on WiiU, I don’t have much experience with that platform.
Luckily there is a way to bypass the zip library.
You will need to download the beta, then follow the instructions here for Windows Phone 8, you (probably) only need to do the things relating to the zip library: http://arongranberg.com/astar/docs_dev/iphone.php

Sweet, thanks for the fast reply. I’ll give it a try!

Hello,

I’ve had the same problem and disabling the usage of zipping the cache did solve this error. Now I get a new one with the json. Is the only way to bypass this to disable json as well? I’ll go and try this now but I wanted to let you know that I get this error.

Kind regards,

Peter

Caught exception while deserializing data. System.Exception: Guid in graph file not equal to guid defined in meta file. Have you edited the data manually? b35ee011bc14495f-8c136a101fa280ed != 5f4914bc11e05eb3-ed80a21f106a138c at Pathfinding.Serialization.AstarSerializer.DeserializeGraphs () [0x001ab] in F:\\Repositories\\Game Lab\\GL4 Programming SVN\\Unity\eonWars\\Assets\\AstarPathfindingProject\\Core\\Serialization\\JsonSerializer.cs:715 at Pathfinding.AstarData.DeserializeGraphsPart (Pathfinding.Serialization.AstarSerializer sr) [0x00006] in F:\\Repositories\\Game Lab\\GL4 Programming SVN\\Unity\eonWars\\Assets\\AstarPathfindingProject\\Core\\AstarData.cs:318 at Pathfinding.AstarData.DeserializeGraphs (System.Byte[] bytes) [0x00023] in F:\\Repositories\\Game Lab\\GL4 Programming SVN\\Unity\eonWars\\Assets\\AstarPathfindingProject\\Core\\AstarData.cs:266 Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object at AstarPath.Initialize () [0x00052] in F:\\Repositories\\Game Lab\\GL4 Programming SVN\\Unity\eonWars\\Assets\\AstarPathfindingProject\\Core\\AstarPath.cs:1592 at AstarPath.Awake () [0x001f0] in F:\\Repositories\\Game Lab\\GL4 Programming SVN\\Unity\eonWars\\Assets\\AstarPathfindingProject\\Core\\AstarPath.cs:1492

I also get this Exception with disabled Json and disabled Zip on a Wii U. Did you find a way to fix it?

No, unfortunately not. In the end we ended up building our own pathfinding system because we had problems with the unity one as wel…

@robinfischer @CrashKonijn
Would it be possible for either of you to create a small test scene/share your project so I could test it out. Alternatively if you could use the “Save To File” button under the Save & Load tab in the inspector and send the file to me. Then I could get a better idea of what is going wrong.

Hi Aron,

I generated the File in one of my Scenes in the Wii U Unity Editor.

Unfortunately I cannot send you a test project with the Wii U Unity Editor due to licensing issues.

This Error only occurs when running the Game on the Wii U Dev Kit itself. If i build a Windows Player from the Unity Wii U Editor everything works fine.
It is working for me at the moment because I changed the code in JsonSerializer (~688) from:

if (graphs[i].guid.ToString() != meta.guids[i])
{
throw new System.Exception (“Guid in graph file not equal to guid defined in meta file. Have you edited the data manually?\n”+graphs[i].guid.ToString()+" != "+meta.guids[i]);
}

to:

if (graphs[i].guid.ToString() != meta.guids[i])
{
Debug.LogError(“Guid in graph file not equal to guid defined in meta file. Have you edited the data manually?\n” + graphs[i].guid.ToString() + " != " + meta.guids[i]);
//throw new System.Exception (“Guid in graph file not equal to guid defined in meta file. Have you edited the data manually?\n”+graphs[i].guid.ToString()+" != "+meta.guids[i]);
}

I am assuming this guid checking is important if you have multiple Graphs in one Scene. Fortunately this is not the case for me at the moment.

While I am here:

Please add a compile define to the LockFreeStack.cs

You are setting some compile defines for AOT Code Compilation.

'#if UNITY_IPHONE || UNITY_PSP2

Please add UNITY_WIIU because it also is an AOT Platform.

Or maybe a better approach: Use an own Define for AOT Platforms like “ASTAR_AOT” so it can be set on platforms that are new or not yet considered.
Or both :slight_smile: #if UNITY_IPHONE || UNITY_PSP2 || UNITY_WIIU || ASTAR_AOT

If I am not mistaken Xbox One and PS4 are also AOT

Maybe I should note that I had to comment out another piece of Code.

// Set dummy dates on every file to prevent the binary data to change
// for identical settings and graphs.
// Prevents the scene from being marked as dirty in the editor
var dummy = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
foreach (var entry in zip.Entries) {
entry.AccessedTime = dummy;
entry.CreationTime = dummy;
entry.LastModified = dummy;
entry.ModifiedTime = dummy;
}

Maybe this commented Code ist the Probelm of the guid conflict. But the Property “Entries” is not implemented when ASTAR_NO_ZIP and ASTAR_NO_JSON is true

@robinfischer

Ah, apparently WIIU is a big-endian machine. So the GUID deserialization failed.

Note that b3 5e e0 11 bc 14 49 5f has every byte reversed compared to 5f 49 14 bc 11 e0 5e b3

I have just uploaded version 3.6.4 which hopefully fixes this problem.

@aron_granberg Hi, I just got a similar error, using 3.8.2 - any ideas? I’m up against a deadline and this is halting production for me at the moment :frowning:

Caught exception when loading from zip
Pathfinding.Ionic.Zip.ZipException: Cannot read that as a ZipFile —> Pathfinding.Ionic.Zip.BadReadException: Could not read block - no data! (position 0x00000000)
at Pathfinding.Ionic.Zip.SharedUtilities._ReadFourBytes (System.IO.Stream s, System.String message) [0x00000] in :0
at Pathfinding.Ionic.Zip.SharedUtilities.ReadInt (System.IO.Stream s) [0x00000] in :0
at Pathfinding.Ionic.Zip.ZipFile.ReadFirstFourBytes (System.IO.Stream s) [0x00000] in :0
at Pathfinding.Ionic.Zip.ZipFile.ReadIntoInstance (Pathfinding.Ionic.Zip.ZipFile zf) [0x00000] in :0
— End of inner exception stack trace —
at Pathfinding.Ionic.Zip.ZipFile.ReadIntoInstance (Pathfinding.Ionic.Zip.ZipFile zf) [0x00000] in :0
at Pathfinding.Ionic.Zip.ZipFile.Read (System.IO.Stream zipStream, System.IO.TextWriter statusMessageWriter, System.Text.Encoding encoding, System.EventHandler`1 readProgress) [0x00000] in :0
at Pathfinding.Ionic.Zip.ZipFile.Read (System.IO.Stream zipStream) [0x00000] in :0
at Pathfinding.Serialization.AstarSerializer.OpenDeserialize (System.Byte[] bytes) [0x00093] in F:\development\myproject\Assets\AstarPathfindingProject\Core\Serialization\JsonSerializer.cs:586

Adding a zipStream.Flush(); before writing at JsonSerializer.cs:586 gets rid of the error, but I’m not 100% sure that’s the correct thing to do…

Edit: flush doesn’t help much :wink:

Hi

Sorry for the late answer.
I am not sure what the problem is. From the error it looks like there is no data stored at all.
Have you managed to make any progress since you posted this?

1 Like

No worries - I tried a number of different hacks to get around it, none of which really helped and aren’t worth mentioning.

However, I closed Unity & Visual Studio, rebooted my machine, and tried again… I couldn’t reproduce the error. Everything works fine now… (I think). Hopefully it doesn’t happen again… Mysterious.

That is mysterious indeed…

same problem here.
my pc works well, but user’s pc happen. cannot play game…
any idea?

Caught exception when loading from zip Pathfinding.Ionic.Zip.ZipException: Cannot read that as a ZipFile —> System.InvalidTimeZoneException: Exception of type ‘System.InvalidTimeZoneException’ was thrown. at System.TimeZoneInfo.FromRegistryKey (System.String id, Microsoft.Win32.RegistryKey key) [0x00014] in <ac823e2bb42b41bda67924a45a0173c3>:0 at System.TimeZoneInfo.FindSystemTimeZoneById (System.String id) [0x0003f] in <ac823e2bb42b41bda67924a45a0173c3>:0 at System.TimeZoneInfo.CreateLocal () [0x00045] in <ac823e2bb42b41bda67924a45a0173c3>:0 at System.TimeZoneInfo.get_Local () [0x00009] in <ac823e2bb42b41bda67924a45a0173c3>:0 at System.TimeZoneInfo.GetDateTimeNowUtcOffsetFromUtc (System.DateTime time, System.Boolean& isAmbiguousLocalDst) [0x00000] in <ac823e2bb42b41bda67924a45a0173c3>:0 at System.DateTime.get_Now () [0x00008] in <ac823e2bb42b41bda67924a45a0173c3>:0 at Pathfinding.Ionic.Zip.SharedUtilities.PackedToDateTime (System.Int32 packedDateTime) [0x000af] in <99f15b4793f044

Invalid data file (cannot read zip). The data is either corrupt or it was saved using a 3.0.x or earlier version of the system

Unity Version 2018.3.0f2
Device B360 AORUS GAMING 3 (Gigabyte Technology Co., Ltd.)
OS Version Windows 10 (10.0.0) 64bit
CPU Intel® Core™ i7-8700K CPU @ 3.70GHz
GFX NVIDIA GeForce GTX 1060 3GB

A* pro Version: 4.2.10

@raveneer It looks like your user must have a very strange timezone configured on their computer. .net seems to think their timezone is invalid.

thank you. i will report again this happens too much.

1 Like