Click on both buttons, and you will see that place of actual definition of event handler is incorrect. Here is a really simple example where both definitions really close to each other, but in real application, the situation is much worse.
Actually for all EventTasks (not sure about other, haven't tested it) captured stacktrace equals to the latest one defined event handler.
I created a small stackblitz repo which shows the problem:
https://stackblitz.com/edit/typescript-ouevfy?file=index.html
Click on both buttons, and you will see that place of actual definition of event handler is incorrect. Here is a really simple example where both definitions really close to each other, but in real application, the situation is much worse.
Actually for all EventTasks (not sure about other, haven't tested it) captured stacktrace equals to the latest one defined event handler.
This caused because here long-stack-trace.ts
data
property from ZoneTask is a reference to global object defined here asOPTIMIZED_ZONE_EVENT_TASK_DATA
constant.And all execution of this callback just mutate this object and all tasks inherit the same stack trace.
There are two possible ways to resolve the problem. It's either possible to modify
long-stack-trace.ts
fileOr break the reference in ZoneTask itself