Wednesday, 28 August 2013

Intermitten System.InvalidOperationException: The specified cast from a materialized

Intermitten System.InvalidOperationException: The specified cast from a
materialized

Currently we are running EF 4.0 with , using the repository and Unit Of
Work design patterns. Each page request creates its' own ObjectContext for
capturing data in the unit of work and throughout the lifecycle of the
page, uses this one objectcontext.
We now, in production only, have the below error occur intermittently, on
average maybe once every week or two. The only way to resolve the issue is
to reset the IIS AppPool. Once this error starts, it cascades across the
entire site and can occur on any page for any and all users for any DB
calls through EF. For instance, we had on 8/27 the first occurrence at
1:19PM and over 500 occurrences after that until the app pool reset at
1:26PM. This does not correlate to spikes in usage or any other pattern we
can detect.
Is there any way to determine the culprit? It also seems to corrupt our
event viewer each time this happens.
System.InvalidOperationException: The specified cast from a materialized
'System.Int32' type to the 'System.Boolean' type is not valid. at
System.Data.Common.Internal.Materialization.Shaper.ErrorHandlingValueReader1.GetValue(DbDataReader
reader, Int32 ordinal) at
System.Data.Common.Internal.Materialization.Shaper.GetColumnValueWithErrorHandling[TColumn](Int32
ordinal) at
System.Data.Common.Internal.Materialization.Coordinator1.ReadNextElement(Shaper
shaper) at
System.Data.Common.Internal.Materialization.Shaper1.SimpleEnumerator.MoveNext()
at System.Linq.Enumerable.Single[TSource](IEnumerable1 source) at
System.Linq.Queryable.Any[TSource](IQueryable1 source, Expression1
predicate) at
BSAH.eCommerce.SitefinityWebApp.ButlerModules.UserProfile.UI.UserProfile.ShowUserGroupMaintenanceLink(User
user) in
c:\b\8\ButlerScheinCom\BSCom_Prod_ECom_Web_Compile\Sources\BSAH.Web\Presentation
Layer\ButlerModules\UserProfile\UI\BSCUserProfile.ascx.cs:line 694 at
BSAH.eCommerce.SitefinityWebApp.ButlerModules.UserProfile.UI.UserProfile.SetupLoginControls(Boolean
logoutVisiblility) in
c:\b\8\ButlerScheinCom\BSCom_Prod_ECom_Web_Compile\Sources\BSAH.Web\Presentation
Layer\ButlerModules\UserProfile\UI\BSCUserProfile.ascx.cs:line 631 at
BSAH.eCommerce.SitefinityWebApp.ButlerModules.UserProfile.UI.UserProfile.Page_Load(Object
sender, EventArgs e) in
c:\b\8\ButlerScheinCom\BSCom_Prod_ECom_Web_Compile\Sources\BSAH.Web\Presentation
Layer\ButlerModules\UserProfile

No comments:

Post a Comment