Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dump compiled factories #5619

Closed
achimha opened this issue Mar 24, 2017 · 14 comments
Closed

Dump compiled factories #5619

achimha opened this issue Mar 24, 2017 · 14 comments
Labels
area: devkit/build-angular feature Issue that requests a new feature
Milestone

Comments

@achimha
Copy link

achimha commented Mar 24, 2017

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [X] feature request

Versions.

angular-cli 1.0.0
angular 2.4.10

Repro steps.

With the latest bugfix that uncovered AOT errors, I noticed how hard it is to pinpoint those errors. The reason is that all we get is an error during compilation like this:

ERROR in /src/$$_gendir/app/lazy/support/support.component.ngfactory.ts (2126,52): Supplied parameters do not match any signature of call target.

The offending file is transient and cannot be inspected. Due to the recently fixed bug, the code error has been there for a long time and it is now very difficult to spot the offending code in a module that has been working for months.

Desired functionality.

There should be a way to inspect (= keep) the transient file to get a better idea what the AOT compiler complains about.

@filipesilva
Copy link
Contributor

I think the bugfix mentioned is #5601.

@hansl is there maybe a way we can have better info on these errors?

@elvisbegovic
Copy link
Contributor

elvisbegovic commented Mar 27, 2017

how can I temporarry fix this

"Supplied parameters do not match any signature of call target."

get more inputs from console ? cause donno how fix that

ERROR in C:/.../$$_gendir/app/shared/dependances-entites/dependances-region.component.ngfactory.ts (1,1): Property 'length' does not exist on type 'BuildingDistrictDependencyDTO'.
ng:///C:/.../shared/dependances-entites/dependances-region.component.html (2,1): Property 'length' does not exist on type 'BuildingDistrictDependencyDTO'.

ERROR in ng:///C:/.../comptabilite/plan-comptable/modeles-plan-comptable.component.html (8,27): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../immeuble/popup-suppression-immeuble/popup-suppression-immeuble.component.html (39,15): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../donnees-statiques/donnees-statiques-immeuble/normes-mesures/popup-suppression-norme-mesure.component.html (39,15): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../donnees-statiques/donnees-statiques-immeuble/regions-quartiers/popup-suppression-region.component.html (39,15): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../donnees-statiques/donnees-statiques-immeuble/regions-quartiers/popup-suppression-quartier.component.html (44,15): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../donnees-statiques/donnees-statiques-immeuble/frais-accessoires/popup-suppression-frais-accessoire.component.html (45,15): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../donnees-statiques/donnees-statiques-immeuble/commodites/popup-suppression-commodites.component.html (43,15): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../personne/adresse/popup-suppression-adresse.component.html (39,15): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../personne/personne-compte-bancaire/popup-suppression-compte-bancaire.component.html (39,15): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../objet/popup-suppression-objet.component.html (38,15): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../autorisations/utilisateurs/utilisateurs.component.html (7,27): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../autorisations/utilisateurs/form-utilisateur-groupes.component.html (27,25): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../comptabilite/parametres-comptables/form-parametres-comptables.component.html (134,19): Operator '>' cannot be applied to types 'any[]' and 'number'.

ERROR in ng:///C:/.../comptabilite/repartition-charges/repartitions-charges.component.html (8,27): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../immeuble/immeubles.component.html (22,29): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../objet/popup-suppression-objet.component.html (38,15): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../immeuble/popup-suppression-immeuble/popup-suppression-immeuble.component.html (39,15): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../personne/adresse/popup-suppression-adresse.component.html (39,15): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../personne/personne-compte-bancaire/popup-suppression-compte-bancaire.component.html (39,15): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../donnees-statiques/donnees-statiques-immeuble/normes-mesures/popup-suppression-norme-mesure.component.html (39,15): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../donnees-statiques/donnees-statiques-immeuble/regions-quartiers/popup-suppression-region.component.html (39,15): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../donnees-statiques/donnees-statiques-immeuble/regions-quartiers/popup-suppression-quartier.component.html (44,15): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../donnees-statiques/donnees-statiques-immeuble/frais-accessoires/popup-suppression-frais-accessoire.component.html (45,15): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../donnees-statiques/donnees-statiques-immeuble/commodites/popup-suppression-commodites.component.html (43,15): Supplied parameters do not match any signature of call target.

ERROR in C:/.../$$_gendir/app/shared/dependances-entites/dependances-region.component.ngfactory.ts (1,1): Property 'length' does not exist on type 'BuildingDistrictDependencyDTO'.
ng:///C:/.../shared/dependances-entites/dependances-region.component.html (2,1): Property 'length' does not exist on type 'BuildingDistrictDependencyDTO'.

ERROR in ng:///C:/.../immeuble/immeubles.component.html (22,29): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../comptabilite/plan-comptable/modeles-plan-comptable.component.html (8,27): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../comptabilite/repartition-charges/repartitions-charges.component.html (8,27): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../autorisations/utilisateurs/utilisateurs.component.html (7,27): Supplied parameters do not match any signature of call target.

ERROR in ng:///C:/.../comptabilite/parametres-comptables/form-parametres-comptables.component.html (134,19): Operator '>' cannot be applied to types 'any[]' and 'number'.

ERROR in ng:///C:/.../autorisations/utilisateurs/form-utilisateur-groupes.component.html (27,25): Supplied parameters do not match any signature of call target.

@valorkin
Copy link
Contributor

valorkin commented Mar 27, 2017

as work around, I am adding

fs.writeFile(`build-error-${line}-${path.basename(fileName)}`,
  `${fileName} (${line + 1},${character + 1}): ${message}
                ${sourceText}`, (err) => {console.log(err)});

in `node_modules/@ngtools/webpack/src/plugins.js

here:

        if (diagnostics.length > 0) {
            const message = diagnostics
                .map(diagnostic => {
                const position = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
                const sourceText = diagnostic.file.getFullText();
                let { line, character, fileName } = this._translateSourceMap(sourceText, diagnostic.file.fileName, position);
                const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
fs.writeFile(`build-error-${line}-${path.basename(fileName)}`,`${fileName} (${line + 1},${character + 1}): ${message}
                ${sourceText}`, (err) => {console.log(err)});
                return `${fileName} (${line + 1},${character + 1}): ${message}`;
            })
                .join('\n');
            this._compilation.errors.push(message);
        }

@FabienDehopre
Copy link

Could a flag be added for that (i.e. ng build --keep-gendir)?

@JacobBrandt
Copy link

JacobBrandt commented Mar 30, 2017

@valorkin Thanks for showing us that! I ended up modifying your code so that the file name generated has the same line number and character position as the error. I also didn't add the additional error message to the top of the file as that throws off the line number count and instead just put the error message on the same line.

Here's that code incase someone finds it useful.

if (diagnostics.length > 0) {
    const message = diagnostics
        .map(diagnostic => {
        const position = diagnostic.file.getLineAndCharacterOfPosition(diagnostic.start);
        let sourceText = diagnostic.file.getFullText();
        let { line, character, fileName } = this._translateSourceMap(sourceText, diagnostic.file.fileName, position);
        const message = ts.flattenDiagnosticMessageText(diagnostic.messageText, '\n');
        let lines = sourceText.split("\n");
        lines[line] = lines[line] + `\/\/ERROR: ${message}`;
        sourceText = lines.join("\n");
         fs.writeFile(`build-error-${line + 1}-${character + 1}-${path.basename(fileName)}`,
            `${sourceText}`, (err) => {console.log(err)});
        return `${fileName} (${line + 1},${character + 1}): ${message}`;
    })
        .join('\n');
    this._compilation.errors.push(message);
}

And the comment it makes to the file

  this.context.ngOnChanges(this._changes);//ERROR: Supplied parameters do not match any signature of call target.

@diestrin
Copy link

+1 for the --keep-gendir flag
I'm currently trying to add AoT to a very complex project, and some very weird issues are showing up. Having the ngfactories would be awesome.

@eppsilon
Copy link

Thanks @valorkin and @JacobBrandt for the @ngtools/webpack patch. Incidentally, it will dump out log files if you run ng test too - I caught some TS errors that weren't always showing up in the CLI output that way.

@filipesilva filipesilva added the P5 The team acknowledges the request but does not plan to address it, it remains open for discussion label May 23, 2017
@jpradeep2003
Copy link

Is this issue fixed and released?
I am using the following, and still getting the same error:
"@angular/cli": "1.1.2",
"@angular/compiler-cli": "^4.0.0",

As reported by @achimha while raising the issue, it is now very difficult to spot the offending code in a module that has been working for months.
Kindly guide how I can figure out the root-cause of the error in my code.

@achimha
Copy link
Author

achimha commented Jun 25, 2017

I have found that with angular 4.2.x, error reporting is much improved and most of the time, the offending line in the template is pointed out. While it was mostly guess work before, I haven't felt the need to inspect a compiled factory in quite some time.

@samrantmedia
Copy link

I did not find 4.2x to give clearer messages. The error was cause for me by the output event on the component html (myEvent)="myEvent($event)" called a method in the component typescript: myEvent(). Changing it to be: (myEvent)="myEvent()" solved this issue.

@wakawaka54
Copy link

Okay so how again are we suppose to figure out where the problem is if we have a:

ERROR in C:/.../src/$$_gendir/app/app.module.ngfactory.ts (159,52): Supplied parameters do not match any signature of call target.

??? I don't see the file mentioned by @JacobBrandt in any file named plugin.js . I am using the CLI and running ng build --prod and ng serve --aot and both of them through this ambiguous error.

@JacobBrandt
Copy link

@wakawaka54 You're looking for this file. node_modules/@ngtools/webpack/src/plugin.js

@hansl hansl added feature Issue that requests a new feature and removed package4: @angular-sdk/webpack labels Jan 24, 2018
@hansl hansl removed their assignment Feb 6, 2018
@filipesilva filipesilva added area: devkit/build-angular and removed P5 The team acknowledges the request but does not plan to address it, it remains open for discussion labels Oct 1, 2019
@ngbot ngbot bot added this to the Backlog milestone Oct 1, 2019
@alan-agius4
Copy link
Collaborator

Closing as this is obsolete. Since factory files are no longer generated with Ivy.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jun 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: devkit/build-angular feature Issue that requests a new feature
Projects
None yet
Development

No branches or pull requests