Jun 09, 2016, 10:35 AM
[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
Hello,
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:
Expected output: "str is the null reference" or "str is the text ''"
Actual output: "str is the text 'null'"
Thanks,
Raphael
ASP.Net version: 4.0.30319
Hello,
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">
[DirectMethod]
public void Test(string str)
{
if (str == null) {
LabelStatus.Text = "str is the null reference";
} else {
LabelStatus.Text = "str is the text '" + str + "'";
}
}
</script>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:ResourceManager runat="server"/>
<ext:Label runat="server" ID="LabelStatus"/>
</form>
<script>
Ext.onReady(function() {
App.direct.Test(null);
});
</script>
</body>
</html>
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'"
Thanks,
Raphael
Last edited by Daniil; Jun 16, 2016 at 3:48 PM.