Problems porting to Xbox

Hey,

I’m getting some errors with the deserializer when attempting to run this on Unity Xbox.

Caught exception when loading from zip Ionic.Zip.ZipException: Cannot read that as a ZipFile ---> System.ArgumentOutOfRangeException: Argument is out of range. Parameter name: Offset out of range. 3171090432 at System.IO.MemoryStream.Seek (Int64 offset, SeekOrigin loc) [0x00000] in <filename unknown>:0 at Ionic.Zip.ZipFile.ReadIntoInstance (Ionic.Zip.ZipFile zf) [0x00000] in <filename unknown>:0 --- End of inner exception stack trace --- at Ionic.Zip.ZipFile.ReadIntoInstance (Ionic.Zip.ZipFile zf) [0x00000] in <filename unknown>:0 at Ionic.Zip.ZipFile.Read (System.IO.Stream zipStream, System.IO.TextWriter statusMessageWriter, System.Text.Encoding encoding, System.EventHandler1 readProgress) [0x00000] in :0
at Ionic.Zip.ZipFile.Read (System.IO.Stream zipStream) [0x00000] in :0
at Pathfinding.Serialization.AstarSerializer.OpenDeserialize (System.Byte[] bytes) [0x00093] in D:\Projects\Slender\Assets\Extensions\AstarPathfindingProject\Core\Serialization\JsonSerializer.cs:337

(Filename: E:/xbox/Runtime/ExportGenerated/Xbox360Player/UnityEngineDebug.cpp Line: 54)

Invalid data file (cannot read zip). Trying to load with old deserializer (pre 3.1)…

(Filename: E:/xbox/Runtime/ExportGenerated/Xbox360Player/UnityEngineDebug.cpp Line: 54)

Deserializing…

(Filename: E:/xbox/Runtime/ExportGenerated/Xbox360Player/UnityEngineDebug.cpp Line: 54)

Caught exception while deserializing data.
System.IO.EndOfStreamException: Failed to read past end of stream.
at System.IO.BinaryReader.FillBuffer (Int32 numBytes) [0x00000] in :0
at System.IO.BinaryReader.ReadInt32 () [0x00000] in :0
at Pathfinding.AstarSerializer.DeserializeAnchors () [0x00042] in D:\Projects\Slender\Assets\Extensions\AstarPathfindingProject\Core\Serialization\GraphLoaderHistory\AstarSerialize.cs:520
at Pathfinding.AstarSerializer.OpenDeserialize (System.Byte[] data) [0x00013] in D:\Projects\Slender\Assets\Extensions\AstarPathfindingProject\Core\Serialization\GraphLoaderHistory\AstarSerialize.cs:176
at Pathfinding.AstarData.DeserializeGraphs_oldInternal (Pathfinding.AstarSerializer serializer, System.Byte[] bytes) [0x00035] in D:\Projects\Slender\Assets\Extensions\AstarPathfindingProject\Core\AstarData.cs:420
at Pathfinding.AstarData.DeserializeGraphs_oldInternal (Pathfinding.AstarSerializer serializer) [0x00000] in D:\Projects\Slender\Assets\Extensions\AstarPathfindingProject\Core\AstarData.cs:398
at Pathfinding.AstarData.DeserializeGraphs (System.Byte[] bytes) [0x00041] in D:\Projects\Slender\Assets\Extensions\AstarPathfindingProject\Core\AstarData.cs:309
`

At first I thought this was just a bad filepath reference but I can’t seem to see any references to a filepath at all. The problem seems to occur here:

str = new MemoryStream(); str.Write(bytes,0,bytes.Length); str.Position = 0; try { zip = ZipFile.Read(str); } catch (ZipException e) { //Catches exceptions when an invalid zip file is found Debug.LogWarning ("Caught exception when loading from zip\ "+e); str.Close(); return false; }

If you have even the slightest idea what’s going on your help would be extremely appreciated.

Thanks,

Brenden

bump

Can anyone at least point me to where all of astar’s path references are found? There must be a spot where its defined the location of zip files.

Thanks,

Brenden

I also noticed this, which seems to be a pretty big problem

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.

I’m assuming this is due to reflection. I tried to disable it with ASTAR_FAST_BUT_NO_EXCEPTIONS but the error still pops up. Any way to use this system without JIT?

Edit: Please ignore this comment

I ended up having to uninstall this package and use another pathfinding solution for our game. This package is very deep and there’s too many unkowns.

I’ll go on record saying that this is a fantastic pathfinding solution, but if you’re doing anything with Unity consoles, be aware that you’ll run into hard compatibility problems that will crash the console.

Cheers,

Brenden

Hi

This is related to running using the restrictions the Windows Store enforces. You can see a sticky post about it at the top of the discussions list. I am working on a fix.

This is an old thread – but we’re working on the Xbox One, and getting:

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.

We’re on an older version of A* (3.4.0.6). Did this issue get resolved?

Hi

Check out the page about deploying for mobile in the docs. I cannot remember exactly what flag you needed for that, but I think it is 'safe no exceptions '.

For future reference – our solution was to add UNITY_XBOXONE alongside UNITY_IPHONE in LockFreeStack.cs. Aron – you may want to consider that for a future update (and UNITY_PS4, which most likely has the same JIT compile restrictions).

1 Like

Yeah, looking at the latest version of that file, it seems I did at that at some point during the 3.6.x releases. Currently it reads.

if UNITY_IPHONE || UNITY_PSP2 || UNITY_XBOXONE || UNITY_PS3 || UNITY_PS4 || UNITY_WIIU

1 Like