I upgraded Vendr to latest, 2.3.3 from 2.2.0. Now I cannot send confirmation emails. I am using the templateService.SendEmail method to generate and send emails.
The code looks like this
var template = _templateService.GetEmailTemplate(store.Id, "configEmail");
_templateService.SendEmail(template, order, model.EmailAddress, "");
I call it from a controller. The email is rendered just fine, but when the email is sent an exception is thrown
An asynchronous operation cannot be started at this time. Asynchronous operations may only be started within an asynchronous handler or module or during certain events in the Page lifecycle. If this exception occurred while executing a Page, ensure that the Page is marked <%@ Page Async="true" %>.
This is the stack trace
vid System.Net.Mail.SmtpClient.SendAsync(MailMessage message, Object userToken) vid System.Net.Mail.SmtpClient.SendMailAsync(MailMessage message) vid Umbraco.Core.EmailSender.<SendAsync>d__5.MoveNext() i D:\a\1\s\src\Umbraco.Core\EmailSender.cs:rad 74
--- Slut på stackspårningen från föregående plats där ett undantag utlöstes --- vid System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() vid System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) vid Vendr.Core.Pipelines.Email.Tasks.SendEmailTask.<>c__DisplayClass2_0.<<Execute>b__0>d.MoveNext()
--- Slut på stackspårningen från föregående plats där ett undantag utlöstes --- vid System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() vid System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) vid Vendr.Common.Helpers.AsyncHelper.RunSync(Func`1 func) vid Vendr.Core.Pipelines.Email.Tasks.SendEmailTask.Execute(EmailSendPipelineArgs args) vid Vendr.Common.Pipelines.InProcPipelineInvoker.<Vendr.Common.Pipelines.IPipelineInvoker.Invoke>g__next|2_0(PipelineArgs e, <>c__DisplayClass2_0& ) vid Vendr.Common.Pipelines.InProcPipelineInvoker.Vendr.Common.Pipelines.IP ipelineInvoker.Invoke(IEnumerable`1 pipelineTasks, PipelineArgs args) vid Vendr.Common.Pipelines.Pipeline.Invoke[TPipeline,TArgs,TEntity](Func`2 argsFactory) vid Vendr.Core.Services.EmailTemplateService.SendEmail[TModel](EmailTemplateReadOnly emailTemplate, TModel model, String toEmailAddress, String languageIsoCode) vid Leksandsdorren.Core.Controllers.CartSurfaceController.SendEmailFromCart(CartEmailViewModel model)
I think I came across this too. It appears to be a problem around our AsyncHelper that is used to run some async code sycronously. We changed it becasue it caused another problem elsewhere but clearly it has had a regression.
Exception when sending email with templateService
Hi,
I upgraded Vendr to latest, 2.3.3 from 2.2.0. Now I cannot send confirmation emails. I am using the templateService.SendEmail method to generate and send emails. The code looks like this
I call it from a controller. The email is rendered just fine, but when the email is sent an exception is thrown
This is the stack trace
Any ideas?
Best regards, Jonas Jäderberg
I did some more test and if I change my controller method to
Making it asyncronus I get rid of the exception but the call to _templateService.SendEmail just hangs forever.... but the email is sent.
Hi again,
I reverted back to Vendr 2.3.0 and now I can send email again. So there must be an issue introduced in a version never then 2.3.0.
Jonas Jäderberg
Hi Jonas,
I think I came across this too. It appears to be a problem around our
AsyncHelper
that is used to run some async code sycronously. We changed it becasue it caused another problem elsewhere but clearly it has had a regression.If you'd like to test, there is a new 2.3.4-beta0009 on our unstable NuGet feed at https://nuget.outfield.digital/unstable/vendr/v3/index.json If you can confirm that this works for you, I'll get an update pushed out.
Matt
I can confirm that 2.3.4-beta0009 works for me.
Jonas
Perfect! I'll get that published today
That's just been published now 👍
is working on a reply...