Home > Forum > General > ex.System.InvalidCastException

ex.System.InvalidCastException
0

Hi, I have problem with moving workflow from one step to another step. I mean if i create a workflow with 3 basic steps (start, intermediate, end(positive)) on those steps i set up paths with task creation on business rule level and i set up myself (my account).
When I try to open that application in portal then on first step everything is ok and i can sent task to second (intermediate) step.
AND here is a problem when i try move task from that step or even when i try open task in Admin mode or remove task i get the same error with is:
msg: An unhandled exception has occurred while executing the request. | agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36 | href: | ex: System.InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'.
at WebCon.WorkFlow.Base.Managers.ElementCheckoutsRepository.UpdateOrTakeOverParameters.UpdateAfterUpdateTime(WFElementCheckout checkout, SqlCommand updateCommand)
at WebCon.WorkFlow.Base.Managers.ElementCheckoutsRepository.UpdateTimeOnCheckoutWithStealing(Int32 wfdId, String userLogin, String userName, String hostIpAddress, Int32 expirationTime, Int32 checkoutTimeOffset, Boolean forceCheckout)
at WebCon.WorkFlow.Base.BusinessLogic.ElementManagement.CheckOutManager.TryCheckOutElement(Int32 wfdId, IBpsAccount user, String hostIpAddress, WFElementCheckout& currentCheckout, Boolean forceCheckout)
at WebCon.WorkFlow.Base.BusinessLogic.ElementManagement.ViewEdit.FormViewEditInfoProvider.TryCheckOut(FormViewEditInfo info)
at WebCon.WorkFlow.Base.BusinessLogic.ElementManagement.ViewEdit.FormViewEditInfoProvider.Provide()
at WebCon.WorkFlow.Base.BusinessLogic.ElementManagement.ElementFormObjects.DocumentUsers.ElementFormDocumentUsersLoader.TryCheckOut()
at WebCon.WorkFlow.Base.BusinessLogic.ElementManagement.ExistingElementFormCreator.GetExistingElementForm(GetExistingElementFormParams args)
at WebCon.BPSCloud.Core.WfDynamic.Helpers.WFDynamicFormLoaderLogic.GetExistingElementForm()
at WebCon.BPSCloud.Core.WfDynamic.Helpers.WFDynamicFormLoaderLogic.LoadProperForm()
at WebCon.BPSCloud.Core.WfDynamic.WFDynamicLiteManager.LoadJsModel(IWFDynamicFormLoader formLoader, WFDynamicFormLoaderParams formLoaderParams, DisplayMode displayMode)
at WebCon.BPSCloud.Core.Elements.ExistingElementsManager.Get(ElementInfo existenceAndMode, DisplayMode displayMode)
at WebCon.BPSCloud.Core.Elements.ExistingElementsManager.GetDesktop(Boolean isCompact)
at WebCon.BPSCloud.Core.Elements.ExistingElementsManager.GetDesktop()
at WebCon.BPSCloud.Portal.API.FormConfigChangedController.Get(IElementsManager elementsManager, String displayMode)
at WebCon.BPSCloud.Portal.API.FormsController.Get(Int32 wfdId, String displayMode, String editMode, Nullable`1 historicalVersionId, Boolean isStandardMode, Nullable`1 workFlowId, Nullable`1 docTypeId)
at lambda_method2306(Closure , Object , Object[] )
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Logged|12_1(ControllerActionInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
at WebCon.BPSCloud.Portal.Extensions.LicenceSetupMiddleware.InvokeAsync(HttpContext context)
at JSNLog.JSNLogMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at WebCon.BPSCloud.Portal.Extensions.RouteValuesTypeVerificationMiddleware.InvokeAsync(HttpContext context)
at WebCon.BPSCloud.Portal.Extensions.DesignerDesk.DesignerDeskActiveContextMiddleware.NotActive(HttpContext context)
at WebCon.BPSCloud.Portal.Extensions.DesignerDesk.DesignerDeskActiveContextMiddleware.InvokeAsync(HttpContext context)
at WebCon.BPSCloud.Portal.Extensions.DebugInfo.DebugInfoMiddleware.Invoke(HttpContext context, IDebugInfoGetter debugInfoGetter, IPerformanceCounterFactory counterFactory, IFrontendTraceProvider formatter, IDefaultableDbInfoProvider defaultableDbInfoProvider, IUserCredentialsManager userCredentialsManager, IDebugInfoManager debugInfoManager, IHttpContext synchronizedHttpCtx)
at WebCon.BPSCloud.Portal.Extensions.RestApiLogging.RestApiLoggingMiddleware.Invoke(HttpContext context, IPerformanceCounterFactory counterFactory, IVersionPathParser versionParser, ICurrentUserProvider userProvider, IRestApiLoggingManager restApiLoggingManager)
at WebCon.BPSCloud.Portal.Extensions.RestApiLogging.RestApiStatusCodeMiddleware.Invoke(HttpContext context, IApiLogger apiLogger)
at WebCon.BpsCloud.IdentityServer.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events)
at WebCon.BpsCloud.IdentityServer.Hosting.MutualTlsTokenEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at WebCon.BpsCloud.IdentityServer.Hosting.BaseUrlMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
at WebCon.BPSCloud.Portal.Extensions.DesignerDesk.DesignerDeskContextMiddleware.InvokeAsync(HttpContext context)
at WebCon.BPSCloud.Portal.Extensions.MainContext.MainContextMiddleware.Invoke(HttpContext context, IDbRegistrator dbRegistrator, IHttpContextAccessor httpContextAccessor)
at WebCon.BPSCloud.Portal.Extensions.Transactions.TransactionManagerMiddleware.Invoke(HttpContext context, ITransactionMgrFactorySetter transactionMgrFactorySetter)
at WebCon.BPSCloud.Identity.MSOFBA.MSOFBAuthenticationMiddleware.Invoke(HttpContext context)
at WebCon.BPSCloud.Identity.Token.TokenEnforceMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.ResponseCaching.ResponseCachingMiddleware.Invoke(HttpContext httpContext)
at Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)


What can be the problem here? I guess maybe something with the configuration but checked everything and it seems to be ok. Any suggestions?

MVP

Hi Patryk,

as far as I can tell it's somehow related to the automatic checkout of the current workflow instance to the user. I haven't seen this before so my only ideas right now are:

1) Does your account has values for display name and mail address? I'm asking this because if either is null then the error message could be related, Unable to cast object of type 'System.DBNull' to type 'System.String'.

2) Does this happen only immediately or also when you come back some time later? In case the element is actually checked out, it should be checked in after some time without interaction/active session to the workflow instance.

Best regards,
Daniel