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

alex4998
Copy link
Contributor

@alex4998 alex4998 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.

… completion source set method is called repeatedly.
@googlebot
Copy link
Collaborator

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
Copy link
Collaborator

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 This human has *not* signed the Contributor License Agreement. label Oct 13, 2015
@peleyal peleyal added this to the 1.9.4 milestone Oct 18, 2015
@peleyal
Copy link
Collaborator

peleyal commented Oct 18, 2015

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

@alex4998
Copy link
Contributor Author

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
Copy link
Collaborator

peleyal commented Oct 20, 2015

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

@alex4998
Copy link
Contributor Author

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
Copy link
Collaborator

peleyal 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
Copy link
Contributor Author

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
Copy link
Collaborator

CLAs look good, thanks!

@googlebot googlebot added cla: yes This human has signed the Contributor License Agreement. and removed cla: no This human has *not* signed the Contributor License Agreement. labels Oct 20, 2015
peleyal added a commit that referenced this pull request Oct 21, 2015
Fixing exception InvalidOperationException while authentication
@peleyal peleyal merged commit 2679c25 into googleapis:master Oct 21, 2015
@peleyal
Copy link
Collaborator

peleyal commented Oct 21, 2015

Thanks Alex for fixing it 👍

@alex4998
Copy link
Contributor Author

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
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants