"Invalid Argument" in Sys.Net.XMLHttpExecutor()

Last post 07-06-2009 10:30 AM by jdege. 3 replies.

Sort Posts:

  • "Invalid Argument" in Sys.Net.XMLHttpExecutor()

    05-21-2009, 1:14 PM
    • Member
      point Member
    • jdege
    • Member since 05-21-2009, 1:04 PM
    • Posts 2

    I have a page that's throwing an "Invalid Argument" exception in Sys.Net.XMLHttpExecutor()

    I can break at the error and  examine the code, it's in the _onReadyStateChange() function:

    1        this._onReadyStateChange = (function () {
    2            
    3            if (_this._xmlHttpRequest.readyState === 4 ) {
    4                try {
    5                    if (typeof(_this._xmlHttpRequest.status) === "undefined") {
    6                        return;
    7                    }
    8                }
    9                catch(ex) {
    10                   return;
    11               }
    12               
    13               _this._clearTimer();
    14               _this._responseAvailable = true;
    15               try {
    16                   _this._webRequest.completed(Sys.EventArgs.Empty);
    17               }
    18               finally {
    19                   if (_this._xmlHttpRequest != null) {
    20                       _this._xmlHttpRequest.onreadystatechange = Function.emptyMethod;
    21                       _this._xmlHttpRequest = null;
    22                   }
    23               }
    24           }
    25       });
    
     

    The debugger break's on the "finally" line 18 of the listing above, which is line 4723 of MicrosoftAjax.js.

    From what's available in the debugger, examining the variables, the call stack, etc., I've not been able to identify what the problem is.  I've stepped through the code-behind, and it seems to be completing without error.  It runs through Page_Load() and Page_PreRender() with no complaints, then up pops "Invalid Argument" on this line of javascript.

     Any ideas on how to track down where the problem lies?

  • Re: "Invalid Argument" in Sys.Net.XMLHttpExecutor()

    06-27-2009, 3:32 AM
    • Member
      53 point Member
    • bofcarbon1
    • Member since 06-07-2009, 4:47 PM
    • Posts 21

    I am getting the same error, same location. Trying to use an AJAX Web Service with a ScriptManager and ScriptManagerProxy. I've been going around and around on this. Thought my problem was originally the placement of the JavaScript. I switched to placing the code in a 'js' file and used a ServiceReference to point to the script. That got me through some 'undefined' errors. I remember reading a post where the solution was to check AJAX library files for possible outdated files that may need to be replaced. I am beginning to believe that. This script error is not occuring in any script code that I created. 65% of my problems I'm finding are Microsoft making changes and making us stumble around for fixes.

  • Re: "Invalid Argument" in Sys.Net.XMLHttpExecutor()

    07-04-2009, 3:20 PM
    • Member
      53 point Member
    • bofcarbon1
    • Member since 06-07-2009, 4:47 PM
    • Posts 21

    Updating my previous post I've discovered that this type of error is a default error mode that occurs because of the lack of error handling capability in the AJAX web service interface. It is a real pain to use these methods as they currently exist. Very difficult to debug without inellisense to pinpoint the problem that AJAX has with a failed statement. This occurs in many places in these methods. For example the Method 500 error is another default that just happens. In debug mode in Visual Studio when AJAX decides there is an error it just quits leaving you to guess why code that would normally work in C#.NET code behind won't work in an AJAX web service method.  In my opinion they need to do a lot more work to get me to buy into its use.  As I start my training revisiting Java I can't but help wonder if the use of web services will be less cumbersome there. At some point I want to share data from multiple databases in SQL Server and Oracle through ASP.NET web apps and Java web apps and was thinking that web services would play a major part in that. So far in AJAX .NET alone it looks very shaky.

    For me the addition of web based apps and web services is really just a way to bridge my mainframe applicaiton experience to these technologies and wind down my career in conversions and interface extensions or even code wrapping.  These web services are key I think. I see myself still as a backend guy coding a lot of database request code but the middleware is an objective to really extend my scope.  Sure is a lot of fun building web apps though.

  • Re: "Invalid Argument" in Sys.Net.XMLHttpExecutor()

    07-06-2009, 10:30 AM
    • Member
      point Member
    • jdege
    • Member since 05-21-2009, 1:04 PM
    • Posts 2

     I'd noticed the same thing.

     

    In my case, I managed to identify the actual problem when I noticed that it didn't exist in earlier revisions in source control.  I checked out, built, and tested each revision, until I had identified the specific revision that introduced the change, and then did a diff on the source code to identify where the problem had to be.

     

    It turned out that we had some javascript that was using parseFloat() without checking for success.  On a badly-formatted string this would return NaN, and when we passed that to a function that expected a float, the function would throw an exception.

     

    Which, because of the lack of error handling in ASP.NET's AJAX mechanisms, would result in the error we've been discussing.

     

    There really has to be a better way of tracking down these problems, but I've not been able to find it.

     

Page 1 of 1 (4 items)