[Crash]PackageReader::ReadAssetRegistryDataIfCookedPackage crash

When I builded my game as WindowsNoEditor with vs2015 I got crash in Array.h in line 2810:

check(Size == sizeof(T));

Where size was 88 and sizeof(T) was (as disasembly showed) 8. On the call stack level above there was this line(PackageReader:299)

new(AssetDataList) FAssetData(FName(*PackageName), FName(*PackagePath), FName(*GroupNames), Export.ObjectName, ObjectClassName, Tags, ChunkIDs, GetPackageFlags());

Where assetDataLit is function parameter of type TArray&. So there was inplace new of type FAssetData to array of FAssetData pointers.
I fixed this manualy in my engine sources with this line(in PackageReader):

AssetDataList.Add(new FAssetData(FName(*PackageName), FName(*PackagePath), FName(*GroupNames), Export.ObjectName, ObjectClassName, Tags, ChunkIDs, GetPackageFlags()));

And its works. My current version of engine is ue4.11.1

Thanks, this crash is a know issue that has been fixed for 4.12. Your change is the correct one :slight_smile:

As an aside, you shouldn’t really need to call ScanPathsSynchronous in a build with cooked data. This is actually why we never noticed this bug, as object libraries only call ScanPathsSynchronous in builds where WITH_EDITOR is defined, as in other builds you’d be working with a pre-made asset registry blob.

This called in my code by AssetRegistry.SearchAllAssets(true); in my game instance. That was the workaround months ago, because without it my asset registry was empty and I couldn’t find anything. I didn’t know why so I just hacked it so. I will try to delete it and look if it will work.

You should only need to do that (or scans on more specific directories) when running in the editor with -game. You could probably wrap the call in an #if WITH_EDITOR block.

Oh, thanks! It could be a reason.

I tried your proposal and it doesn’t works, because I use asset registry tags which aren’t saved in AssetRegistry.bin and appears only after full rescan.