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

Fixing exception InvalidOperationException while authentication #609

Merged
merged 1 commit into from Oct 21, 2015

Conversation

Projects
None yet
3 participants
@alex4998
Copy link
Contributor

commented Oct 9, 2015

It seems there is a rather serious problem with the GoogleWebAuthorizationBroker.AuthorizeAsync invocation. Somewhere deep inside the code flow there is WebAuthenticationBrokerUserControl class and the method OnBrowserNavigating. This method constantly throwing this exception

System.InvalidOperationException: An attempt was made to transition a task to a final state when it had already completed.
at System.Threading.Tasks.TaskCompletionSource`1.SetResult(TResult result)
at Google.Apis.Auth.OAuth2.WebAuthenticationBrokerUserControl.OnBrowserNavigating(Object sender, NavigatingEventArgs e)
at Microsoft.Phone.Controls.WebBrowser.FireNavigatingEvent(Uri uri, Boolean& cancel) at Microsoft.Phone.Controls.WebBrowserInterop.ReversePInvokeThunk.OnNavigating(Int32 webBrowserControlId, String uri, Boolean& cancel)

Changing Set methods to TrySet methods will resolve the issue. Why the method is called repeatedly and is this OK is a different question. Anyway changing the methods won't break anything, won't change the main logic but will fix the issue.

Making sure an exception is not thrown while authentication when task…
… completion source set method is called repeatedly.
@googlebot

This comment has been minimized.

Copy link
Collaborator

commented Oct 13, 2015

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.
1 similar comment
@googlebot

This comment has been minimized.

Copy link
Collaborator

commented Oct 13, 2015

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project, in which case you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@googlebot googlebot added the cla: no label Oct 13, 2015

@peleyal peleyal added this to the 1.9.4 milestone Oct 18, 2015

@peleyal

This comment has been minimized.

Copy link
Collaborator

commented Oct 18, 2015

LGTM! Did you sign the CLA? I want to marge it 👍 Thanks for fixing it!

@alex4998

This comment has been minimized.

Copy link
Contributor Author

commented Oct 19, 2015

Yes, I did.

From: Eyal Peled [mailto:notifications@github.com]
Sent: Sunday, October 18, 2015 16:32
To: google/google-api-dotnet-client
Cc: alex4998
Subject: Re: [google-api-dotnet-client] Fixing exception InvalidOperationException while authentication (#609)

LGTM! Did you sign the CLA? I want to marge it 👍 https://assets-cdn.github.com/images/icons/emoji/unicode/1f44d.png Thanks for fixing it!


Reply to this email directly or view it on GitHub #609 (comment) . https://github.com/notifications/beacon/AOUds5p2wWq5qBqIwWmuDrnFnmA4o6bhks5o8_kygaJpZM4GMQuM.gif


This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

@peleyal

This comment has been minimized.

Copy link
Collaborator

commented Oct 20, 2015

I don't find your name in the list of approved users. With which email did you sign it?

@alex4998

This comment has been minimized.

Copy link
Contributor Author

commented Oct 20, 2015

Hm… I seem to lost that e-mail. I don’t know, I simply clicked on the link and then agreed to the terms. What e-mail was there… I guess this alex.49.98@gmail.com. Sometimes I see different software systems change the e-mail to alex4998@gmail.com and it works exactly the same. I cannot explain this phenomenon.

Alex

From: Eyal Peled [mailto:notifications@github.com]
Sent: Monday, October 19, 2015 22:09
To: google/google-api-dotnet-client
Cc: alex4998
Subject: Re: [google-api-dotnet-client] Fixing exception InvalidOperationException while authentication (#609)

I don't find your name in the list of approved users. With which email did you sign it?


Reply to this email directly or view it on GitHub #609 (comment) . https://github.com/notifications/beacon/AOUds3758oiAUFPuZRRnCQB_JWhDN6fuks5o9ZmtgaJpZM4GMQuM.gif


This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

@peleyal

This comment has been minimized.

Copy link
Collaborator

commented Oct 20, 2015

Alex, I can't find those two emails. Can you please try again?
Sorry for this inconvenient process. It's just so important for us for legal reasons.

Thanks so much!
Eyal

@alex4998

This comment has been minimized.

Copy link
Contributor Author

commented Oct 20, 2015

Could you check again? I re-signed it. E-mail address is definitely alex.49.98@gmail.com. See screenshots below.

From: Eyal Peled [mailto:notifications@github.com]
Sent: Tuesday, October 20, 2015 13:28
To: google/google-api-dotnet-client
Cc: alex4998
Subject: Re: [google-api-dotnet-client] Fixing exception InvalidOperationException while authentication (#609)

Alex, I can't find those two emails. Can you please try again?
Sorry for this inconvenient process. It's just so important for us for legal reasons.

Thanks so much!
Eyal


Reply to this email directly or view it on GitHub #609 (comment) . https://github.com/notifications/beacon/AOUds5QydRPNve4gPmjdKwW8zJHFRqufks5o9nEIgaJpZM4GMQuM.gif


This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

@googlebot

This comment has been minimized.

Copy link
Collaborator

commented Oct 20, 2015

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Oct 20, 2015

peleyal added a commit that referenced this pull request Oct 21, 2015

Merge pull request #609 from alex4998/master
Fixing exception InvalidOperationException while authentication

@peleyal peleyal merged commit 2679c25 into googleapis:master Oct 21, 2015

1 check passed

cla/google All necessary CLAs are signed
@peleyal

This comment has been minimized.

Copy link
Collaborator

commented Oct 21, 2015

Thanks Alex for fixing it 👍

@alex4998

This comment has been minimized.

Copy link
Contributor Author

commented Oct 21, 2015

No problems. By the way, all other places which have Set calls instead of TrySet calls could be safely changed improving the overall stability. I didn’t check other places, I’m just saying that if you review the code and do it you won’t break anything you’ll eliminate possible issues. Frankly speaking, I don’t understand why Set methods were created in the first place. The whole concept of Task object as it was designed assumes single transition from one state to another and there is no point in throwing exception.

From: Eyal Peled [mailto:notifications@github.com]
Sent: Wednesday, October 21, 2015 11:18
To: google/google-api-dotnet-client
Cc: alex4998
Subject: Re: [google-api-dotnet-client] Fixing exception InvalidOperationException while authentication (#609)

Thanks Alex for fixing it 👍 https://assets-cdn.github.com/images/icons/emoji/unicode/1f44d.png


Reply to this email directly or view it on GitHub #609 (comment) . https://github.com/notifications/beacon/AOUds38jqEt3k-i66NjLswgSZF_pZRVcks5o96QggaJpZM4GMQuM.gif


This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

@peleyal peleyal modified the milestones: 1.10, 1.9.4 Oct 27, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.