Question

Photo of Tommy Prater

0

Entity Framework error on History Tab

Could anyone lead me in the right direction of this error? I get it when trying to view the "History" tab of a profile:

Exception in App_Code.tlgeo4oj

Message
An error occurred in Entity Framework when attempting to connect to your database. This could be caused by a missing 'MultipleActiveResultSets=true' parameter in your connection string settings.

Stack Trace
 at RockWeb.Global.Application_Error(Object sender, EventArgs e)


- EntityCommandExecutionException in EntityFramework

Message
An error occurred while reading from the store provider's data reader. See the inner exception for details.

Stack Trace
 at System.Data.Entity.Core.Common.Internal.Materialization.Shaper`1.HandleReaderException(Exception e)
 at System.Data.Entity.Core.Common.Internal.Materialization.Shaper`1.StoreRead()
 at System.Data.Entity.Core.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
 at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
 at Rock.Model.GroupTypeService.GetAllCheckinGroupTypePaths()
 at RockWeb.Blocks.Checkin.AttendanceHistoryList.BindGrid()
 at RockWeb.Blocks.Checkin.AttendanceHistoryList.OnLoad(EventArgs e)
 at System.Web.UI.Control.LoadRecursive()
 at System.Web.UI.Control.LoadRecursive()
 at System.Web.UI.Control.LoadRecursive()
 at System.Web.UI.Control.LoadRecursive()
 at System.Web.UI.Control.LoadRecursive()
 at System.Web.UI.Control.LoadRecursive()
 at System.Web.UI.Control.LoadRecursive()
 at System.Web.UI.Control.LoadRecursive()
 at System.Web.UI.Control.LoadRecursive()
 at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


-- SqlException in .Net SqlClient Data Provider

 Message
The statement terminated. The maximum recursion 100 has been exhausted before statement completion.

Stack Trace
 at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
 at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
 at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
 at System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)
 at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)
 at System.Data.SqlClient.SqlDataReader.Read()
 at System.Data.Entity.Core.Common.Internal.Materialization.Shaper`1.StoreRead()

  • Tommy Prater

    I have narrowed it down to the attendance history block that is causing the issue. I denied access to that block and the page loads normally now. Any one have any thoughts on what to check?

  • Photo of Tommy Prater

    0

    Thankful for the community here is how to solve the issue:


    https://rockrms.slack.com/archives/sql/p1474557317000095

    Here is some code to see if you have a recursion:

    WITH TreeCrawler as ( SELECT gta.GroupTypeId, gta.ChildGroupTypeId, 1 AS Depth FROM [GroupTypeAssociation] gta UNION ALL SELECT gta2.GroupTypeId, gta2.ChildGroupTypeId, tc.Depth + 1 FROM [GroupTypeAssociation] gta2 INNER JOIN TreeCrawler tc ON tc.GroupTypeId = gta2.ChildGroupTypeId WHERE tc.Depth < 20 AND gta2.GroupTypeId != gta2.ChildGroupTypeId ) SELECT GroupTypeId, ChildGroupTypeId FROM TreeCrawler tc WHERE Depth > 19 GROUP BY GroupTypeId, ChildGroupTypeId

  • Photo of Jim Michael

    0

    I think you've created a circular reference in your groups somewhere. Pretty sure I've seen this in the Slack group, but don't remember the fix. Try pinging chrisrea back there... pretty sure he's the one who had the issue recently.