-
Notifications
You must be signed in to change notification settings - Fork 19
Getting IndexOutOfRange exception when initializing BlazorDB #12
Comments
Hi @ebekker - first thanks for using BlazorDB! Second, can you send me a small code sample to recreate the problem? |
Some more details about my setup, I'm using the latest BlazorDB at the time, referenced from NuGet: I basically followed along the sample from the project's readme with my own model objects. Here are my relevant classes:
public class Context : StorageContext
{
public StorageSet<BlazorAccount> Accounts { get; set; }
public StorageSet<BlazorOrder> Orders { get; set; }
}
public class BlazorAccount
{
public int Id { get; set; }
[Required]
public AccountDetails Details { get; set; }
}
public class BlazorOrder
{
public int Id { get; set; }
[Required]
public BlazorAccount Account { get; set; }
[Required]
public OrderDetails Details { get; set; }
} To keep things simple, I haven't included namespaces or the specifics of the nested Details type classes, but if that will help or you think may be part of the problem, I'll be happy to include. |
Actually, you can easily get at the type info for AccountDetails and OrderDetails in the originating repo. Not sure if it's significant, but these types are themselves simple DTO objects, but they are marked up with Newtonsoft attributes to control serialization. |
@chanan, you beat me to it! Was still working on providing details. Let me know if you need more details, I can actually commit the code base at this point if you want to see what I'm working with? |
@ebekker thanks for the repo details, I am travelling today, so I will look at it tomorrow. |
Sounds good -- I actually just committed whatever I had at this point so you can see exactly what I was doing, you can see the commit here. Additionally, in case this is useful, I'm running this in Chrome and here's a snapshot of what my Local Storage Keys look like:
|
Looks like this PR in Blazor 0.4.0: dotnet/blazor#746 camelCased all json property names Currently I need to string parse the json to do the object relationships, therefore, all the string manipulations broke after 0.4.0. As an aside, it would be great to not do string parsing, but since the only other way I can think about doing it is with Dynamic and that doesn't currently work in Blazor. Anyway, will fix BlazorDB to adhere to the new Json format and publish a new version. |
This is taking a bit longer than I thought. I beleive I fixed the initial problem. The issue now is that somethings in the sample apps that I use to test the functions don't work in V0.4 anymore. So, now fixing the sample apps. |
After adding two records to a
StorageSet
, during setup of theBrowserServiceProvider
, and callingAddBlazorDB
, getting anIndexOutOfRangeException
:Here's the full stack trace:
The text was updated successfully, but these errors were encountered: