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

Improve documentation for Xamarin Android ownerWindow and improve exception with null ownerWindow #942

Closed
2 of 5 tasks
jennyf19 opened this issue Mar 5, 2019 · 3 comments
Assignees
Milestone

Comments

@jennyf19
Copy link
Collaborator

jennyf19 commented Mar 5, 2019

Documentation Related To Component:

In Msal v3, developers must pass in an Activity for the ownerWindow on Android.
For example:

result = await App.MsalPublicClient.AcquireTokenInteractive(App.Scopes, App.AndroidActivity).ExecuteAsync();

However, if null is passed in to the ownerWindow, the following error is thrown:
Unhandled Exception: System.PlatformNotSupportedException: Possible Cause: If you are using an XForms app, or generally a netstandard assembly, make sure you add a reference to Microsoft.Identity.Client.dll from each platform assembly (e.g. UWP, Android, iOS), not just from the common netstandard assembly

The error should be something like:
On the Android platform the ownerWindow cannot be null. An Activity must be passed to the ownerWindow in the AcquireTokenInteractive Call. Please see https://aka.ms -something cool for more details and a code sample

Please check those that apply

  • typo
  • documentation doesn't exist
  • documentation needs clarification
  • error(s) in example
  • needs example

See related issue

@jennyf19 jennyf19 added this to the 3.1 milestone Mar 5, 2019
@jennyf19 jennyf19 self-assigned this Mar 5, 2019
@jmprieur
Copy link
Contributor

jmprieur commented Mar 5, 2019

@jennyf19 the fact that the exception is not explicit seems a bug as well?
cc: @henrik-me ?

@bgavrilMS
Copy link
Member

I think this is a duplicate of #918 but I agree that the exception also needs to be fixed.

@jennyf19
Copy link
Collaborator Author

jennyf19 commented Mar 5, 2019

confirmed that when passing in a null ownerWindow on Android, we throw a correct exception w/a clear error message: InvalidOperationException: Activity is required for parent object on Android.

Closing, as I think @bgavrilMS is right and the second part of this issue is a duplicate.

@jennyf19 jennyf19 closed this as completed Mar 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants