Skip to content

Invalid ngOnDestroy invocation on multiple provision #35231

@Azbesciak

Description

@Azbesciak

🐞 bug report

Affected Package

core? 9.0.0. Would like to know

Is this a regression?

It occured after

Yes, the previous version in which this bug was not present was: ....

Description

Not sure whether it is connected with #35167 or not, but following screen shows an error:
image
in summary, those services in array - all of them implements some interface and are provided with the same token, under provision with multiple: true. As you see, ngOnDestroy is invoked on that array, but this this... eh, I don't think that this array extends Subscriber. I have also noticed that this is not always the case.

🔥 Exception or Error


ERROR Error: Uncaught (in promise): TypeError: this.clearSubscriptions is not a function
TypeError: this.clearSubscriptions is not a function
    at Array.ngOnDestroy (subscriber.ts:28)
    at executeOnDestroys (core.js:14024)
    at cleanUpView (core.js:13931)
    at destroyViewTree (core.js:13705)
    at destroyLView (core.js:13882)
    at RootViewRef.destroy (core.js:14737)
    at ComponentRef$1.destroy (core.js:33528)
    at RouterOutlet.deactivate (router.js:8912)
    at ActivateRoutes.deactivateRouteAndOutlet (router.js:3963)
    at ActivateRoutes.deactivateRouteAndItsChildren (router.js:3921)
    at resolvePromise (zone-evergreen.js:793)
    at resolvePromise (zone-evergreen.js:752)
    at zone-evergreen.js:854
    at ZoneDelegate.invokeTask (zone-evergreen.js:400)
    at Object.onInvokeTask (core.js:40744)
    at ZoneDelegate.invokeTask (zone-evergreen.js:399)
    at Zone.runTask (zone-evergreen.js:168)
    at drainMicroTaskQueue (zone-evergreen.js:570)
    at invokeTask (zone-evergreen.js:485)
    at ZoneTask.invoke (zone-evergreen.js:470)

🌍 Your Environment

Angular Version:


Angular CLI: 9.0.1
Node: 12.13.1
OS: win32 x64

Angular: 9.0.0
... animations, cdk, common, compiler, compiler-cli, core
... elements, forms, language-service, material
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.900.1
@angular-devkit/build-angular      0.900.1
@angular-devkit/build-ng-packagr   0.900.1
@angular-devkit/build-optimizer    0.900.1
@angular-devkit/build-webpack      0.900.1
@angular-devkit/core               8.3.23
@angular-devkit/schematics         8.3.23
@angular/cli                       9.0.1
@ngtools/webpack                   9.0.1
@schematics/angular                8.3.23
@schematics/update                 0.900.1
ng-packagr                         9.0.0
rxjs                               6.5.4
typescript                         3.7.5
webpack                            4.41.2

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions