C#,vb.net,MVC,Jquery,javascript,jscript,vbscript,html,vb,sharepoint,COM,WPF,WCF,Wwf,Asp,Asp.net,questions & answers,

Latest in Sports

Tuesday, September 18, 2012

JavaScript null reference error in ScriptResource.axd

Hi


We have a web based asp.net application with Ajax. In Production servers, the users notices that occasionally the browser stops loading the page, and a JavaScript error icon is displayed on the status bar. Attached below is the screenshot of the JavaScript error that the users get. The error does not occur in any of the test environments
 
We found that the null object error is thrown from one of the functions generated in the ScriptResource.axd. The function from the resource file is as below. The function does not checks for null value for __wpm.zones object before calling dispose function.
 
function WebPartManager_Dispose() {
    for (var i = 0; i < __wpm.zones.length; i++) {
        __wpm.zones[i].Dispose();
    }
    window.detachEvent("onunload", WebPartManager_Dispose);
}
 
We have tried the below fixes
1.       The following link suggests to rewire theWebPartManager_Dispose() function on pageLoad() with a new function which checks for null object before disposing:
2.       We have also tried registering a script file (with modified function forWebPartManager_Dispose()) after the script tag for ScriptResource.axd. We tried this approach due to the fact that the browser will use the function which was register at the last (in case of multiple function with same name).
We have implemented and deployed both the above two fixes, but the user are still facing the issue sporadically. It seems somehow the browser uses the function from ScriptResource.axd even when trying to override it.
 
Please share your inputs if you have encountered/resolved such issue.


No comments:

Post a Comment