Issue 1:
I'm submitting a ... (check one with "x")

[ X] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior

In a component I have this:

@ViewChild(AccountFormComponent)
form: AccountFormComponent;

In the template I have this:

<button md-button (click)='save()' [disabled]='!form?.valid'>Save</button>

After the component was rendered, change detection stoped completely.

I tracked it down to the apprefs zone subscription having stopped:

this._zone.onMicrotaskEmpty.subscribe(
{next: () => { this._zone.run(() => { this.tick(); }); }});

Reason was, that this.tick() threw the error

Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'true'. Current value: 'false'.
at viewDebugError (core.es5.js:8625) [angular]
at expressionChangedAfterItHasBeenCheckedError (core.es5.js:8603) [angular]
at checkBindingNoChanges (core.es5.js:8767) [angular]
at checkNoChangesNodeInline (core.es5.js:12195) [angular]
at checkNoChangesNode (core.es5.js:12169) [angular]
at debugCheckNoChangesNode (core.es5.js:12743) [angular]
at debugCheckDirectivesFn (core.es5.js:12645) [angular]
at Object.eval [as updateDirectives] (AccountFormPage.html:4) [angular]
at Object.debugUpdateDirectives [as updateDirectives] (core.es5.js:12627) [angular]
at checkNoChangesView (core.es5.js:12027) [angular]
at callViewAction (core.es5.js:12348) [angular]
at execComponentViewsAction (core.es5.js:12300) [angular]
at checkNoChangesView (core.es5.js:12030) [angular]
at callViewAction (core.es5.js:12348) [angular]

The error is catched by SafeSubscriber.prototype.__tryOrUnsub and propagated up to zone.js.

However, the error was being catched and swallowed by zone.js hasTask function:

ZoneDelegate.prototype.hasTask = function (targetZone, isEmpty) {
// hasTask should not throw error so other ZoneDelegate
// can still trigger hasTask callback
try {
return this._hasTaskZS &&
this._hasTaskZS.onHasTask(this._hasTaskDlgt, this._hasTaskCurrZone, targetZone, isEmpty);
}
catch (err) {
}
};

This made this really hard to debug since change detection just stops working.

I am not really sure why the error occurs, since I have seen this error printed out with change detection continuing to work in other cases.

Expected behavior

Errror printed out, app-ref resubscription to zone.onMicrotaskEmpty, which actually did not stop, only the appref got unsubscribed.

Minimal reproduction of the problem with instructions

Not sure if the combination above (injecting viewchild and using it in the view in an expression) is already enough.

What is the motivation / use case for changing the behavior?

I would at least print some information to the console so developers are not clueless what caused change detection to stop.

However, this might be an issue for zone.js.

Please tell us about your environment:

OS X, angular@4.0.1, zone.js@0.8.5, chrome 57

Issue 2:
I'm submitting a ...

[X] bug report
[ ] feature request

Current behavior

In prod mode, change detection stops working after uncaught exception occurs during the binding evaluation.

Details:

the subscription to zone.onMicrotaskEmpty event, which is established in angular/core/application_ref is being unsubscribed automatically by RxJS (at SafeSubscriber.__tryOrUnsub), when uncaught exception occurs during the binding evaluation, and currently there s no way to recover from uncaught exception during the binding evaluation in prod mode.

Expected/desired behavior

In prod mode, change detection should continue to function properly after uncaught exception during the binding evaluation.

Reproduction of the problem

http://plnkr.co/edit/2fe6GC6NkuFkffpEoDPZ?p=preview

What is the motivation / use case for changing the behavior?

In our project, which previously used angular beta 9, we've built custom error handling (by subsclassing ExceptionHandler).

When in prod mode, the error was displayed in a popup on the current page, with 'Report' button, and other stuff.

After upgrading the project to RC1, we're unable to display the popup on the current page after the uncaught error has occurred.

There should be some ability to recover from an uncaught exception.

Please tell us about your environment:

Angular version: 2.0.0-rc.1 - 2.0.0-rc.3

Browser: all

Language: all