Hello,
I noticed a some strange behavior today when updating any(all custom modules) of my module settings. My module runs just fine, and even updates fine. But after a do an update I see this in error log about 4 times:
DotNetNuke.Services.Exceptions.Exceptions - System.Threading.Tasks.TaskCanceledException: A task was canceled. at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__18`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Tracing.ITraceWriterExtensions.<TraceBeginEndAsyncCore>d__18`1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Filters.AuthorizationFilterAttribute.<ExecuteAuthorizationFilterAsyncCore>d__2.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()
Here is my updatesettings function:
Can anyone help me? dnn 9.7.2
public override void UpdateSettings() { try
{ Entities.Modules.ModuleController objModules = new Entities.Modules.ModuleController(); if (UserInfo.IsSuperUser) {
objModules.UpdateTabModuleSetting(TabModuleId, "smtpServer", this.tbServer.Text); objModules.UpdateTabModuleSetting(TabModuleId, "smtpServerPort", this.tbPort.Text); objModules.UpdateTabModuleSetting(TabModuleId, "smtpUsername", this.tbUsername.Text); objModules.UpdateTabModuleSetting(TabModuleId, "smtpPassword", this.tbPassword.Text); objModules.UpdateTabModuleSetting(TabModuleId, "emailTo", this.tbEmailTo.Text); objModules.UpdateTabModuleSetting(TabModuleId, "emailFrom", this.tbEmailFrom.Text); objModules.UpdateTabModuleSetting(TabModuleId, "CapthaVisible", this.cbCaptha.Checked.ToString()); objModules.UpdateTabModuleSetting(TabModuleId, "Populate", this.cbPopulate.Checked.ToString());
} } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }
First, it seems like your code could use a bit more bits of defensive coding, such as trimming the user inputs, and validating their values (even if it was already done client-side).
(Also, I'd always recommend using the DNN API to send emails, and not do that manually in the module. There's a lot of really good code that has been written over the years that you're most likely bypassing and instead writing yourself.)
Anyhow, I don't see anything in your code that would immediately cause the error you pasted, but it could use one more line of code in the `Try` block, as seen below.
// synchronize the module settings ModuleController.SynchronizeModule(ModuleId);
Hi Will,
Thank you for your great answer and excellant advice - but that wasnt the problem - I added the line just above the updating and tryed below also.
Took me a while to find out where this was comming from - not allot of real good info in that exception. And it seems to be comming somewhere within dnn code ? Possibly updating a module interfering with purge module cache scheduler task or something? It also seems to be intermittent, but happens allot.
Thank you and have a Merry Christmas!
It sounds like you might have found the fix on your own. If you don't mind me asking, what was the cause/fix?
No I did not find a solution to this issue.
Just know where it is comming from is all.
Oh, got it...
Well, nothing in your code sample was obviously wrong or something that I might think could cause that specific exception. Do you happen to know if your instance of DNN has any source code changes?
Are you using any third-party extensions or customizations like TurboScript, that changes how DNN functions?
No it does not - trying to keep that way as far as dnn source code changes. I am using POLO skin, DNN userImport/export(from forge), and thats about it. It seems like a pretty generic exception - and like I said it updates my settings and displays them. I tryed to disable some of the schedular tasks - like purge module cache, purge output cache which run every minute - it seemed to get better , but didnt have time to go any further. Just cleaning up before our site goes live - lots to do. It seems sorta like a thread abort exception or something(like when you do a re-direct) - but not real sure.
Well, I still can't see anything wrong in the information you've provided so far. If it were me, my next step would be to get a clean copy of a web.config with no changes made to it after installing the same version of DNN. Then, do a compare/diff on the two web.config files to see if there is anything added/missing that might be causing this issue.
These Forums are dedicated to the discussion of DNN Platform.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.