-
Notifications
You must be signed in to change notification settings - Fork 218
Debugging AOT apps throws "Cannot read property 'get' of null" #733
Comments
It looks like we are going to have great difficulty debugging AoT applications in Augury. This is because the values we get back from However, I am not sure there really is a need to support AoT applications in Augury. After all, AoT is a performance optimization and I'm not sure what the use-case is for enabling it on debug builds -- especially if it is going to make debugging difficult. What do you think? Here is what we get back from
The main properties we need are |
I think what you've said makes sense - AOT shouldn't really be used for debug builds and you can't expect all the normal tools to work with an AOT app when most of the Angular internals have been stripped out of it. However I do think that Augury should handle this a bit more elegantly than it does right now, perhaps just by catching this use case and emitting a console warning about not supporting AOT builds. Especially when the error message is so cryptic at the moment :) |
I would like to use AoT for all development, for example so that the extra restrictions on ng2 apps to be AoT-compatible are enforced earlier. |
We already do. Just make sure the "debug" flag is set. Augury might just
|
@alexeagle @tbosch Indeed |
Until we are able to come to a better resolution of this issue (i.e. we find a way to get all the DebugElement info we are already getting for non-AoT apps), this PR produces a friendly error when someone tries to debug an app with AoT enabled: #741 |
Ah, sorry, to be a bit more clear, the user has to do the following:
In the future, we want to remove the flag On Tue, Oct 18, 2016 at 6:50 AM Christopher Bond notifications@github.com
|
Hey Tobias. Maybe I am doing something egregiously stupid, but this is not my experience. I created a new app with "ng new" and then ran with "ng serve --aot=true --debug=true". In my Console it says: Then if I try to get the DebugElement for the root component using
On this object, both |
@tbosch When you say "use AOT with debug = true", how is that debug flag set, and has it changed in recent versions? Using 1.0.0-beta.17, |
It's an option for angularCompilerOptions in the tsconfig.json: https://github.com/angular/angular/blob/master/tools/@angular/tsc-wrapped/src/options.ts#L27 On Wed, Oct 19, 2016 at 9:06 AM Steven Kampen notifications@github.com
|
@alexeagle Thanks! That was our misunderstanding, and the issue looks to be resolved. Edit: It's working for me with an entry in tsconfig.json like:
|
Alright, I think I understand now. Even if the application is running in debug mode and prints "Angular 2 is running in development mode" to the console, it's not actually in debug mode until you add |
@tbosch should the message about the debug mode still appear on the console even if the flag for the debug mode is not set in |
These 2 flags are sadly independent right now. In the future, we want to On Wed, Oct 19, 2016 at 11:10 AM Igor Kamenetsky notifications@github.com
|
Note that one is "development mode" and one is "debug mode". The latter is On Wed, Oct 19, 2016 at 1:36 PM Tobias Bosch notifications@github.com
|
@alexeagle thanks, this makes perfect sense now. We will add a section about AoT support in our readme and close this issue after. |
For all AOT apps I've tried, the Augury debugger (v1.2.1) throws the following error in the console:
The line of code within Augury that throws this error is:
It seems like the extension is failing to resolve the root injector on AOT apps.
Ideally the extension should support the debugging of AOT apps but, if not, this error should be replaced with a more readable log message.
The text was updated successfully, but these errors were encountered: