-
Notifications
You must be signed in to change notification settings - Fork 213
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
Eliminate (caught) exceptions in startup for to simplify breaking-on-all-exceptions #1261
Comments
Agreed we should get rid of these if possible, I ran into this recently. I had to continue past at least 3 exceptions totally unrelated to my code before anything useful showed up :) |
If we can't get rid of some of them for any reason, another thought I had was having some ability to tell the test framework to pause just before running any tests/user code. That way we could delay setting the exception pause mode until then, rather than doing it before the test framework startup code. It's not as nice (since it needs specific handling from the editor), but it may be worth it to improve this experience. |
The first exception is coming from the sdk, when trying to detect whether we are connected to a terminal or not, I don't see any real way of avoiding that one. The stack trace ones are crashing due to how the
Calling |
I just noticed that this package already has a It might be possible for VS Code to start using that, and just delay the setExceptionPauseMode calls until after the first pause event (I'm assuming we get an event) comes through. |
Do you have more details? What line is this in the test runner? Do you have a stack for where this is in the SDK?
Which line 30? |
Here is the call stack:
The way that the SDK detects whether a terminal is present relies on throwing an exception and catching it.
|
https://dart-review.googlesource.com/c/sdk/+/152922 out for review to remove the exception during It looks like we used to get That changed somewhere between Dart |
Edit: I think I wasn't seeing the exception because I missed layer of wrapping in the package. |
See dart-lang/test#1261 Somewhere between Dart `2.1.0` and Dart `2.2.0` the output from the VM for stack frames in `data:` URIs changed. The new format wraps with `<>` and does not include the full URI. Check specifically whether the matched "uri" is instead a truncated and bracketed `data:` URI and treat it as if it were a valid empty data URI.
See dart-lang/test#1261 Somewhere between Dart `2.1.0` and Dart `2.2.0` the output from the VM for stack frames in `data:` URIs changed. The new format wraps with `<>` and does not include the full URI. Check specifically whether the matched "uri" is instead a truncated and bracketed `data:` URI and treat it as if it were a valid empty data URI.
See dart-lang/test#1261 Throwing and immediately catching an exception has negative implications for debugging and pausing on thrown exceptions. The exception is not needed provided we duplicate a small bit of knowledge - that the function to retrieve terminal size would return a non-list. Change-Id: Ic92f7c0480d58963e857c699aa0251eedeb3e627 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152922 Commit-Queue: Nate Bosch <[email protected]> Auto-Submit: Nate Bosch <[email protected]> Reviewed-by: Zichang Guo <[email protected]>
Seems like these fixes are out - this doesn't happen in v2.9.0. Thanks! |
I have a long standing open issue in Dart-Code about using breaking on all exceptions. It seems to be quite common for people to enable this (in part, I think because Flutter catches exceptions and it's the only way to be able to examine state with the debugger), but when running tests there are a few places where exceptions are thrown during startup, for example:
To make things worse, VS Code doesn't handle this very well because there is no "user code" in the stack trace, so it doesn't know where to focus - so it doesn't focus anywhere. So what the user actually sees is:
I used to work around this by detecting Isolates that were the pub/test snapshots and never setting the exceptionPauseMode for them - however the names of isolates changed which broke that. I was able to re-do it using the isolateGroup names, however I discovered that the exception above is being thrown in the same isolate as the users test code, so that doesn't work either.
I don't have any great ideas for other fixes, so I'm wondering if it's possible to eliminate the exceptions that occur during startup here instead (the one in the screenshot above appears to be trying to parse
<data:application/dart>
as a URI)?The text was updated successfully, but these errors were encountered: