[CLOSED] Nullable parameters on DirectMethod

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    [CLOSED] Nullable parameters on DirectMethod

    Afternoon all,

    I've recently updated our Ext.NET dlls to version 1.5.1.0 and seem now to be hitting an exception when calling DirectMethods with nullable parameters.
    e.g.
        [DirectMethod]
        public void DoSomething(int? lUserID, int? lTeamID, int? lDepartmentID)
        {
            ...
        }
    Now gives me an exception of this ilk:

    Newtonsoft.Json.JsonReaderException: Unexpected end when reading integer. Line 0, position 0. at Newtonsoft.Json.JsonTextReader.ReadAsInt32() at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter, Boolean inArray) at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType) at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) at Ext.Net.DirectMethod.Invoke(Object target, HttpContext context, ParameterCollection args) at Ext.Net.ResourceManager.RaisePostBackEvent(String eventArgument)
    I thought originally it was because a couple of those params were being passed at an empty string rather than a JS null. So I reworked the calling function to ensure that the JSON was valid, e.g.

    submitDirectEventConfig    {"config":{"extraParams":{"lUserID":"1427","lTeamID":null,"lDepartmentID":null}}}
    But this still gives the exception.

    I did find an old post on here suggesting that Ext.NET prior to version 2 doesn't support nullable parameters, but this seems a little odd as prior to updating things were working happily.

    Is this possibly due to the version of JSON.NET used? or is there a sensible workaround to avoid me needing to re-write all the server side methods to not use nullables?

    Many thanks,

    Doug
    Last edited by Daniil; Sep 05, 2012 at 1:54 PM. Reason: Please use [CODE] tags, [CLOSED]

Similar Threads

  1. Nullable Parameters
    By Zdenek in forum 1.x Help
    Replies: 1
    Last Post: Mar 16, 2012, 6:54 PM
  2. nullable TextField with Vtype of email
    By javadzarrin in forum 1.x Help
    Replies: 1
    Last Post: Sep 06, 2010, 7:40 PM
  3. [CLOSED] Why ThreeStateBool instead Nullable<bool>?
    By pil0t in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 31, 2010, 2:38 PM
  4. [CLOSED] Nullable number field
    By Stefanaccio in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Jun 02, 2010, 5:06 PM
  5. [CLOSED] Nullable (three state) checkbox
    By pil0t in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 25, 2010, 10:41 AM

Tags for this Thread

Posting Permissions