[FIXED] [#1343] [4.2.0] Calling a DirectMethod with a null string parameter results in the string "null" on the server

  1. #1

    [FIXED] [#1343] [4.2.0] Calling a DirectMethod with a null string parameter results in the string "null" on the server

    Ext.Net version: 3.3.0
    ASP.Net version: 4.0.30319


    The behavior of DirectMethods seems to have changed since 1.7.0. Specifically, when you define a DirectMethod with a string parameter, and you call that DirectMethod with the null reference as that argument you used to get the empty string on the server. This is was an OK and understandable behavior.

    However, in Ext 3.3 you get the string "null" instead. Not the null reference, but the 4 character long string "null". This breaks our code in subtle ways and is really suprising.

    Simple page to reproduce the issue:
    <%@ Page Language="C#"  %>
    <%@ Import Namespace="Ext.Net" %>
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagPrefix="ext" %>
    <script runat="server">
        public void Test(string str)
            if (str == null) {
                LabelStatus.Text = "str is the null reference";
            } else {
                LabelStatus.Text = "str is the text '" + str + "'";
    <!DOCTYPE html>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <form id="form1" runat="server">
            <ext:ResourceManager runat="server"/>
            <ext:Label runat="server" ID="LabelStatus"/>
            Ext.onReady(function() {
    To reproduce on 1.7.x change the "App.direct" to "Ext.net.DirectMethods".

    Expected output: "str is the null reference" or "str is the text ''"
    Actual output: "str is the text 'null'"

    Last edited by Daniil; Jun 16, 2016 at 4:48 PM.
  2. #2
    Hello Raphael!

    Thanks for reporting the issue. Indeed the keyword gets translated into a string in the client-side to remote-side communication and that's not really nice.

    We've logged this as issue #1343 and we'll update here as soon as we fix this problem!
    Fabrício Murta
    Developer & Support Expert
  3. #3
    Hi @ilogsdev02,

    It would be ideal to have a literal null instead of an empty string, but it requires changes that would mean quite a severe breaking change. So, I only got it working as it was in v1.x - null results in an empty string that you treat as:
    This is was an OK and understandable behavior.
    It has been fixed in both v3 and v4 sources and you can pull the latest right away to get it fixed on your side.

    As for v4, it will be included into the next public release - 4.2.0.

    Once again thank you for the report!

Similar Threads

  1. Replies: 1
    Last Post: Apr 06, 2016, 1:05 PM
  2. Replies: 0
    Last Post: Nov 15, 2013, 10:32 AM
  3. [CLOSED] Submit null as value of a string parameter
    By RCN in forum 2.x Premium Help
    Replies: 6
    Last Post: Dec 27, 2012, 11:55 AM
  4. [OPEN] [#29] Error "tagName is null"
    By xeo4.it in forum 2.x Premium Help
    Replies: 5
    Last Post: Nov 17, 2012, 12:25 AM
  5. Replies: 1
    Last Post: Jul 22, 2011, 6:34 PM

Posting Permissions