umbraco / Umbraco.Forms.Issues

Public issue tracker for Umbraco Forms
30 stars 0 forks source link

On Approve workflow throws exception #914

Open AaronSadlerUK opened 2 years ago

AaronSadlerUK commented 2 years ago

A brief description of the issue goes here.

When adding a "Send Email" within the "On Approve" workflows it throws the following exception:

ObjectDisposedException: Cannot access a disposed object. Object name: 'snapshot'.
Umbraco.Cms.Infrastructure.PublishedCache.ContentStore+Snapshot.Get(int id)
Umbraco.Cms.Infrastructure.PublishedCache.ContentCache.GetById(bool preview, int contentId)
Umbraco.Forms.Core.Services.PublishedContentPageService.GetContent(IPublishedContentCache contentCache, int contentId)
Umbraco.Forms.Core.Services.PublishedContentPageService.GetContent(Nullable<int> contentId)
Umbraco.Forms.Core.Services.PublishedContentPageService.GetPageElements()
Umbraco.Forms.Core.Services.WorkflowExecutionService.ApplyCustomSettingsToWorkflow(Record record, IWorkflow workflow, WorkflowType type, Form form)
Umbraco.Forms.Core.Services.WorkflowExecutionService.ExecuteWorkflows(List<IWorkflow> workflows, Record record, Form form, FormState state)
Umbraco.Forms.Core.Services.WorkflowExecutionService.ExecuteWorkflows(Record record, Form form, FormState state, bool editMode)
Umbraco.Forms.Core.Services.RecordService.Approve(Record record, Form form)
Umbraco.Forms.Core.Services.RecordService.Submit(Record record, Form form)
Umbraco.Forms.Web.Controllers.UmbracoFormsController.SubmitForm(Form form, FormViewModel model)
Umbraco.Forms.Web.Controllers.UmbracoFormsController.GoForward(Form form, FormViewModel model)
Umbraco.Forms.Web.Controllers.UmbracoFormsController.HandleForm(FormViewModel model)
lambda_method8045(Closure , object , object[] )
Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor+SyncActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, object controller, object[] arguments)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, object state, bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
Umbraco.Cms.Web.Common.Middleware.BasicAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext()
Umbraco.Cms.Web.BackOffice.Middleware.BackOfficeExternalLoginProviderErrorMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext()
Skybrud.Umbraco.Redirects.Middleware.RedirectsMiddleware.InvokeAsync(HttpContext context)
Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
SixLabors.ImageSharp.Web.Middleware.ImageSharpMiddleware.Invoke(HttpContext httpContext, bool retry)
StackExchange.Profiling.MiniProfilerMiddleware.Invoke(HttpContext context) in MiniProfilerMiddleware.cs
Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
Umbraco.Cms.Web.Common.Middleware.UmbracoRequestMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext()
Umbraco.Cms.Web.Common.Middleware.PreviewAuthenticationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext()
Umbraco.Cms.Web.Common.Middleware.UmbracoRequestLoggingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext()
Our.Umbraco.MaintenanceMode.Middleware.MaintenanceRedirectMiddleware.InvokeAsync(HttpContext context, IBackofficeUserAccessor backofficeUserAccessor)
Umbraco.Forms.Web.HttpModules.ProtectFormUploadRequestsMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
Microsoft.AspNetCore.Builder.UseMiddlewareExtensions+<>c__DisplayClass6_1+<<UseMiddlewareInterface>b__1>d.MoveNext()
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

Reproduction

If you're filing a bug, please describe how to reproduce it. Include as much relevant information as possible, such as:

Bug summary

Create a form and add the "Send Email" workflow "On Approve"

Specifics

Steps to reproduce

Try to submit the form

Expected result

Form to submit

Actual result

Exception thrown

AndyButland commented 2 years ago

Hi @AaronSadlerUK - thanks for reporting, but I can't immediately replicate this. Could you let me know the versions of Forms and CMS you are running please? Thanks.

AaronSadlerUK commented 2 years ago

@AndyButland I've done some digging on this...

If I add "Send Email" to "On Approve" and the "Moderation" setting is off I get the above error, if I set the "Moderation" setting on then it works with no error 😕

Umbraco: 10.2.1 Forms: 10.1.3

AndyButland commented 2 years ago

Thanks again, though unfortunately still not able to replicate. I've seen a few instances of that error message on the various Umbraco forums and GitHub issue trackers, Nothing obvious, but it leads me to ask you have other workflows running before this - i.e. in the "submit" stage?

If so, can you try removing them to see if that clears the problem please?

And if it does, can you share any details of what workflows you do have running that do then trigger the error?

AaronSadlerUK commented 2 years ago

I have a custom workflow which runs before it, however this error happens regardless of that.

I'll see if I can record something