rangle / augury

Angular Debugging and Visualization Tools
https://augury.rangle.io
MIT License
2.01k stars 216 forks source link

TypeError: (t.__annotations__ || []).find is not a function #1387

Open MRH4287 opened 5 years ago

MRH4287 commented 5 years ago

Augury version (required): 1.23.0 (Canary) Angular version (required): 6.1.10 Date: 05.08.2018 OS: Windows 10

Description of issue: We have a rather complex Angular application. At some point Augury started throwing Exceptions when we tried to use it. (see below for StackTrace)

As i don't know what causes this error, i can't provide a sample repository.

Because of the error and the mentioned __annotations__ it is maybe important to note that we are using custom Decorators in our application.

Steps to reproduce:

  1. Open Augury
  2. Ispect a Component
  3. Switch between Elements

Additional details:

TypeError: (t.__annotations__ || []).find is not a function
    at Object.e.componentMetadata (chrome-extension://leechohfifidanmkioncamdcibhmmcji/build/backend.js:31:47549)
    at chrome-extension://leechohfifidanmkioncamdcibhmmcji/build/backend.js:31:173949
    at i (chrome-extension://leechohfifidanmkioncamdcibhmmcji/build/backend.js:31:33293)
    at chrome-extension://leechohfifidanmkioncamdcibhmmcji/build/backend.js:31:33468
    at Array.forEach (<anonymous>)
    at i (chrome-extension://leechohfifidanmkioncamdcibhmmcji/build/backend.js:31:33441)
    at chrome-extension://leechohfifidanmkioncamdcibhmmcji/build/backend.js:31:33364
    at Array.forEach (<anonymous>)
    at i (chrome-extension://leechohfifidanmkioncamdcibhmmcji/build/backend.js:31:33335)
    at chrome-extension://leechohfifidanmkioncamdcibhmmcji/build/backend.js:31:33468

image

Update: I compiled the source myself and found the error. The Problem is the following Code:

  // since angular v5 this should work
  const metadata = (token[ANNOTATIONS_PROP_KEY] || [])
    .find(d => Object.getPrototypeOf(d).ngMetadataName === 'Component');

In the decorators.ts (https://github.com/rangle/augury/blob/master/src/tree/decorators.ts#L45).

When i comment out that call and set metadata to null, everything works as expected.