Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Chester Campbell 98 posts 209 karma points
    Mar 31, 2020 @ 22:14
    Chester Campbell
    1

    Umbraco Forms throwing InvalidCastException on submit

    I just installed Umbraco Forms v8.4.0 (via nuget) into an Umbraco CMS v8.5.3 project (with SQL Server). I have added references to jQuery validate v1.19.1 and jQuery unobtrusive validate (it doesn't seem to have a version) and I have followed the directions on this page ... https://our.umbraco.com/documentation/Add-ons/UmbracoForms/Developer/Rendering-Scripts/ ... since my javascript files are referenced outside the HTML HEAD section.

    I create a form with just one field and embedded it into a template using:

    Umbraco.RenderMacro("renderUmbracoForm", new { FormGuid = "db967296-c296-493b-8da9-7e3cf2f0b090", ExcludedScripts = "1" })
    

    When I submit the form I get the following error: Unable to cast object of type 'Umbraco.Core.Persistence.FaultHandling.RetryDbConnection' to type 'System.Data.SqlClient.SqlConnection'.

    Here's the stack trace:

    [InvalidCastException: Unable to cast object of type 'Umbraco.Core.Persistence.FaultHandling.RetryDbConnection' to type 'System.Data.SqlClient.SqlConnection'.]
       NPoco.<>c.<.cctor>b__7_0(DbConnection dbConn) +27
       NPoco.SqlBulkCopyHelper.BulkInsert(IDatabase db, IEnumerable`1 list, SqlBulkCopyOptions sqlBulkCopyOptions) +76
       NPoco.SqlBulkCopyHelper.BulkInsert(IDatabase db, IEnumerable`1 list) +55
       NPoco.DatabaseTypes.SqlServerDatabaseType.InsertBulk(IDatabase db, IEnumerable`1 pocos) +49
       NPoco.Database.InsertBulk(IEnumerable`1 pocos) +135
       Umbraco.Forms.Core.Data.Storage.RecordFieldStorage.InsertRecordFields(IEnumerable`1 recordFields) +675
       Umbraco.Forms.Core.Data.Storage.RecordStorage.InsertRecord(Record record, Form form) +1564
       Umbraco.Forms.Core.Services.RecordService.StoreRecord(Record record, Form form) +1087
       Umbraco.Forms.Core.Services.RecordService.Approve(Record record, Form form) +426
       Umbraco.Forms.Core.Services.RecordService.Submit(Record record, Form form) +1068
       Umbraco.Forms.Web.Controllers.UmbracoFormsController.SubmitForm(Form form, FormViewModel model, Dictionary`2 state, ControllerContext context) +2464
       Umbraco.Forms.Web.Controllers.UmbracoFormsController.GoForward(Form form, FormViewModel model, Dictionary`2 state) +216
       Umbraco.Forms.Web.Controllers.UmbracoFormsController.HandleForm(FormViewModel model) +1085
       lambda_method(Closure , ControllerBase , Object[] ) +103
       System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
       System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +157
       System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
       System.Web.Mvc.Async.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState) +22
       System.Web.Mvc.Async.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult) +29
       System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
       System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
       System.Web.Mvc.Async.<>c__DisplayClass11_0.<InvokeActionMethodFilterAsynchronouslyRecursive>b__0() +58
       System.Web.Mvc.Async.<>c__DisplayClass11_2.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +228
       System.Web.Mvc.Async.<>c__DisplayClass11_2.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +228
       System.Web.Mvc.Async.<>c__DisplayClass11_2.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +228
       System.Web.Mvc.Async.<>c__DisplayClass11_2.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2() +228
       System.Web.Mvc.Async.<>c__DisplayClass7_0.<BeginInvokeActionMethodWithFilters>b__1(IAsyncResult asyncResult) +10
       System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
       System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
       System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
       System.Web.Mvc.Async.<>c__DisplayClass3_6.<BeginInvokeAction>b__4() +35
       System.Web.Mvc.Async.<>c__DisplayClass3_1.<BeginInvokeAction>b__1(IAsyncResult asyncResult) +100
       System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
       System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
       System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
       System.Web.Mvc.<>c.<BeginExecuteCore>b__152_1(IAsyncResult asyncResult, ExecuteCoreState innerState) +11
       System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
       System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
       System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +45
       System.Web.Mvc.<>c.<BeginExecute>b__151_2(IAsyncResult asyncResult, Controller controller) +13
       System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +22
       System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
       System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26
       System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
       System.Web.Mvc.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) +28
       System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
       System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
       System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28
       System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
       System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +576
       System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +132
       System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +163
    

    What am I missing? I've been over this 10 times and I can't see what I'm doing wrong. I google this error and I find very little so apparently I'm the only one having this issue.

    Can anyone help??

    Thanks

  • Comment author was deleted

    Apr 01, 2020 @ 07:57

    Hey Chester, best is to get in touch with support... you should be able to submit request from your profile on https://umbraco.com/

  • Chester Campbell 98 posts 209 karma points
    Apr 01, 2020 @ 12:32
    Chester Campbell
    0

    I submitted a support ticket. Thanks!

  • Peter Holmsgaard 69 posts 106 karma points
    Apr 03, 2020 @ 10:50
    Peter Holmsgaard
    0

    Hey Chester

    I have the same issue. Did you get any great advice from the support?

    Thanks

  • Chester Campbell 98 posts 209 karma points
    Apr 03, 2020 @ 12:40
    Chester Campbell
    0

    Hi Peter,

    I am glad to hear that I'm not the only one! Yes, they are looking into it.

    I did some further investigation myself with a clean install of Umbraco 8.5.3 and Forms 8.4.0 with the starter kit and while I didn't get the same error I did find that Forms is failing silently when I create a form without the default "consent" question included.

    What I mean by that is when you create a form in the backoffice and select "Blank form" you actually start with a form that contains a field that is a checkbox. It's for getting the submitter's consent to store their data.

    If I remove that field and add my own fields when the form is submitted I get redirected to another page (instead of showing the thank-you message), no data is saved in the backoffice and no workflows are triggered.

    There are no errors in the umbraco log either!?

    Unfortunately, on my working project I tried a form that includes the "consent" field and I still get the same YSOD error. So ???

    Not sure if this is really part of the problem or just a red herring.

  • OleP 67 posts 276 karma points
    Apr 03, 2020 @ 13:54
    OleP
    0

    That sounds like a bug in Umbraco Forms 8.4.0 which was just recently released. How about downgrading to 8.3.2, unless you really need something from 8.4.0?

    A feature in 8.4.0 is that inserting all form post data to the database now happens in one bulk transaction. Reading the stack trace I see InsertBulk on multiple locations.

  • Matteo Di Mauro 20 posts 73 karma points
    Apr 09, 2020 @ 15:14
    Matteo Di Mauro
    0

    Same here. I have downgraded to 8.3.2 and it works fine. Thank you!

  • Chester Campbell 98 posts 209 karma points
    Apr 13, 2020 @ 20:43
    Chester Campbell
    1

    I considered downgrading Forms but before my site went live I wanted to upgrade CMS to the latest version. So I did that first ... upgraded CMS from 8.5.3 to 8.6.0 and that made my problem go away.

    So, yeah, apparently U 8.5.3 and UF 8.3.2 will work but so will U 8.6.0 and UF 8.4.0.

  • ianhoughton 281 posts 605 karma points c-trib
    Apr 21, 2020 @ 13:09
    ianhoughton
    1

    I was having the same issue and can confirm that upgrading to Umb 8.6.1 with Forms at 8.4.0 fixes the issue.

Please Sign in or register to post replies

Write your reply to:

Draft