This project has moved and is read-only. For the latest updates, please go here.

Stackoverflow exception when using tables with a large amount of columns

Aug 19, 2013 at 6:43 PM
When the model contains a table with a large number of columns, 250+ (this is a legacy database that wouldn't be easy to change) a Stackoverflow exception is raised. In this particular scenario I've created a persistent connection specifying a data loader (the data loader points to a folder that contains the CSV import files, one of which is for the table that contains the 250+ columns).

The connection is created fine, however, as soon as I attempt to query the aforementioned table I receive a Stackoverflow exception.
Aug 21, 2013 at 12:08 PM
Thank you for reporting this issue. Might I ask you to provide the call stack?
Sep 2, 2013 at 11:34 AM
Apologies for my late response... the call stack when I hit the StackOverflow is:

[External Code]
Effort.dll!Effort.Provider.EffortDataReader.EffortDataReader(System.Collections.IEnumerable result, int recordsAffected, Effort.Internal.Common.FieldDescription[] fields, Effort.Internal.DbManagement.DbContainer container) Line 56 + 0xf bytes C#
Effort.dll!Effort.Internal.CommandActions.QueryCommandAction.ExecuteDataReader(Effort.Internal.CommandActions.ActionContext context) Line 110 + 0x66 bytes C#
Effort.dll!Effort.Provider.EffortEntityCommand.ExecuteDbDataReader(System.Data.CommandBehavior behavior) Line 133 + 0xf bytes C#
[External Code]
inspHire.Corporate.DataServices.Repositories.dll!inspHire.Corporate.DataServices.Repositories.StaticExt.ByCode(System.Linq.IQueryable<inspHire.Corporate.DataServices.EF.STATIC> records, string parameterSetCode) Line 29 + 0x1a0 bytes C#
inspHire.Corporate.AddIn.EmailInvoices.dll!inspHire.Corporate.AddIn.EmailInvoices.Email.LoadData() Line 87 + 0x20 bytes C#
inspHire.Corporate.Addin.EmailInvoices.Tests.dll!inspHire.Corporate.Addin.EmailInvoices.Tests.EmailInvoiceTests.CheckHistoricalAccountCustomer() Line 121 + 0xd bytes C#
[External Code]

I really hope this helps. Please let me know if you need anything else.
Sep 9, 2013 at 9:38 AM
Interesting, I haven't been able to reproduce yet. Could you show with external code too? What kind of query do you run?
Sep 9, 2013 at 10:35 AM
Thanks for the response... the full call stack with the external code is here.

To replicate the issue I have a model that contains a table (called 'STATIC') which itself contains 442 columns. The code that I'm executing to reproduce the error is:

DbConnection connection = Effort.EntityConnectionFactory.CreatePersistent("name=CorporateDataContext");
CorporateDataContext ctx = new CorporateDataContext(connection);
STATIC sta = ctx.STATICS.FirstOrDefault(s => s.CODE == string.Empty);
Sep 9, 2013 at 1:31 PM
Edited Sep 9, 2013 at 1:38 PM
Okey, I got it. Currently the query pipeline uses anonymous types for carrying data. The constructor of anon types has as many arguments as many properties the anon type has. Probably this ctor call causes the stack overflow. If you used even more properties then the query compilation would fail with OutOfMemory exception. This definitely needs to be fixed, so it is on my todo list now.
Sep 9, 2013 at 1:43 PM
That's good to hear. How long do you think it will be before you have a version with a fix? Only reason I ask is because this is now preventing us from moving forward with the Effort but I'd really like to stick with it if possible because it's such a cool little library and makes unit testing EF a breeze!
Sep 9, 2013 at 9:36 PM
Edited Sep 9, 2013 at 9:36 PM
I will try to fix this asap, hope this week.
Sep 9, 2013 at 10:06 PM
Thanks for the help. Great work!
Sep 10, 2013 at 11:07 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.