Search Unity

'mainData' is corrupted! Remove it and launch unity again!

Discussion in 'Windows' started by npruehs, Feb 7, 2014.

  1. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    ina likes this.
  2. npruehs

    npruehs

    Joined:
    Jul 20, 2012
    Posts:
    67
    Any updates on this? I think a 100% reproducable crash should be fixed.
     
    ina likes this.
  3. ickydime

    ickydime

    Joined:
    Nov 20, 2012
    Posts:
    110
    I am having a similar issue as well. I just upgraded to 4.6 but that didn't fix it for me though I don't believe mine has anything to do with a level file like some of the other links you posted.

    I've read on StackOverflow it could be due to 2 classes named the same so I am going to head down that route though I don't have any JS classes I know of...

    I am building universal and it crashes on both phone and windows when I build. From what I can tell the log is pretty worthless in terms of pointing to what the issue could be. I've included a few lines before and after the issue in case they help:

    GlobalManager 'NetworkManager' is not included.

    GlobalManager 'MasterServerInterface' is not included.

    Long thread activation time (48 ms) for object atlas0 material (Material)

    The file 'C:/Data/SharedData/PhoneTools/AppxLayouts/c7dbfaa7-6610-0648-b86e-21907d84c21fVS.Debug_ARM.Mark/Data/mainData' is corrupted! Remove it and launch unity again!
    [Position out of bounds! 2019028 > 2019024]

    (Filename: C:/buildslave/unity/build/Runtime/Serialize/CacheWrap.cpp Line: 273)


    The program '[5728] Template.exe' has exited with code -2147483645 (0x80000003).
     
  4. ickydime

    ickydime

    Joined:
    Nov 20, 2012
    Posts:
    110
    I was able to get a stack trace:

    > UnityPlayer.dll!DebugStringToFilePostprocessedStacktrace(const char * condition, const char * strippedStacktrace, const char * stacktrace, int errorNum, const char * file, int line, int mode, int objectInstanceID, int identifier) Line 1051 C++
    UnityPlayer.dll!DebugStringToFile(const char * condition, int errorNum, const char * file, int line, int mode, int objectInstanceID, int identifier) Line 1097 C++
    UnityPlayer.dll!DebugStringToFile<stl_allocator<char,56,4> >(const std::basic_string<char,std::char_traits<char>,stl_allocator<char,56,4> > & condition, int errorNum, const char * file, int line, int mode, const int objectInstanceID, int identifier) Line 103 C++
    UnityPlayer.dll!CachedReader::OutOfBoundsError(unsigned int position, unsigned int size) Line 273 C++
    UnityPlayer.dll!CachedReader::Read(void * data, unsigned int size) Line 131 C++
    UnityPlayer.dll!NativeExt_MonoBehaviourSerialization_ReadBuffer(int ptr, int size) Line 148 C++
    082429e0() Unknown
     
  5. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    It looks like serialization issue, does it reproduce in 5.x as well? Did you try building to empty folder?
     
  6. ickydime

    ickydime

    Joined:
    Nov 20, 2012
    Posts:
    110
    Thanks for the quick reply!

    I don't own 5.x. I could download the demo but does that build to Windows Universal? I was under the impression that only Pro did that. Or is there a 30 day trail of Pro I could test with?

    I am building to an empty folder every time. I am trying to find duplicate classes as suggested by the second answer here: http://answers.unity3d.com/questions/368456/corrupted-maindata.html The problem is this is a game that we have been working on for 2 years and thus it is massive.

    Any idea what it is trying to serialize at this time which may help narrow my search or at least confirm that it is a duplicate class?
     
  7. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    You don't need Pro to build to Windows Universal. Without a repro project, it's impossible for me to say, what data fails the serialization... you could enable debug->exceptions, and continue until you hit that corruption error, you might see the class name in the callstack.
     
  8. ickydime

    ickydime

    Joined:
    Nov 20, 2012
    Posts:
    110
    Thanks, I grabbed Unity 5 and made a copy of the project. Currently working through everything that has been changed or depreciated.

    In the meantime I did re-check the exceptions and didn't see anything of note beyond the stack trace I linked earlier.

    Thanks for the tips.
     
  9. ickydime

    ickydime

    Joined:
    Nov 20, 2012
    Posts:
    110
    Its mostly ported over and I commented out a few things just to keep the testing moving.

    It does result in the same error at least the first time I try to compile in Visual Studio after a clean build.

    However, if I try to run again even without changing anything, I get the following error:
    Error 2523 The call is ambiguous between the following methods or properties: 'Soomla.SoomlaExtensions.AddOrUpdate<Soomla.Store.VirtualItem>(System.Collections.Generic.Dictionary<string,Soomla.Store.VirtualItem>, string, Soomla.Store.VirtualItem)' and 'Soomla.SoomlaExtensions.AddOrUpdate<Soomla.Store.VirtualItem>(System.Collections.Generic.Dictionary<string,Soomla.Store.VirtualItem>, string, Soomla.Store.VirtualItem)' C:\projects\COG\trunk\COG\CogUnity5\Assets\Plugins\Soomla\Store\data\StoreInfo.cs 397 5 Assembly-CSharp-firstpass-windows-phone-8.1

    There are a bunch of similar errors. What is interesting is that when I do a search for SoomlaExtensions within Unity there is only one in the project. And onlye one declaration of AddOrUpdate.
     
  10. ickydime

    ickydime

    Joined:
    Nov 20, 2012
    Posts:
    110
    Digging into this some more.

    The error happens on 4.x as well as the latest Unity 5. The call stack is the same on both.

    If I build on Unity 5 with the Unity #C Projects checkbox unchecked then it gives me the mainData error every time I try to compile in Visual Studio.

    If I build on Unity 5 with the Unity #C Projects checkbox checked then it gives me the mainData error the first time I try to compile in Visual Studio and then from then on it won't compile because it says there are ambigious functions within a Soomla plugin. If I build in Unity 4.x this second error does not occur.

    When building universal the errors happen on both platforms regardless of whether I build to the phone or the store.

    If I toggle on break on exceptions and debugger type to native I can get the call stack mentioned above.

    When I build specifically for the 8.1 phone from Unity5 I get this when I load the project:
    C:\projects\COG\Builds\Phone5\Conquest\Conquest.csproj : error : The imported project "C:\projects\COG\Builds\Phone5\Conquest.Shared\Conquest.Shared.projitems" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk. C:\projects\COG\Builds\Phone5\Conquest\Conquest.csproj

    The shared folder does not exist but I wouldn't expect it to on a non-universal build. This seems like another bug but I'd like to focus on the mainData one for now unless this sounds related.


    The only remaining course of action I can think of is to start pulling sections of code from the game and see if the error goes away in hopes of narrowing this down. I'll start with the plugins and move on from there.

    Any suggestions on other approaches or ways for me to narrow this down to a specific issue rather than a generic fail?
     
  11. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    A few questions: are you targeting WP 8.0 or 8.1?

    If you ran this on PC as Windows Store App instead, you would be able to see mixed mode stacktrace, which will tell you which script is causing the issue.
     
  12. ickydime

    ickydime

    Joined:
    Nov 20, 2012
    Posts:
    110
    Thanks!

    Universal 8.1

    I have a much longer stack now using your advice. Though I don't see anything that would indicate which script is the cause. Shown below, maybe I am overlooking something?

    As a side note I did have some success yesterday. After incrementally removing 9 parts of the project the error went away. I went back to my original project and just removed the 9th but unfortunately the error persists. So today I will be trying to re-introduce the other 8 parts one by one until the error comes back which I hope will be the culprit.


    > UnityPlayer.dll!DebugStringToFilePostprocessedStacktrace(const char * condition, const char * strippedStacktrace, const char * stacktrace, int errorNum, const char * file, int line, int mode, int objectInstanceID, int identifier) Line 1051 C++
    UnityPlayer.dll!DebugStringToFile(const char * condition, int errorNum, const char * file, int line, int mode, int objectInstanceID, int identifier) Line 1095 C++
    UnityPlayer.dll!DebugStringToFile<stl_allocator<char,56,4> >(const std::basic_string<char,std::char_traits<char>,stl_allocator<char,56,4> > & condition, int errorNum, const char * file, int line, int mode, const int objectInstanceID, int identifier) Line 102 C++
    UnityPlayer.dll!CachedReader::OutOfBoundsError(unsigned int position, unsigned int size) Line 273 C++
    UnityPlayer.dll!CachedReader::Read(void * data, unsigned int size) Line 131 C++
    UnityPlayer.dll!NativeExt_MonoBehaviourSerialization_ReadBuffer(int ptr, int size) Line 148 C++
    [Managed to Native Transition]
    WinRTBridge.winmd!WinRTBridge.SerializationWeaverReader.ReadInt32() Unknown
    Assembly-CSharp.DLL!tk2dCamera.Unity_Deserialize(int depth) Unknown
    UnityEngine.DLL!UnityEngine.Internal.Types.$UnityType3412.$Invoke0(long instance, long* args) Unknown
    UnityEngine.DLL!UnityEngine.Internal.$MethodUtility.InvokeMethod(long instance, long* args, System.IntPtr method) Unknown
    [Native to Managed Transition]
    UnityPlayer.dll!metro_invoke_method(ScriptingMethodDotNet method, WinRTScriptingObjectWrapper object, ScriptingArguments * arguments, WinRTScriptingObjectWrapper * exception, bool convertArgs) Line 52 C++
    UnityPlayer.dll!ScriptingInvocation::Invoke(WinRTScriptingObjectWrapper * exception, bool convertArguments) Line 125 C++
    UnityPlayer.dll!ScriptingInvocation::Invoke(WinRTScriptingObjectWrapper * exception) Line 113 C++
    UnityPlayer.dll!ScriptingInvocation::Invoke() Line 108 C++
    UnityPlayer.dll!InvokeIUnitySerializationMethod(ScriptingMethodDotNet method, WinRTScriptingObjectWrapper instance, DotNetType * klass) Line 70 C++
    UnityPlayer.dll!TransferScriptingObject<StreamedBinaryRead<0> >(StreamedBinaryRead<0> & transfer, WinRTScriptingObjectWrapper instance, DotNetType * klass, const MonoScriptCache * monoScriptCache) Line 92 C++
    UnityPlayer.dll!MonoBehaviour::TransferEngineAndInstance<StreamedBinaryRead<0> >(StreamedBinaryRead<0> & transfer) Line 52 C++
    UnityPlayer.dll!MonoBehaviour::VirtualRedirectTransfer(StreamedBinaryRead<0> & transfer) Line 116 C++
    UnityPlayer.dll!SerializedFile::ReadObject(int fileID, int instanceId, ObjectCreationMode mode, bool isPersistent, TypeTree * * oldTypeTree, bool * didChangeTypeTree, Object * * outObjectPtr) Line 1325 C++
    UnityPlayer.dll!PersistentManager::LoadFileCompletelyThreaded(const std::basic_string<char,std::char_traits<char>,stl_allocator<char,56,4> > & pathname, int * fileIDs, int * instanceIDs, int size, bool loadScene, LoadProgress * loadProgress) Line 1451 C++
    UnityPlayer.dll!PreloadLevelOperation::perform() Line 688 C++
    UnityPlayer.dll!PreloadManager::Run() Line 239 C++
    UnityPlayer.dll!PreloadManager::Run(void * managerPtr) Line 189 C++
    UnityPlayer.dll!Thread::RunThreadWrapper(void * ptr) Line 40 C++
    UnityPlayer.dll!win32::CreateThread::__l24::<lambda>(Windows::Foundation::IAsyncAction ^ __formal) Line 273 C++
    UnityPlayer.dll!Platform::Details::__abi_FunctorCapture<void <lambda>(Windows::Foundation::IAsyncAction ^),void,Windows::Foundation::IAsyncAction ^>::Invoke(Windows::Foundation::IAsyncAction ^ <__args_0>) Line 875 C++
    UnityPlayer.dll!Windows::System::Threading::WorkItemHandler::Invoke(Windows::Foundation::IAsyncAction ^ __param0) C++
    UnityPlayer.dll!Windows::System::Threading::WorkItemHandler::[Windows::System::Threading::WorkItemHandler::__abi_IDelegate]::__abi_Windows_System_Threading_WorkItemHandler___abi_IDelegate____abi_Invoke(Windows::Foundation::IAsyncAction ^ __param0) C++
    threadpoolwinrt.dll!Windows::System::Threading::CThreadPoolWorkItem::CommonWorkCallback(void) Unknown
    threadpoolwinrt.dll!Windows::System::Threading::CThreadPoolWorkItem::TimeSlicedCallback(void *) Unknown
    kernel32.dll!@BaseThreadInitThunk@12() Unknown
    ntdll.dll!__RtlUserThreadStart() Unknown
    ntdll.dll!__RtlUserThreadStart@8() Unknown
     
  13. Tomas1856

    Tomas1856

    Unity Technologies

    Joined:
    Sep 21, 2012
    Posts:
    3,918
    Code (csharp):
    1.  
    2. Assembly-CSharp.DLL!tk2dCamera.Unity_Deserialize(int depth) Unknown
    3.  
    Serialization error comes from tk2dCamera class.
     
  14. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    This definitely stinks like a serialization bug. Even if you manage to find what causes it and workaround - please submit a bug because we'd like to fix it.
     
  15. ickydime

    ickydime

    Joined:
    Nov 20, 2012
    Posts:
    110
    Thanks guys. Completely overlooked that line. o.0

    Though by ignoring the TK2D serialization line above it led me down a different path and I've found that if I remove parts of a library called UniWeb that I am able to compile successfully (without touching the library that failed serialization in that code path above... though it is on the phone so maybe I have that to look forward to when I go back to the store). I'm still narrowing down which parts exactly. It may be due to using https://github.com/MarkerMetro to help fill in some gaps in Threading & Sockets & Crypto & Gzip that are used in UniWeb. Once I figure out the exact culprits and solution I'll post and see if you guys think it is a bug.

    As a side note, sometimes I make changes and when I build I am not 100% sure those changes are being reflected. It is probably just me becoming cross eyed due to all the builds I have tried lately but I am curious if there is some sort of caching involved in the build process that I should make sure I clean out? I am building to a new folder each time.

    Thanks!
     
  16. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    TK2D probably is not to blame - it crashed because another script caused havok.

    As for thinking whether it's a bug or not - I'd say by definition such crash without any further info is a bug :). It's most likely caused by serialization system of the editor not exactly matching one in the player.
     
  17. ickydime

    ickydime

    Joined:
    Nov 20, 2012
    Posts:
    110
    I am not sure what exactly caused the issue. I ended up getting it to compile by stripping out some sections of UniWeb though I could get it to run properly with my replacement code. I ended up purchasing Best HTTP Pro in the asset store since it supports WSA natively and replaced UniWeb. Now I am in business.

    Sorry I don't have repro steps or an exact bug to track down. Greatly appreciate the help though.