-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[google_sign_in] Fixes PlataformException leaking in debug mode (#37343) #1937
[google_sign_in] Fixes PlataformException leaking in debug mode (#37343) #1937
Conversation
|
We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google. ℹ️ Googlers: Go here for more info. |
ce84ed0 to
6fdc1e9
Compare
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
cyanglaz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution! The code looks good!
Do you mind add a test for this. It should be easily testable.
I was thinking about how to add a test for this and I am not sure how to make it, since the |
I haven't tried, but I think you can test it by creating a mock platform class to handle the method channel. Some examples can be found here: plugins/packages/in_app_purchase/test/in_app_purchase_connection/app_store_connection_test.dart Lines 272 to 436 in 374a35a
And in your mock platform class, just throw an exception. Now in your test case, you can do something like bool exceptionCaught;
try {
googleSignIn.signIn();
} catch(e) {
exceptionCaught = true;
}
expect(exceptionCaught, true);Without your change, exceptionCaught should never be assigned to true. |
d5f4d81 to
ffc4cda
Compare
|
The google_sign_in_test.dart has some |
|
@feinstein Yes, if it helps. Also feel free to edit the existing handler or create another if it doesn't suffice your need. |
|
There's a test already there which might be the same code as you suggested: plugins/packages/google_sign_in/test/google_sign_in_test.dart Lines 268 to 273 in 374a35a
Wouldn't this test do the same? It failed to catch this problem. |
|
there is a suppressError parameter in |
|
It was throwing before I fixed it, the example app starts with a The whole issue was that the VM was ignoring |
Makes sense, I think we can merge this now since the test is covered. |
|
I think this fix was regressed as I am experiencing the same problem after an update. |
|
@feinstein the google sign in cancelled issue still persissts flutter/flutter#17677 (comment) |
|
I know, and I communicated this on other issues but no one seemed to care. |
|
it would be really helpful for the community if someone could really fix it. |
|
I don't think it will be an easy fix, the whole code was changed to a more generic one, which makes ir really difficult to fix, as the fix is to remove |
|
I have this same issue, isn't there a workaround for the moment? |
|
Compile in Release, this only happens in Debug. |
|
I can confirm this issue is still present today. I am using version 4.1.1 |
I can confirm it works well in release mode |
|
i can confirm this is still an issue in debug mode |
Description
Prevents
PlatformExceptionfrom leaking in debug mode, as Dart is not able to support an exception thrown in a future because the event loop that handles the future is not able to see the caller's stack trace.Related Issues
flutter/flutter#37343
flutter/flutter#26705
dart-lang/sdk#37268
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?