StackoverflowException with dynamics in NameValueListBase Dataportal_Fetch

StackoverflowException with dynamics in NameValueListBase Dataportal_Fetch

Old forum URL: forums.lhotka.net/forums/t/11409.aspx


shawndewet posted on Tuesday, June 12, 2012

I've still gotta figure out exactly how to debug this, but it seems there is a problem resulting in a StackoverflowException in NameValueListBase when utilizing Massive (the micro ORM by Rob Conery) to extract the data out of the database.

Basically what happens is this...

List<dynamic> list = tableAccessor.FetchAll();

foreach(dynamic item in list)

 Add(new NameValuePair(item.Code, item.Name)); --> this line results in a StackoverflowException.

 

If I change my code to this...

 

List<dynamic> list = tableAccessor.FetchAll();

string code = "";

string name = "";

foreach(dynamic item in list){

  code = item.Code; --> this line results in a StackoverflowException.

  name = item.Name;

 Add(new NameValuePair(code, name)); 

 

}

Interestingly, if I put a breakpoint on the faulting line, and use the Watch window to peak into the dynamic object, then the Code and Name properties are indeed there as expected.

It should be noted that in other stereotypes (like ReadonlyListBase, BusinessListBase, etc) I use the exact same approach to extract data from the database and it works fine.

So to work around the problem, I have replaced my use of NameValueListBase with ReadOnlyListBase.

(I'm using CSLA 4.3.10).

shawndewet replied on Tuesday, June 12, 2012

what I can't fathom is why the same line of code would run fine in the DataPortal_Fetch of other stereotypes, but runs into a StackoverflowException when run in the DataPortal_Fetch of NameValueListBase.  Does this make sense to anybody out there?

Copyright (c) Marimer LLC