Internal error in siaqodb when updating data model in Unity

64 views
Skip to first unread message

mh.ma...@gmail.com

unread,
Jul 17, 2016, 4:18:39 AM7/17/16
to Siaqodb - NoSQL embedded database for .NET

Hi

I have a data model consist of some classes which is in a separate solution of visual studio. I'm using dll of this model in my unity project and everything goes fine.
when I update this model for my game-play stuff some weird things happens. For example I have a class like this in Data model to save player's data:

            public class Data
            {
                public int OID;
            }
            public class Player : Data
            {
                public string UserId;
                public string Name;

                ...
       
            }

and this model save & load works fine.
When I add a new Field with a class to this model:

            public class Player : Data
            {
                public string UserId;
                public string Name;

                ...
    
                public Dictionary<MyType, CharacterStat> Stats;
            }
            public class CharacterStat : Data
            {
                public MyType Type;
                public List<DateTime> Times;
            }
            public enum MyType
            {
                A, B, C
            }

and try to initialize Siaqodb() with previous stored datas, I get this error:

ArgumentException: An element with the same key already exists in the dictionary.
System.Collections.Generic.Dictionary`2[System.String,System.Int32].Add (System.String key, Int32 value) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:404)
#=q_dDr9uqZDblMLqG35BhrbQFxAZ8l25NRRWLZmieUd1E=.#=qg9Hyr7JulxpLyMdm51Jgrw== (.#=qUpxaRDWfz4L9h0YOFBhrKZgTCq2dZPSwILpz2FjqARs= #=qNzCrFgDd63t$opsWuLFh6A==)
#=q_dDr9uqZDblMLqG35BhrbQFxAZ8l25NRRWLZmieUd1E=.#=qDNG7vZWKfQBT5cNLDjUZqg== (.#=qUpxaRDWfz4L9h0YOFBhrKZgTCq2dZPSwILpz2FjqARs= #=q1HkmdJwBVrxQMySTVnWzgA==)
#=q_dDr9uqZDblMLqG35BhrbQFxAZ8l25NRRWLZmieUd1E=.#=qvs7N7fUbBE2hr1MUStib$g== ()
Sqo.Siaqodb.Open (System.String path)
Sqo.Siaqodb..ctor (System.String path)
Adon.Localstore.DbFactory.GetDbInstance (System.String name) (at Assets/Scripts/LocalStore/DBFactory.cs:37)

and here is DBFactory.cs:37
           var newDbInstance = new Siaqodb(dbPath);

and dbPath is the path of stored data with previous version of data model.
The Interesting thing is when I delete saved data files from path everything works fine again! I tried everything I could but no success! The problem is really weird because I can't even instantiate Siaqodb Class.
Could you help me with this?

mh.ma...@gmail.com

unread,
Jul 17, 2016, 6:08:43 AM7/17/16
to Siaqodb - NoSQL embedded database for .NET, mh.ma...@gmail.com
By the way I used code from second previous post to look at internal stages by loading MetaTypes to find error cause. Let me expand my model a litle more:

my model before buggy version:
public class Data
{
    public int OID;
}
public class Player : Data
{
    public string UserId;
    public string Name;

                ...
       
    public Dictionary<string, InventoryItem> Items;
}

public class InventoryItem : Data
{
    public bool Unlocked;
    public int Level;
}

and after updating model the Player class goes like this:

public class Player : Data
{
    public string UserId;
    public string Name;

                ...

    public Dictionary<string, InventoryItem> Items;
    public Dictionary<MyType, CharacterStat> Stats;
}
public class CharacterStat : Data
{
    public MyType Type;
    public List<DateTime> Times;
}
public enum MyType
{
    A, B, C
}

The programs load types and corresponding fields one by one in this Order, but:

MetaType: InventoryItem
   ... // Loading all fields for all OIDs successfully
MetaType: Player
   ... // Loading all primitive fields for OID = 1

Error while loading field[=Items] of class[=Player] for [OID=1]
NullReferenceException: Object reference not set to an instance of an object
#=q_D5MLjS33txpQAeLYp4Z3gGlsMFKcZEok3XZpnh$JCc=.#=qokZ09ufIBzzbhWGxOaAsAQ== (System.Type #=qeOgdQLCKzo2XJT5KAS9Tew==)
#=q_octEiUXKXnjuC6rJosOYoth_mEuq61pUsLsGuyCHWo=.#=qiAkNn7yc10Sz$DQXQ0wQkA== (.#=qUpxaRDWfz4L9h0YOFBhrKZgTCq2dZPSwILpz2FjqARs= #=qjxp5wY6m9JmH_2JaKurrkA==, Int32 #=qiZS5QJ7YFziUWw1knakdow==, .#=ql9ZMLer0RQfh97PrH1XbP7m_u2zw8x9VqF3d6i8X61c= #=qvSLKCJgDGHQ_5xhP3lt4wA==, .#=qYm0aR3GgG_Q_DYpLw7Ao3yHSN_wFUQ3bERPIFPgFrfY= #=qejNmvgIh8EBP114TctE94g==)
#=q_octEiUXKXnjuC6rJosOYoth_mEuq61pUsLsGuyCHWo=.#=qolRwnq$Potbn8UAcREcoOg== (.#=qUpxaRDWfz4L9h0YOFBhrKZgTCq2dZPSwILpz2FjqARs= #=quOkAYpSgRetYl4IM1ZvbyA==, Int32 #=qzxVcSUWObOJRMLkTmquD6Q==, System.String #=qRfKpCtpb$wBahQKs3C6SFw==, .#=qYm0aR3GgG_Q_DYpLw7Ao3yHSN_wFUQ3bERPIFPgFrfY= #=qPf_nQ89Jwy63nLz$bHyMhQ==)
#=q_dDr9uqZDblMLqG35BhrbQFxAZ8l25NRRWLZmieUd1E=.#=qcDqjUaj9ETMa3rzTaHbPuA== (Int32 #=qiSzWBn9tFeX4RatWifns9A==, System.String #=qleJaG5Sp0COdb8XEmdK4qA==, .#=qUpxaRDWfz4L9h0YOFBhrKZgTCq2dZPSwILpz2FjqARs= #=qEXby$eSEB8g8j0T4PK9TPg==)
Sqo.Siaqodb.LoadValue (Int32 oid, System.String fieldName, Sqo.MetaType mt)
Adon.Localstore.DbFactory.GetDbInstance (System.String name) (at Assets/Scripts/LocalStore/DBFactory.cs:49)
UnityEngine.Debug:LogException(Exception)
Adon.Localstore.DbFactory:GetDbInstance(String) (at Assets/Scripts/LocalStore/DBFactory.cs:55)

Maybe this could help!

Siaqodb Support

unread,
Jul 18, 2016, 2:36:46 AM7/18/16
to Siaqodb - NoSQL embedded database for .NET, mh.ma...@gmail.com
hi there,
It seems you are using a quite old version of Siaqodb - version 3.x, right?
For what platform are you using it?
Can you copy the database files on a Windows machine and try to open with SiaqodbManager?
If the data is not confidential, can you send your entire database to support at siaqodb? Please also attach your types definitions/classes.

mh.ma...@gmail.com

unread,
Jul 19, 2016, 12:56:24 AM7/19/16
to Siaqodb - NoSQL embedded database for .NET, mh.ma...@gmail.com
Hi,

I am using SiaqoDB ver 4.0.2.29 for some reasons. I also tried this with latest version of SiaqoDB and the error still happens!
This error happens in both windows (Unity Editor) and Android device.
When I open buggy DB (before updating model) using SiaqodbManager it can not connect to it. In fact when I click on connect button nothing happens and DB Info shows nothing. But when I use new release of Siaqodb (version 5.5 of siaqodb.dll) and when using SiaqodbManager, when I open database it opens data and the two types that I'm storing. (InventoryItem, Player) the "InventoryItem" works fine, but when I click on "Player" type the UI is kind of buggy and It shows two rows at first (but I only saved one player in db) and only default values is set for second row, and when I move slider to see other columns value UI misbehave and this prompt goes up:

Microsoft.NETFramework
Unhandled exception has occured in a component of in your app ...
Details:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentException: Decimal byte array constructor requires an array of length four containing valid decimal bytes.
   at System.Decimal.SetBits(Int32[] bits)
   at #=qkS7qr_AmwNwScmk0cpvrZjpeEOL6xvRhjK94W4Z$oxU=.#=qK6mvex8cSHcQu$gM1HiQ6d_tRnNfIvbQ6SblYOr7NIg=(Type #=q2wrJ8HYAY_Apw_PqBKDPjw==, Byte[] #=qXW5EKYs3Ssc7j4JN2T3Csw==, Int32 #=qWTOElLu2GOQzy3aYzvIWXw==)
   at #=qkS7qr_AmwNwScmk0cpvrZjpeEOL6xvRhjK94W4Z$oxU=.#=qK6mvex8cSHcQu$gM1HiQ6d_tRnNfIvbQ6SblYOr7NIg=(Type #=q2wrJ8HYAY_Apw_PqBKDPjw==, Byte[] #=qXW5EKYs3Ssc7j4JN2T3Csw==, Boolean #=qhNhifeMf2SZEU2IVm0OHbQ==, Int32 #=qWTOElLu2GOQzy3aYzvIWXw==)
   at #=qMarM4VdKpJeQ0sz4V6Fc4MQCBH0LYQXGL_ayTBD6_8ZHeYSCXQ90YN8H_nI9qpMo.#=qX4uI7QFTi79xfwFgE9$JYg==(Byte[] #=qXW5EKYs3Ssc7j4JN2T3Csw==, LightningTransaction #=qgYzAurwxyI36tIdqSaps0A==)
   at #=qJIoiedwmp9DGTVnT3WVqz2fyMWB_idVNoOYiDvyWbW8=.#=qrNLtDEE8ZQkzIfhhqFoUtg==(#=qy6sDhRkWAFjec_MEF_6xC4YTnrWTyH5Dg9Vxk3NQ9Ik= #=qLzPbJnzbjpGOY8K9N50CTQ==, Int32 #=qcoZtselM9lrgCH$pz9dQBQ==, Byte[] #=qVquKB4ipy6kEASvyalkB9w==, #=q8W6EuRaKSBbwWUwQst3tccRu6MVEbBf_1EkWZ6BOVgk= #=qI22hvrEAeqINR3lEUvUBjw==, #=qasjfsFJmPQgUoIV8Hthpq$8VTUCoTk0u3BbUVariLUw= #=qXoZrFsEPlhrvJ8XMaNwJvw==, LightningTransaction #=qgYzAurwxyI36tIdqSaps0A==)
   at #=qJIoiedwmp9DGTVnT3WVqz2fyMWB_idVNoOYiDvyWbW8=.#=qrNLtDEE8ZQkzIfhhqFoUtg==(#=qy6sDhRkWAFjec_MEF_6xC4YTnrWTyH5Dg9Vxk3NQ9Ik= #=qLzPbJnzbjpGOY8K9N50CTQ==, Int32 #=qcoZtselM9lrgCH$pz9dQBQ==, Byte[] #=qVquKB4ipy6kEASvyalkB9w==, String #=qE3Iyrti2XMqF38xPLKD3hg==, #=qasjfsFJmPQgUoIV8Hthpq$8VTUCoTk0u3BbUVariLUw= #=qXoZrFsEPlhrvJ8XMaNwJvw==, LightningTransaction #=qgYzAurwxyI36tIdqSaps0A==)
   at #=qd76VFhgLOwNAVa1cHV6I$xjDDRTTjPbUW33p8aldewQ=.#=qNwB_b3ZQ8FBPRgJhCnoUDw==(Int32 #=qcoZtselM9lrgCH$pz9dQBQ==, String #=qE3Iyrti2XMqF38xPLKD3hg==, #=qy6sDhRkWAFjec_MEF_6xC4YTnrWTyH5Dg9Vxk3NQ9Ik= #=qLzPbJnzbjpGOY8K9N50CTQ==, LightningTransaction #=qgYzAurwxyI36tIdqSaps0A==)
   at Sqo.Siaqodb.LoadValue(Int32 oid, String fieldName, MetaType mt)
   at -.IllliIiiilli. (Object , DataGridViewCellValueEventArgs )
   at System.Windows.Forms.DataGridView.OnCellValueNeeded(DataGridViewCellValueEventArgs e)
   at System.Windows.Forms.DataGridView.OnCellValueNeeded(Int32 columnIndex, Int32 rowIndex)
   at System.Windows.Forms.DataGridViewCell.GetValue(Int32 rowIndex)
   at System.Windows.Forms.DataGridViewTextBoxCell.GetPreferredSize(Graphics graphics, DataGridViewCellStyle cellStyle, Int32 rowIndex, Size constraintSize)
   at System.Windows.Forms.DataGridViewCell.GetPreferredWidth(Int32 rowIndex, Int32 height)
   at System.Windows.Forms.DataGridViewCell.OnCellDataAreaMouseEnterInternal(Int32 rowIndex)
   at System.Windows.Forms.DataGridViewCell.OnMouseMoveInternal(DataGridViewCellMouseEventArgs e)
   at System.Windows.Forms.DataGridView.OnCellMouseMove(DataGridViewCellMouseEventArgs e)
   at System.Windows.Forms.DataGridView.UpdateMouseEnteredCell(HitTestInfo hti, MouseEventArgs e)
   at System.Windows.Forms.DataGridView.OnMouseMove(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseMove(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.81.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
SiaqodbManager
    Assembly Version: 5.0.0.0
    Win32 Version: 5.0
    CodeBase: file:///C:/Users/MHM/Downloads/Programs/SiaqodbManager%205.5/x64/SiaqodbManager.exe
----------------------------------------
PresentationFramework
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.81.0
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.dll
----------------------------------------
WindowsBase
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.81.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/WindowsBase/v4.0_4.0.0.0__31bf3856ad364e35/WindowsBase.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.81.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
PresentationCore
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.81.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_64/PresentationCore/v4.0_4.0.0.0__31bf3856ad364e35/PresentationCore.dll
----------------------------------------
System.Xaml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.81.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xaml/v4.0_4.0.0.0__b77a5c561934e089/System.Xaml.dll
----------------------------------------
AvalonDock
    Assembly Version: 1.3.3571.0
    Win32 Version: 1.3.3571
    CodeBase: file:///C:/Users/MHM/Downloads/Programs/SiaqodbManager%205.5/x64/AvalonDock.DLL
----------------------------------------
PresentationFramework.Aero2
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.81.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework.Aero2/v4.0_4.0.0.0__31bf3856ad364e35/PresentationFramework.Aero2.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.81.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.81.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.81.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
PresentationFramework-SystemXml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/PresentationFramework-SystemXml/v4.0_4.0.0.0__b77a5c561934e089/PresentationFramework-SystemXml.dll
----------------------------------------
WindowsFormsIntegration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.81.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/WindowsFormsIntegration/v4.0_4.0.0.0__31bf3856ad364e35/WindowsFormsIntegration.dll
----------------------------------------
UIAutomationTypes
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.81.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/UIAutomationTypes/v4.0_4.0.0.0__31bf3856ad364e35/UIAutomationTypes.dll
----------------------------------------
Siaqodb
    Assembly Version: 5.5.0.3
    Win32 Version: 5.5.0.3
    CodeBase: file:///C:/Users/MHM/Downloads/Programs/SiaqodbManager%205.5/x64/Siaqodb.DLL
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.81.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.6.81.0 built by: NETFXREL2
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
ICSharpCode.AvalonEdit
    Assembly Version: 4.0.0.6842
    Win32 Version: 4.0.0.6842
    CodeBase: file:///C:/Users/MHM/Downloads/Programs/SiaqodbManager%205.5/x64/ICSharpCode.AvalonEdit.DLL
----------------------------------------
UIAutomationProvider
    Assembly Version: 4.0.0.0
    Win32 Version: 4.0.30319.33440 built by: FX45W81RTMREL
    CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/UIAutomationProvider/v4.0_4.0.0.0__31bf3856ad364e35/UIAutomationProvider.dll
----------------------------------------


I will send my data and my model
Reply all
Reply to author
Forward
0 new messages