2

I'm recently working on a asp.net web application. that use linq to sql ORM to data access layer (DAL). In a specific case of my queries faces with stackoverflow exception on clr Level.

i use filter expression generator to get specific data (such as load with specific constrient) that we send more than 1500 parameters to the store procedure.

NOTE: we consider RPC (Remote Procedure Calling) limitation that's exactly 2100 parameters in sql server default setting.

but i don't know why i face with stackoverflow exception? it's interesting to know this problem only occur on iis and no problem in asp.net web development server.

and i'm nearly find out problem that be caused the large number of parameters.

i was grateful from someone that help me?

Exception Detail

 public List<HSEPersonnelComplexPaging> SelectHSEPersonnelPaging(PagingPropertiesDTO pagingProps, out int recCount)
    {
        using (HRPaidTimeOffDataContext db = new HRPaidTimeOffDataContext(DBHelper.GetConnectionString()))
        {
            Expression<Func<HSEPersonnelComplexPaging, bool>> expr =
                PredicateBuilder.GetFilterExpression<HSEPersonnelComplexPaging>(pagingProps);
            db.DeferredLoadingEnabled = false;

            var items = from at in db.HSEPersonnels
                        where at.IsDeleted == false
                        select new HSEPersonnelComplexPaging
                        {
                            ID = at.HSEPersonnelId,
                            PersonnelyNo = at.PersonnelyNo,
                            Name = at.Name,
                            Family = at.Family,
                            BirthPlace = at.BirthPlace,
                            Birthdate = at.Birthdate,
                            Father = at.Father,
                            IdNo = at.IdNo,
                            NationalCode = at.NationalCode,
                            IsNotActive =  at.IsNotActive,
                            IsDeleted = at.IsDeleted,
                            InsertDate = at.InsertDate,
                            UpdateDate = at.UpdateDate,
                            InsertENTUserAccountId = at.InsertENTUserAccountId

                        };
            var result = items.Where(expr);
            recCount = result.Count();
            return
                result.ApplySortExpression(pagingProps.SortSet).Skip(pagingProps.CurrentPageIndex *
                                                                     pagingProps.CurrentPageSize).Take(
                                                                         pagingProps.CurrentPageSize).ToList();
        }
5
  • Why return a list rather than an IEnumerable? Commented Jul 23, 2013 at 11:37
  • 1
    Try to resolve from stackoverflow.com/questions/1119678/… Commented Jul 23, 2013 at 11:48
  • 3
    "we send more than 1500 parameters to the store procedure" - oh my. Commented Jul 23, 2013 at 11:58
  • 1
    @doctorlove to resolve load by paging i exactly need list<T> and record count to telerik radgrid UI. Commented Jul 23, 2013 at 11:59
  • @CodeCaster ,oh yeah in Linq To Sql we can'nt send table value paramter to query!!! Commented Jul 23, 2013 at 12:01

2 Answers 2

1

The problem might lie in the predicate you're building. When you enumerate the expression (which you're doing in the call to Count()), LINQ to SQL will walk down the expression tree to determine what it is you're trying to query. Is it possible that somewhere you're creating a cyclic reference?

Sign up to request clarification or add additional context in comments.

2 Comments

yes my expression tree in this case is so long,but there's no way to send table value parameter to the query in Linq To SQL! do you have suggest for me?
Create a temporary table; store your data in there and reference the temporary table in your LINQ query. Much more robust anyway.
1

maybe this is a some kind of explanation: http://support.microsoft.com/kb/932909 All child processes created by IIS have a 256kb stack size

Try this weird thing:

Thread thread = new Thread(() => YourMethod(),4194304);
thread .Start();
thread .Join();

The point is to execute your method in a separate thread that has a bigger stack size..

2 Comments

I've never seen the 'limited' stack size be a problem. IMO, if you need to execute code that way, you're doing something wrong.
I've never seen it also. This is why I wrote "weird thing".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.