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

Microtasks are no longer dispatched after a runtime syntax error #25745

Closed
nex3 opened this issue Feb 10, 2016 · 2 comments
Closed

Microtasks are no longer dispatched after a runtime syntax error #25745

nex3 opened this issue Feb 10, 2016 · 2 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@nex3
Copy link
Member

nex3 commented Feb 10, 2016

If a syntax error is encountered at runtime, it's not detected synchronously while main() is on the stack, and the isolate recovers using Isolate.setErrorsFatal(false), microtasks in that isolate will cease to be dispatched. For example:

import 'dart:async';
import 'dart:isolate';

void badFn() {continue;}

void main() {
  var errorPort = new ReceivePort();
  Isolate.current.setErrorsFatal(false);
  Isolate.current.addErrorListener(errorPort.sendPort);
  errorPort.listen((message) {
    print("caught error");
    Timer.run(() => print("after timer"));
    scheduleMicrotask(() => print("after microtask"));
  });

  scheduleMicrotask(() => badFn());
}

This prints "caught error" and "after timer", but not "after microtask".

@nex3 nex3 added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. labels Feb 10, 2016
@nex3
Copy link
Member Author

nex3 commented Feb 10, 2016

See also #23684, which proposes to make runtime syntax errors thrown like other exceptions.

nex3 added a commit to dart-lang/stream_channel that referenced this issue Feb 10, 2016
This is slightly more efficient, and also make it easier for other
packages to work around dart-lang/sdk#25745.

R=tjblasi@google.com

Review URL: https://codereview.chromium.org//1690473002 .
@kevmoo kevmoo added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed Type-Defect labels Mar 1, 2016
@natebosch
Copy link
Member

Given that the Dart 2 VM no longer attempts to execute code with a parse error I don't think this issue is relevant anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants