Thanks to visit codestin.com
Credit goes to github.com

Skip to content

enableProfiling() causes unclear dev mode errors. #62947

@sdhoek

Description

@sdhoek

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

core

Is this a regression?

No

Description

In a completely new Angular project (generated by ng new), I ran into the following problem.

Calling enableProfiling() causes vague errors to appear instead of helpful errors whenever something unexpected happens in a template.

main.ts:

import { bootstrapApplication } from '@angular/platform-browser';
import { appConfig } from './app/app.config';
import { App } from './app/app';
import { enableProfiling } from '@angular/core';


enableProfiling();

bootstrapApplication(App, appConfig)
  .catch((err) => console.error(err));

app.html:

{{test.a.b}}

will cause the following error to appear:

ERROR Error: ASSERTION ERROR: Profiling error: expected to see 12 event but got 18 [Expected=> 12 == 18 <=Actual]

Removing enableProfiling() causes the error I would expect to re-appear

TypeError: Cannot read properties of undefined (reading 'b')
    at App_Template (app.html:1:1)
    at executeTemplate (debug_node.mjs:7935:9)
    at refreshView (debug_node.mjs:8965:13)
    at detectChangesInView (debug_node.mjs:9185:9)
    at detectChangesInViewIfAttached (debug_node.mjs:9145:5)
    at detectChangesInComponent (debug_node.mjs:9133:5)
    at detectChangesInChildComponents (debug_node.mjs:9211:9)
    at refreshView (debug_node.mjs:9020:13)
    at detectChangesInView (debug_node.mjs:9185:9)
    at detectChangesInViewWhileDirty (debug_node.mjs:8874:9)

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

ERROR Error: ASSERTION ERROR: Profiling error: expected to see 12 event but got 18 [Expected=> 12 == 18 <=Actual]

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

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 20.1.4
Node: 24.3.0
Package Manager: npm 11.4.2
OS: win32 x64

Angular: 20.1.4
... build, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-server, router, ssr

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.2001.4
@angular-devkit/core         20.1.4
@angular-devkit/schematics   20.1.4
@schematics/angular          20.1.4
rxjs                         7.8.2
typescript                   5.8.3

Anything else?

No response

Metadata

Metadata

Assignees

Labels

P4A relatively minor issue that is not relevant to core functionsarea: coreIssues related to the framework runtimestate: has PR

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions