Error after upgrading from Editor 1.9.2 to 1.9.6

Error after upgrading from Editor 1.9.2 to 1.9.6

dynasoftdynasoft Posts: 446Questions: 69Answers: 3

Link to test case:
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem: I get the following error, please advise

System.MissingMethodException
HResult=0x80131513
Message=Method not found: 'DataTables.Editor DataTables.Editor.Process(System.Web.HttpRequest)'.
Source=TBDotNet.Model

Bit of code is this:

[System.Web.Http.Route("ABC/CRUDServABC")]
[System.Web.Http.HttpGet]
[System.Web.Http.HttpPost]
public ActionResult CRUDServABC(int intContTpe, long lngContIdx, int intItemTpe, long lngItemIdx, string strItemNme, int intRemoveABC)
{
    ABCUISettings lblo = new ABCUISettings();
    return Json(ABCModel.CRUDServABC(intContTpe, lngContIdx, intItemTpe, lngItemIdx, strItemNme, intRemoveABC, lblo), JsonRequestBehavior.AllowGet);
}

Thanks.

Answers

  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3

    I use .net fw 4.7.2

  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3

    Error ocurrs for all .net fw versions of file DataTables-Editor-Server.dll

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    It is definitely in the code.

    What version of the dll are you using? Did you upgrade from v1.9.2 to 1.9.6 of the dll? (I'm asking so I can go through the code changes to see what changed!). If you use 1.9.2 does it start working again?

    Thanks,
    Allan

  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3

    I used v1.9.2 of the dll before and get the error when trying to use any v1.9.6. It works fine with v1.9.2

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    Hi,

    Sorry for the delay in getting back to you on this. These are the two comments that might be related:

    However, I'm not seeing what would cause the error you are seeing from that.

    Could you show me the code for how you are calling the Process method please? We use some overloads so seeing the exact call, and knowing the type of the parameter(s) passed in would be useful.

    Thanks,
    Allan

  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3

    hi, thanks. Will reply in full later this week.

  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3

    I don't really call the Process method. I just get anerror in the VS IDE on line:

    return Json(ABCModel.CRUDServABC(intContTpe, lngContIdx, intItemTpe, lngItemIdx, strItemNme, intRemoveABC, lblo), JsonRequestBehavior.AllowGet);

    None of the numbers are decimal so the decimal char isn't the issue here I believe. They're all int's or long's.

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    Can you show me what ABCModel.CRUDServABC is please? Something must be creating the Editor instance and then calling the Process method on it.

    Thanks,
    Allan

  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3

    Please find below:

            public static DtResponse CRUDServABC(int intContTpe, long lngContIdx, int intABCTpe, long lngABCIdx, string strABCNme, int intRemoveABC, ABCsUISettings lblo)
            {
                string strTp = string.Empty;
                Editor editor = null;
                Task t;
    
                try
                {
                    SessionObjects.intContTpe = intContTpe;
                    SessionObjects.lngContIdx = lngContIdx;
                    
                    HttpRequest formData = HttpContext.Current.Request;
    
                    using (Database db = new Database(SetGetDbType2, SetGetDbConnection))
                    {
                        editor = new Editor(db, "ServiceABCs", "ServiceABCs.id").Model<ServABCsDBModel>("ServiceABCs");
                        editor.Field(new Field("ServiceABCs.id")
                            .Set(false)
                        );
                        editor.Field(new Field("ServiceABCs.SupplierID")
                            .Set(true)
                            .SetValue(lngContIdx)
                        );
                        editor.Field(new Field("ServiceABCs.FormatName")
                            .Xss(false)
                            .GetFormatter((val, data) => CommonUtilities.IsNullOrEmpty(val) == true ? string.Empty : val)
                            .SetFormatter((val, data) => CommonUtilities.IsNullOrEmpty(val) == true ? null : val)
                        );
    
                        editor.PostRemove += (sender, e) => t = Task.Run(() => Delete(intABCTpe, strABCNme));
                        editor.Where("ServiceABCs.SupplierID", lngContIdx);
                        editor.TryCatch(false);
                        editor.Debug(true);
                        editor.Process(formData);
                    }
                    lblo = null;
                }
                catch (Exception ex)
                {
                    MainUtilities.HandleErrorEvent(false, false, DateTime.Now, string.Empty, ex);
                }
                return editor.Data();
            }
    
  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3

    Please advise

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    Hi,

    Sorry I wasn't able to get back to you about this yesterday. Thanks for the code - unfortunately I don't have my Windows computer with me today to try it, but could you try replacing

    HttpRequest formData = HttpContext.Current.Request;
    

    with:

    var formData = HttpContext.Request.Form;
    

    please?

    If that doesn't work, use 1.9.2 until I can debug this locally.

    Regards,
    Allan

  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3

    I place the code in Models not in Controllers and in static methods. I get this error with the suggested line:

    An object reference is required for the non-static field, method, or property 'HttpContext.Request'

  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3

    Hi

  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3

    As a side note the VS project you publish only uses
    HttpRequest formData = HttpContext.Current.Request;

  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3

    Any news please

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Sorry about the delay, this is on Allan's list to look at, he's just a bit remote right now so he's replying when he can. Apologies for the inconvenience,

    Colin

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    I place the code in Models not in Controllers and in static methods

    Ah! That's the issue then. You'll need to provide a parameter for the static method in your model so that the controller can pass in HttpContext.Request.Form or HttpContext.Current.Request from the controller.

    As a side note the VS project you publish only uses

    Yes, it does so in the controller, which it sounds like is the key difference here. If you could add that parameter and then pass that through, that should do it.

    That said, I don't understand why it is different between 1.9.2 and 1.9.6 I'm afraid. I will need to debug that, but that will be next week now.

    Allan

  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3

    Thanks

  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3

    Hi, were you able to take a look at this issue this week?

  • allanallan Posts: 63,692Questions: 1Answers: 10,500 Site admin

    Hi,

    Could you try the dll from here please?

    I've just tried it locally and it appears to run no problem with .NET Framework 4.7.2 and:

    .Process(HttpContext.Current.Request)
    

    Thanks,
    Allan

  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3

    Thanks. Wil try.

  • dynasoftdynasoft Posts: 446Questions: 69Answers: 3

    It appears to work fine. Thank you.

Sign In or Register to comment.