Feed Icon  

Contact

  • Bryant Likes
  • Send mail to the author(s) E-mail
  • twitter
  • View Bryant Likes's profile on LinkedIn
  • del.icio.us
Get Microsoft Silverlight
by clicking "Install Microsoft Silverlight" you accept the
Silverlight license agreement

Hosting By

Hot Topics

Tags

Open Source Projects

Archives

Ads

__pendingCallbacks[...].async is null or not an object

Posted in ASP.Net/Web Services at Tuesday, December 20, 2005 1:57 AM Pacific Standard Time

I ran into this issue today while working on my personal ASP.Net 2.0 project. I was getting the error when my callback function (client side) was running one of my custom javascript methods. I did a little googling and came across this post which didn't tell me about my problem specifically, but there were lots of comments about it:

And... does someone after this change gets som kind of bug , when calling method from server and gets "PendingCallbacks[...].async is empty or it is not an object" error on JavaScript Side?

My App still works, but i can not track this bug. Can anyone help?

It turns out that the issue is related to variable scoping in the ASP.Net client side functions:

Actually, if MS replaced the following script code WebForm_CallbackComplete:

for (i = 0; i < __pendingCallbacks.length; i++) {...}

with:
for (var i = 0; i < __pendingCallbacks.length; i++) {...}

("i" is now locally declared instead of the global scope)

.. that would solve most of our problems, I think.

Sure enough, this solved my problem. In my custom javascript method I had a for loop using a variable named “i“ so I was changing the value in the “i“ of Microsoft's code and causing the exception. So if you hit this issue, make sure you don't use “i“ and/or make sure your variables are properly scoped.