You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var timerId = 42; // anything that isn't actually a handle
clearInterval(timerId);
// Error: cannot read property 'cancelTask' of undefined
and try this
var timerId = setInterval(()=>{},1000);
clearInterval(timerId); // clears the first timer
clearInterval(timerId); // called twice ... boom!
// Uncaught Error: Task does not support cancellation, or is already canceled.
clearInterval is supposed to be safe in both cases`. It worked in beta.9
This appears to be called twice on bootstrap from angular2-polyfills.js. First time zone is defined. Second time it's not:
var clearNative = utils_1.patchMethod(window, cancelName, function () { return function (self, args) {
var task = args[0];
task.zone.cancelTask(task); <-- zone undefined 2nd time
}; });
I am using angular 2.0.0-beta.11 and zone.js 0.6.5 in hybrid application along with angular 1.5.2. I am still experiencing the issue with unhandled exception: EXCEPTION: Error: Task does not support cancellation, or is already canceled.
I can create plunker if necessary. Can anybody confirm ?
I'm seeing the same thing in angular 2.0.0-beta.11 with zone.js 0.6.6
Seems to be two issues, I am seeing times when it is trying to call clearNative with args containing an integer like 13 or 14 rather than a ZoneTask. That happens a few times as my app starts up.
More frequently after that I see clearNative called twice on the same ZoneTask, where the 2nd time is doomed to fail as the cancelFn has been set to null in the first call. Haven't chased down where this is happening, but this change to angular2-polyfills.js prevents the errors:
var clearNative = utils_1.patchMethod(window, cancelName, function() {
return function(self, args) {
var task = args[0];
if (task && task.cancelFn) { // THIS CONDITION
task.zone.cancelTask(task);
}
};
});
Activity
ericmartinezr commentedon Mar 19, 2016
@wardbell the second one is this one angular/zone.js#283, the first one I don't know...
wardbell commentedon Mar 19, 2016
It does seem related @ericmartinezr . But the first one might be different
NathanWalker commentedon Mar 19, 2016
Sounds like the error I'm seeing with beta.11 is related; coming from
angular2-polyfills:And:
This appears to be called twice on bootstrap from
angular2-polyfills.js. First timezoneis defined. Second time it's not:johnwheeler commentedon Mar 19, 2016
@NathanWalker
I had to do this to make the errors go away - mind you - I have no idea of the side-effects or what any of this is doing...
FWIW, I tried the temp workaround from @todoubaba here
#7671 (comment)
and it did not solve the browsersync errors
PatrickJS commentedon Mar 20, 2016
if you build from source you can apply this workaround
PatrickJS/angular-webpack-starter@1661e4c
mhevery commentedon Mar 21, 2016
Fixed here: angular/zone.js@5783663
char0n commentedon Mar 22, 2016
Hi,
I am using angular 2.0.0-beta.11 and zone.js 0.6.5 in hybrid application along with angular 1.5.2. I am still experiencing the issue with unhandled exception: EXCEPTION: Error: Task does not support cancellation, or is already canceled.
I can create plunker if necessary. Can anybody confirm ?
kookster commentedon Mar 24, 2016
I'm seeing the same thing in angular 2.0.0-beta.11 with zone.js 0.6.6
Seems to be two issues, I am seeing times when it is trying to call
clearNativewith args containing an integer like 13 or 14 rather than aZoneTask. That happens a few times as my app starts up.More frequently after that I see clearNative called twice on the same
ZoneTask, where the 2nd time is doomed to fail as thecancelFnhas been set to null in the first call. Haven't chased down where this is happening, but this change toangular2-polyfills.jsprevents the errors:kookster commentedon Mar 24, 2016
Actually, looks like this function has already been fixed in a similar way in
zone.js, butangular2-polyfills.jsis not updated with this yet:https://github.com/angular/zone.js/blob/master/lib/browser/browser.ts#L86-L97
So basically we need angular2-polyfills.js updated with the latest
zone.js.kookster commentedon Mar 24, 2016
I see beta 12 is out with this fix, this should be closed
pkozlowski-opensource commentedon Mar 24, 2016
Thnx @kookster !
char0n commentedon Mar 25, 2016
Nice, I can confirm that these errors are gone on hybrid angular1/2 application with angular2 v2.0.0-beta.12 and zone.js v 0.6.6
Thanks a lot for fixing this
bennadel commentedon Apr 10, 2016
For what's it's worth, I also just happened across this in Beta 11:
angular2-polyfills.js:460 Unhandled Promise rejection: EXCEPTION: TypeError: Cannot read property 'zone' of null... when trying to use
clearTimeout(). It seems to be fixed in Beta 14. Thanks!char0n commentedon Apr 10, 2016
Yes I can still reproduce also on hybrid angular1/2 application.
angular=1.5.3
angular2=2.0.0-beta.13
zone.js=0.6.9
mhevery commentedon Apr 10, 2016
@char0n Please file a separate issue, with a plunker reproduction.
angular-automatic-lock-bot commentedon Sep 8, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.