Visitar URL original
`ViewRef#onDestroy` throws an error in a ctor context · Issue #46119 · angular/angular · GitHub
The Wayback Machine - https://web.archive.org/web/20250825054256/https://github.com/angular/angular/issues/46119
Skip to content

ViewRef#onDestroy throws an error in a ctor context #46119

@lacolaco

Description

@lacolaco

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

No

Description

Already Chau said, ViewRef#onDestroy is untouchable if the app is ONLY in dev mode.
https://twitter.com/Nartc1410/status/1527274445056126978

Repro: https://stackblitz.com/edit/angular-ivy-9mzqjg?file=src/main.ts

I'm not sure these are related, injecting ViewRef by inject() is impossible in the ctor context.

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/angular-ivy-9mzqjg?file=src/main.ts

Please provide the exception or error you saw

Error: Uncaught (in promise): TypeError: Cannot add property 0, object is not extensible
TypeError: Cannot add property 0, object is not extensible
at TCleanup.push (<anonymous>)
at listenerInternal (https://angular-ivy-9mzqjg.stackblitz.io/turbo_modules/@angular/core@14.0.0-rc.1/fesm2015/core.mjs:15439:38)

Please provide the environment you discovered this bug in (run ng version)

Angular v14.0.0-rc1

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: coreIssues related to the framework runtimebug

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions