Vibrant discussion about CSLA .NET and using the framework to build great business applications.
Unable to cast object of type 'Csla.Server.DataPortalException' to type 'Csla.Server.DataPortalResult'
is this web service error or code error can one give me the clear scenario about this ....
Thanks.
Error and valid results are usually not the same. If you could give the code snippet, where the cast occurs or at least the call.
Hi stefan,
here the call stack for the error....it happens while it try to call the WCF web service.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidCastException: Unable to cast object of type 'Csla.Server.DataPortalException' to type 'Csla.Server.DataPortalResult'.Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [InvalidCastException: Unable to cast object of type 'Csla.Server.DataPortalException' to type 'Csla.Server.DataPortalResult'.] HIA.BM.BL.CSLAClasses.HIADataPortal.Fetch(Type objectType, Object criteria) +388 HIA.BM.BL.CSLAClasses.HIADataPortal.Fetch(Object criteria) +50 HIA.BM.BL.CollectionClasses.ModulePermissionsCollection.GetHIAModuleCollection() +640 HIA.BM.Web.Controllers.AccountController.Login(String username, String password, Boolean rememberMe, String returnUrl) +711 lambda_method(Closure , ControllerBase , Object[] ) +284 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +248 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39 System.Web.Mvc.<>c__DisplayClassa.<InvokeActionMethodWithFilters>b__7() +126 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +641 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +641 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +312 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +741 System.Web.Mvc.Controller.ExecuteCore() +198 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +195 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +597 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +266 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
[InvalidCastException: Unable to cast object of type 'Csla.Server.DataPortalException' to type 'Csla.Server.DataPortalResult'.] HIA.BM.BL.CSLAClasses.HIADataPortal.Fetch(Type objectType, Object criteria) +388 HIA.BM.BL.CSLAClasses.HIADataPortal.Fetch(Object criteria) +50 HIA.BM.BL.CollectionClasses.ModulePermissionsCollection.GetHIAModuleCollection() +640 HIA.BM.Web.Controllers.AccountController.Login(String username, String password, Boolean rememberMe, String returnUrl) +711 lambda_method(Closure , ControllerBase , Object[] ) +284 System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +248 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +39 System.Web.Mvc.<>c__DisplayClassa.<InvokeActionMethodWithFilters>b__7() +126 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +641 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +641 System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +312 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +741 System.Web.Mvc.Controller.ExecuteCore() +198 System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +195 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +597 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +266
This is occuring in CSLA 4 version 4.3.x?
Rocky
It's occurring in CSLA 4 version...........
it's occurring in CSLA 4.0.0.0 version...........
This obviously happens in the class HIADataPortal - which is not a part of CSLA.
It seems lke you have implemented your own HIADataPortal and there is a bug in this class - NOT CSLA. .
Jonny Bekkum, Norway CslaContrib Coordinator