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

[Bug] MSAL .NET versions < 4.5.0 do not support system browser on iOS 13 #1399

Closed
6 tasks
mtanml opened this issue Sep 24, 2019 · 84 comments
Closed
6 tasks

Comments

@mtanml
Copy link

mtanml commented Sep 24, 2019

Edit to original post

If you are using the system browser with iOS 13, please update to MSAL.NET 4.5.0, which uses the required presentation context when authenticating on system browser with iOS 13.

If you are not using 4.5.0+, you will run into the issue listed below:

Starting with iOS 13, when authenticating using the system browser, MSAL .NET is required to provide a presentation context when using ASWebAuthenticationSession. Apple added multi-window support, and therefore they need to specifically know where to present the context (this is a breaking change).

In iOS 12, the AuthenticationSession API was iOS only and apps drew into a single window. However, now, with iPadiOS and macOS support, MSAL .NET will need to give the session a presentationContextProvider, and that presentationContextProvider will provide a window via the PresentationAnchor method.

Customer impact

Your app is impacted if all of the below are true:

  • You have a Xamarin iOS App, and
  • You are targeting iOS 13+, and
  • You use system browser (default in MSAL .NET) for interactive authentication
  • You are using a version lower then 4.5.0 of MSAL .NET

Workaround

  • Update to MSAL.NET 4.5.0, or higher, which includes the necessary fixes for handling the presentation context on iOS 13.

Or,

Example:

AuthenticationResult authResult;
authResult = app.AcquireTokenInteractively(scopes)
                .WithUseEmbeddedWebView(true)
                .ExecuteAsync();

Notable Concerns Regarding the Workaround to Use the Embedded Webview

========

Original Post

Which Version of MSAL are you using ?
MSAL 4.4.0 (also occurs in 4.3.1)

Platform
Xamarin iOS

What authentication flow has the issue?

  • Desktop / Mobile
    • [X ] Interactive
    • Integrated Windows Auth
    • Username Password
    • Device code flow (browserless)
  • Web App
    • Authorization code
    • OBO
  • Web API
    • OBO

Other? - please describe;

Is this a new or existing app?
The app is in production, and works fine on physical iOS devices (on both iOS 12.x and 13.0). I have upgraded my iPhone emulator to iOS 13, and that is where the issue occurs. Everything still works fine in iOS 12.2 on the emulator.

Repro

                    AuthenticationResult ar = await App.PCA.AcquireTokenInteractive(App.Scopes)
                        .WithAccount(Utils.GetAccountByPolicy(accounts, App.PolicySignUpSignIn))
                        .WithParentActivityOrWindow(App.ParentActivityOrWindow)
                        .ExecuteAsync();

Expected behavior
Authentication process initiates

Actual behavior
Immediately returns "authentication_canceled"

Possible Solution

Additional context/ Logs / Screenshots

@andresbj16
Copy link

I receive the same error, initially I thought it was for the version of the nuget package but even updating it to version 4.4.0 of MSAL the same error still occurs

@zachgreencbt
Copy link

I updated to Xcode 11/iOS 13 last night, and my code is now also returning this error. Was working fine prior to the upgrade.

@rulasg
Copy link

rulasg commented Sep 25, 2019

We are having the same issue. Since Xcode update to 11 with iOS 13, now code that works on iOS 12 Emulator return authentication_canceled exception. Repro with Microsoft.Identity.client 4.3.1 and 4.4

@jmprieur
Copy link
Contributor

@zachgreencbt @rulasg @andresbj16 @mtanml : does the iOS emulator have the latest version of Microsoft Authenticator?

@jmprieur
Copy link
Contributor

Also adding the Supportability tab as we'd want better error messages if possible than authentication_canceled.

@lperezj
Copy link

lperezj commented Sep 25, 2019

Mee too. I have the same problem. I update XCode and with the new simulator with IOS 13, not working. I update MSAL from 4.3.x to 4.4.0 and the problem is the same.

@jmprieur
Copy link
Contributor

@lperezj : does the new simulator have the latest Authenticator app?

@uarcho
Copy link

uarcho commented Sep 25, 2019

Same here, getting the authentication_cancelled error in simulator, still have to test on a phisical device

@lperezj
Copy link

lperezj commented Sep 25, 2019

@lperezj : does the new simulator have the latest Authenticator app?

I'm testing with IOS 13 simulator. If i test with IOS 12.2 simulator working fine.

@jennyf19
Copy link
Collaborator

@jmprieur i don't believe this is related to the iOS broker, looks like an issue with the iOS 13 simulator, as @lperezj points out.
Will investigate.

@jmprieur
Copy link
Contributor

@jennyf19 : and it seems at at least some of the affected apps are B2C apps:
@andresbj16, @zachgreencbt @rulasg @lperezj @uarcho are you building b2C apps?

@rulasg
Copy link

rulasg commented Sep 25, 2019

On our case, same project as @lperezj, we are using a corp app using corporative AAD Tenant.

@mtanml
Copy link
Author

mtanml commented Sep 25, 2019

My app is B2C

@jmprieur
Copy link
Contributor

Thanks for confirming that both cases are impacted, @rulasg and @mtanml

@zachgreencbt
Copy link

If it helps, this sample from Microsoft has the same problem, https://github.com/Azure-Samples/active-directory-xamarin-native-v2

@jmprieur
Copy link
Contributor

yes, @zachgreencbt, I've noticed your issue there: Azure-Samples/active-directory-xamarin-native-v2#84, and other confirmations

@mandel-macaque
Copy link
Contributor

Hello,

Can you please provide the full information of your xamarin.iOS installation, would be good to know if this is happening with a package that support xcode11 or with an older one.

The easiest way to get exact version information:

  • On Visual Studio for Mac: "Visual Studio" menu, "About Visual Studio" item, "Show Details" button.
  • On Visual Studio for Windows: "Help menu", "About Microsoft Visual Studio" item.

Then copy/paste the version information (you can use the "Copy Information" button).

The Xcode version information will also be helpful since we have had several releases from Apple. (GM, GM2 or Xcode11 final).

@jennyf19
Copy link
Collaborator

@mtanml @andresbj16 @zachgreencbt @rulasg (see above ^) Thanks @mandel-macaque

@mtanml
Copy link
Author

mtanml commented Sep 25, 2019

Hello,

Can you please provide the full information of your xamarin.iOS installation, would be good to know if this is happening with a package that support xcode11 or with an older one.

The easiest way to get exact version information:

  • On Visual Studio for Mac: "Visual Studio" menu, "About Visual Studio" item, "Show Details" button.
  • On Visual Studio for Windows: "Help menu", "About Microsoft Visual Studio" item.

Then copy/paste the version information (you can use the "Copy Information" button).

The Xcode version information will also be helpful since we have had several releases from Apple. (GM, GM2 or Xcode11 final).

Microsoft Visual Studio Professional 2019
Version 16.3.0
VisualStudio.16.Release/16.3.0+29318.209
Microsoft .NET Framework
Version 4.8.03761

Installed Version: Professional

ADL Tools Service Provider 1.0
This package contains services used by Data Lake tools

ASP.NET and Web Tools 2019 16.3.282.33872
ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019 16.3.282.33872
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 16.3.282.33872
Azure App Service Tools v3.0.0

Azure Data Lake Node 1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio 2.4.1000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools 16.3.282.33872
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio 2.4.1000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.2.0 (d16-2@8b56e20)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Fabric.DiagnosticEvents 1.0
Fabric Diagnostic Events

IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure HDInsight Azure Node 2.4.1000.0
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service 2.4.1000.0
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio 16.0
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service 2.4.1000.0
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node 1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 0x10 - v2.9.20816.1

Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager 2.0.83+gbc8a4b23ec
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Mono Debugging for Visual Studio 16.3.7 (9d260c5)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 5.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

Redgate SQL Change Automation 4.0.19255.10541
Extend DevOps processes to your SQL Server databases and safely automate database deployments.

Visit https://www.red-gate.com/sca/productpage for more information.

Copyright (C) 2011 Red Gate Software Ltd. All rights reserved.

This software contains components from Component Owl.
SQL Server is a registered trademark of Microsoft Corporation.
Visual Studio is a registered trademark of Microsoft Corporation.

SQL Change Automation contains code from the following open source software:

NuGet https://www.nuget.org/
SQL LocalDB Wrapper https://github.com/martincostello/sqllocaldb
Autofac https://autofac.org/
Json.NET https://json.net/
MahApps.Metro http://mahapps.com/
SemVer https://github.com/maxhauser/semver
Log4Net http://logging.apache.org/log4net/
StringTemplate https://github.com/antlr/stringtemplate4
Extended WPF Toolkit https://wpftoolkit.codeplex.com/
Code InfoBox VSX http://www.codeproject.com/Articles/55196/Code-InfoBox-Visual-Studio-Extension-VSX
OctoPack https://github.com/OctopusDeploy/OctoPack
SQLite https://sqlite.org/

This product contains icons from http://www.visualpharm.com distributed under a free backlink license.

For license details or other notices relating to the above software, please see NOTICE.TXT and EULA.rtf in the SQL Change Automation application folder.

Redgate SQL Prompt 9.5.15.11225
Write, format, and refactor SQL effortlessly

SQL Server Data Tools 16.0.61908.27190
Microsoft SQL Server Data Tools

SQL Server Reporting Services 15.0.1484.0
Microsoft SQL Server Reporting Services Designers
Version 15.0.1484.0

ToolWindowHostedEditor 1.0
Hosting json editor into a tool window

TypeScript Tools 16.0.10821.2002
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.4 for F# 4.6 16.3.0-beta.19455.1+0422ff293bb2cc722fe5021b85ef50378a9af823
Microsoft Visual F# Tools 10.4 for F# 4.6

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers

Visual Studio Tools for Kubernetes 1.0
Visual Studio Tools for Kubernetes

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

Xamarin 16.3.0.274 (d16-3@06531f8)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 16.3.0.230 (remotes/origin/d16-3-xcode11@bbe518670)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.3.565 (27e9746)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 10.0.0.43 (d16-3/8af1ca8)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: mono/mono@7af64d1ebe9
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip@b95cf3f
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

Xamarin.iOS and Xamarin.Mac SDK 13.2.0.42 (5e8a208)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

@mandel-macaque
Copy link
Contributor

@mtanml thanks, that is the correct xamarin.ios for xcode11, we will try to reproduce it in the xamarin-ios side to try and get to the bottom of the issue.

@zachgreencbt
Copy link

Hello,

Can you please provide the full information of your xamarin.iOS installation, would be good to know if this is happening with a package that support xcode11 or with an older one.

The easiest way to get exact version information:

  • On Visual Studio for Mac: "Visual Studio" menu, "About Visual Studio" item, "Show Details" button.
  • On Visual Studio for Windows: "Help menu", "About Microsoft Visual Studio" item.

Then copy/paste the version information (you can use the "Copy Information" button).

The Xcode version information will also be helpful since we have had several releases from Apple. (GM, GM2 or Xcode11 final).

Microsoft Visual Studio Professional 2019
Version 16.3.0
VisualStudio.16.Release/16.3.0+29318.209
Microsoft .NET Framework
Version 4.8.03752

Installed Version: Professional

Visual C++ 2019 00435-20150-13783-AA224
Microsoft Visual C++ 2019

ADL Tools Service Provider 1.0
This package contains services used by Data Lake tools

Application Insights Tools for Visual Studio Package 9.1.00913.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2019 16.3.282.33872
ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019 16.3.282.33872
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 16.3.282.33872
Azure App Service Tools v3.0.0

Azure Data Lake Node 1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio 2.3.9000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools 16.3.282.33872
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio 2.3.9000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.2.0 (d16-2@8b56e20)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Fabric.DiagnosticEvents 1.0
Fabric Diagnostic Events

GitFlow.VS.Extension 1.0
Visual Studio extension that integrates GitFlow

IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure HDInsight Azure Node 2.3.9000.0
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service 2.3.9000.0
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio 16.0
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service 2.3.9000.0
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node 1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 0x10 - v2.9.20816.1

Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager 2.0.83+gbc8a4b23ec
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio 16.3.7 (9d260c5)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager 5.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

SQL Server Data Tools 16.0.61908.27190
Microsoft SQL Server Data Tools

ToolWindowHostedEditor 1.0
Hosting json editor into a tool window

TypeScript Tools 16.0.10821.2002
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.4 for F# 4.6 16.3.0-beta.19455.1+0422ff293bb2cc722fe5021b85ef50378a9af823
Microsoft Visual F# Tools 10.4 for F# 4.6

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers

Visual Studio Tools for Kubernetes 1.0
Visual Studio Tools for Kubernetes

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

Windows Template Studio 3.4.19254.1
Windows Template Studio quickly builds a UWP app, using a wizard-based UI to turn your needs into a foundation of Windows 10 patterns and best practices.

Xamarin 16.3.0.274 (d16-3@06531f8)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 16.3.0.230 (remotes/origin/d16-3-xcode11@bbe518670)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.3.565 (27e9746)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 10.0.0.43 (d16-3/8af1ca8)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: mono/mono@7af64d1ebe9
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip@b95cf3f
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

Xamarin.iOS and Xamarin.Mac SDK 13.2.0.42 (5e8a208)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

@andresbj16
Copy link

@zachgreencbt @rulasg @andresbj16 @mtanml : does the iOS emulator have the latest version of Microsoft Authenticator?

Yes, I have the latest version of MSAL I have not verified on a physical device to see if the same thing happens as soon as I have this analysis I will share them

@andresbj16
Copy link

@jennyf19 : and it seems at at least some of the affected apps are B2C apps:
@andresbj16, @zachgreencbt @rulasg @lperezj @uarcho are you building b2C apps?

My app is initially B2E, the authentication issue is addressed with azure active directory

@andresbj16
Copy link

Hello,

Can you please provide the full information of your xamarin.iOS installation, would be good to know if this is happening with a package that support xcode11 or with an older one.

The easiest way to get exact version information:

  • On Visual Studio for Mac: "Visual Studio" menu, "About Visual Studio" item, "Show Details" button.
  • On Visual Studio for Windows: "Help menu", "About Microsoft Visual Studio" item.

Then copy/paste the version information (you can use the "Copy Information" button).

The Xcode version information will also be helpful since we have had several releases from Apple. (GM, GM2 or Xcode11 final).

Visual Studio Enterprise 2019 for Mac
Version 8.3 (build 1805)
Installation UUID: 0c81f74b-067e-4e52-a203-67ba5242d3de
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 5.16.1.24 (d16-3 / 08809f5b)

Package version: 604000198

Mono Framework MDK
Runtime:
Mono 6.4.0.198 (2019-06/fe64a4765e6) (64-bit)
Package version: 604000198

NuGet
Versión: 5.3.0.6192

SDK de .NET Core
SDK: /usr/local/share/dotnet/sdk/3.0.100/Sdks
Versiones del SDK:
3.0.100
2.1.701
SDK de MSBuild: /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/msbuild/Current/bin/Sdks

.NET Core Runtime
Runtime: /usr/local/share/dotnet/dotnet
Versiones de tiempo de ejecución:
3.0.0
2.1.13
2.1.12

Xamarin.Profiler
Versión: 1.6.12.26
Ubicación: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Updater
Versión: 11

Apple Developer Tools
Xcode 11.0 (14936)
Build 11A420a

Xamarin.Mac
Xamarin.Mac not installed. Can't find /Library/Frameworks/Xamarin.Mac.framework/Versions/Current/Version.

Xamarin.iOS
Version: 13.2.0.42 (Visual Studio Enterprise)
Hash: 5e8a208b
Branch: d16-3
Build date: 2019-09-17 14:19:30-0400

Xamarin Designer
Version: 16.3.0.230
Hash: bbe518670
Branch: remotes/origin/d16-3-xcode11
Build date: 2019-09-17 18:39:30 UTC

Xamarin.Android
Versión: 10.0.0.43 (Visual Studio Enterprise)
Confirmación: xamarin-android/d16-3/8af1ca8
Android SDK: /Users/aardila/Library/Developer/Xamarin/android-sdk-macosx
Versiones de Android admitidas:
8.0 (nivel de API 26)

Versión de SDK Tools: 26.1.1
Versión de las herramientas de plataforma del SDK: 29.0.2
Versión de las herramientas de compilación del SDK: 28.0.3

Información de compilación:
Mono: mono/mono@7af64d1ebe9
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip@b95cf3f
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

Microsoft Mobile OpenJDK
Java SDK: /Users/aardila/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
El código EPL de Android Designer está disponible EPL:
https://github.com/xamarin/AndroidDesigner.EPL

Android SDK Manager
Version: 1.4.0.65
Hash: c33b107
Branch: remotes/origin/d16-3
Build date: 2019-09-19 20:42:44 UTC

Android Device Manager
Version: 1.2.0.115
Hash: 724ea69
Branch: remotes/origin/d16-3
Build date: 2019-09-19 20:43:06 UTC

Xamarin Inspector
Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

Build Information
Release ID: 803001805
Git revision: df50511ccb08d4d84a53939f1d7fc0b40cbb0ee1
Build date: 2019-09-20 16:10:55+00
Build branch: release-8.3
Xamarin extensions: da8d448cd65f2cc87c5e6dc7e2c2ca7b96d20c72

Operating System
Mac OS X 10.14.6
Darwin 18.7.0 Darwin Kernel Version 18.7.0
Tue Aug 20 16:57:14 PDT 2019
root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64

@stephan14x
Copy link

stephan14x commented Sep 25, 2019

Hi,

I have the same problem, but on the Simulator and on my physical device.

Which Version of MSAL are you using ?
MSAL 4.4.0 (also occurs in 4.3.1)

Platform
Xamarin iOS

What authentication flow has the issue?
Desktop / Mobile
[X ] Interactive - against Azure AD Tennant

Is this a new or existing app?
App is in development, early stage, but was previously working on iOS 12.4 on device and simulator.

Test devices
iOS 13 Simulator - no MS Authenticator App installed
iOS 13.1 on iPhone 7 - MS Authenticator App V 6.3.19 installed and multiple accounts added

Possible Solution or Workaround
When I add .WithUseEmbeddedWebView(true) to AcquireTokenInteractive both device and simulator are working again.
So the problem may have something to do with calling the system browser? Previously there was this popup message requesting permission to use microsoftonline.com to authenticate, which is no longer appearing.

 authResult = await PCA.AcquireTokenInteractive(Scopes)
                                      .WithUseEmbeddedWebView(true) 
                                      .WithAccount(accounts.FirstOrDefault())
                                      .WithPrompt(Prompt.SelectAccount)
                                      .ExecuteAsync();

On Visual Studio for Windows: "Help menu", "About Microsoft Visual Studio" item.

Microsoft Visual Studio Community 2019
Version 16.3.1
VisualStudio.16.Release/16.3.1+29324.140
Microsoft .NET Framework
Version 4.8.03761

Installed Version: Community

Visual C++ 2019 00435-60000-00000-AA416
Microsoft Visual C++ 2019

ADL Tools Service Provider 1.0
This package contains services used by Data Lake tools

ASP.NET and Web Tools 2019 16.3.283.64955
ASP.NET and Web Tools 2019

ASP.NET Web Frameworks and Tools 2019 16.3.283.64955
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0 16.3.283.64955
Azure App Service Tools v3.0.0

Azure Data Lake Node 1.0
This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio 2.4.1000.0
Microsoft Azure Data Lake Tools for Visual Studio

Azure Functions and Web Jobs Tools 16.3.283.64955
Azure Functions and Web Jobs Tools

Azure Stream Analytics Tools for Visual Studio 2.4.1000.0
Microsoft Azure Stream Analytics Tools for Visual Studio

C# Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Extensibility Message Bus 1.2.0 (d16-2@8b56e20)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

Fabric.DiagnosticEvents 1.0
Fabric Diagnostic Events

IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info

Microsoft Azure HDInsight Azure Node 2.4.1000.0
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service 2.4.1000.0
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio 16.0
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service 2.4.1000.0
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node 1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 0x10 - v2.9.20816.1

Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager 2.0.83+gbc8a4b23ec
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio 16.3.7 (9d260c5)
Support for debugging Mono processes with Visual Studio.

Node.js Tools 1.5.10807.1 Commit Hash:4d3cf548113f5a53a02d83a877ee24e764b2cde4
Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager 5.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Office Developer Tools for Visual Studio 16.0.29217.00
Microsoft Office Developer Tools for Visual Studio

ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

SQL Server Data Tools 16.0.61908.27190
Microsoft SQL Server Data Tools

ToolWindowHostedEditor 1.0
Hosting json editor into a tool window

TypeScript Tools 16.0.10821.2002
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools 3.3.1-beta3-19461-02+2fd12c210e22f7d6245805c60340f6a34af6875b
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual F# Tools 10.4 for F# 4.6 16.3.0-beta.19455.1+0422ff293bb2cc722fe5021b85ef50378a9af823
Microsoft Visual F# Tools 10.4 for F# 4.6

Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers

Visual Studio Tools for Kubernetes 1.0
Visual Studio Tools for Kubernetes

Visual Studio Tools for Unity 4.3.3.0
Visual Studio Tools for Unity

VisualStudio.Mac 1.0
Mac Extension for Visual Studio

Web Accessibility Checker 1.5.58
The easiest way to perform accessibility checks on any ASP.NET web application. Fully customizable and support all the major international accessibility standards.

Workflow Manager Tools 1.0 1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin 16.3.0.274 (d16-3@06531f8)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer 16.3.0.230 (remotes/origin/d16-3-xcode11@bbe518670)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates 16.3.565 (27e9746)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK 10.0.0.43 (d16-3/8af1ca8)
Xamarin.Android Reference Assemblies and MSBuild support.
Mono: mono/mono@7af64d1ebe9
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip@b95cf3f
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

Xamarin.iOS and Xamarin.Mac SDK 13.2.0.42 (5e8a208)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

On Visual Studio for Mac: "Visual Studio" menu, "About Visual Studio" item, "Show Details" button.

=== Visual Studio Community 2019 for Mac ===

Version 8.3 (build 1805)
Installation UUID: a5347a83-fd65-48f3-ac10-99c82e59b239
GTK+ 2.24.23 (Raleigh theme)
Xamarin.Mac 5.16.1.24 (d16-3 / 08809f5b)

Package version: 604000198

=== Mono Framework MDK ===

Runtime:
Mono 6.4.0.198 (2019-06/fe64a4765e6) (64-bit)
Package version: 604000198

=== NuGet ===

Version: 5.3.0.6192

=== .NET Core SDK ===

SDK: /usr/local/share/dotnet/sdk/3.0.100/Sdks
SDK-Versionen:
3.0.100
2.1.701
2.1.505
MSBuild-SDKs: /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core-Runtime ===

Laufzeit: /usr/local/share/dotnet/dotnet
Laufzeitversionen:
3.0.0
2.1.13
2.1.12
2.1.9

=== Xamarin.Profiler ===

Version: 1.6.11.16
Speicherort: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Updater ===

Version: 11

=== Xamarin.Android ===

Version: 10.0.0.43 (Visual Studio Community)
Commit:xamarin-android/d16-3/8af1ca8
Android SDK: /Users/stephan/Library/Developer/Xamarin/android-sdk-macosx
Unterstützte Android-Versionen:
8.1 (API-Ebene 27)

Version von SDK Tools: 26.1.1
Version der SDK-Plattformtools: 28.0.0
Version der SDK-Buildtools: 27.0.3

Buildinformationen:
Mono: mono/mono@7af64d1ebe9
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip@b95cf3f
ProGuard: xamarin/proguard@905836d
SQLite: xamarin/sqlite@8212a2d
Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-3@cb41333

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/stephan/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.25
1.8.0-25
Android Designer EPL-Code ist hier verfügbar:
https://github.com/xamarin/AndroidDesigner.EPL

=== Android SDK Manager ===

Version: 1.4.0.65
Hash: c33b107
Branch: remotes/origin/d16-3
Build date: 2019-09-19 20:42:44 UTC

=== Android Device Manager ===

Version: 1.2.0.115
Hash: 724ea69
Branch: remotes/origin/d16-3
Build date: 2019-09-19 20:43:06 UTC

=== Apple Developer Tools ===

Xcode 11.0 (14936)
Build 11A420a

=== Xamarin.Mac ===

Version: 6.2.0.42 (Visual Studio Community)
Hash: 5e8a208b
Branch: d16-3
Build date: 2019-09-17 14:19:30-0400

=== Xamarin.iOS ===

Version: 13.2.0.42 (Visual Studio Community)
Hash: 5e8a208b
Branch: d16-3
Build date: 2019-09-17 14:19:30-0400

=== Xamarin Designer ===

Version: 16.3.0.230
Hash: bbe518670
Branch: remotes/origin/d16-3-xcode11
Build date: 2019-09-17 18:39:30 UTC

=== Xamarin Inspector ===

Version: 1.4.3
Hash: db27525
Branch: 1.4-release
Build date: Mon, 09 Jul 2018 21:20:18 GMT
Client compatibility: 1

=== Build Information ===

Release ID: 803001805
Git revision: df50511ccb08d4d84a53939f1d7fc0b40cbb0ee1
Build date: 2019-09-20 16:10:55+00
Build branch: release-8.3
Xamarin extensions: da8d448cd65f2cc87c5e6dc7e2c2ca7b96d20c72

=== Operating System ===

Mac OS X 10.14.6
Darwin 18.7.0 Darwin Kernel Version 18.7.0
Tue Aug 20 16:57:14 PDT 2019
root:xnu-4903.271.2~2/RELEASE_X86_64 x86_64

Additional context/ Logs / Screenshots

I have not tried to remove the Authenticator App as suggested here:
AzureAD/microsoft-authentication-library-for-objc#698

If you need additional information please advise how to obtain them.

@jennyf19
Copy link
Collaborator

@stephan14x can you provide logs for the device + authenticator case?

@stephan14x
Copy link

@jennyf19 how do I create the logs you need? preferable from Visual Studio on Windows (Device connected with USB to Mac) any help appreciated

@jmprieur
Copy link
Contributor

jmprieur commented Oct 16, 2019

@WilliamWatterson86 are you sure that the nuget packages were well restored/updated?
We've seen cases with package.json and project files for Android are not in sync

cc: @bgavrilMS

@WilliamWatterson86
Copy link

Should I raise a new issue for it?

@jmprieur
Copy link
Contributor

If this is what I think it is, it's more a visual studio or Xamarin issue.
Could you confirm that pacakge.json and Android project file in your solution have different version for MSAL.NET (the hintPath)

@jennyf19
Copy link
Collaborator

@WilliamWatterson86 this happened to another customer with an adal package...be had to clear the nuget cache and then things worked, but clearing it also didn't completely clear it. He and to restart everything as well. This was a VS issue as @jmprieur points out.

@WilliamWatterson86
Copy link

WilliamWatterson86 commented Oct 16, 2019

@jennyf19 @jmprieur - I cleared out the Nuget cache (Tools -> Options -> NuGet Package Manager -> Clear All NuGet Cache(s)), deleted bin and obj folders, restarted machine and still having the same issue.

Checked the Android csproj and have the following in there:

<PackageReference Include="Microsoft.Identity.Client"> <Version>4.5.0</Version> </PackageReference>

Downgrading to 4.4.0 or 4.3.1 work no probs.

@bgavrilMS
Copy link
Member

@WilliamWatterson86 - do your xamarin projects still use packages.config? If they do, you'll need to migrate to PackageReference.

@WilliamWatterson86
Copy link

@bgavrilMS - nope they all use PackageReference - no package.config files in solution

@bgavrilMS
Copy link
Member

Are you getting this at runtime or at buildtime? What linker options does your Android project use?

@WilliamWatterson86
Copy link

@bgavrilMS this issue only appears at run time. The project builds no problem.
Android linking for this build config is set to None.
Tried on another dev machine here and second Xamarin project and having same issue - 4.5.0 fails, 4.4.0 and 4.3.1 work as expected.

@bgavrilMS
Copy link
Member

bgavrilMS commented Oct 16, 2019

I just tried to create a new Xamarin app and configure MSAL from the Android head and this seemed to have worked fine. I am using VS 2019 (on Windows) latest version and an Android Emulator.

@WilliamWatterson86
Copy link

WilliamWatterson86 commented Oct 16, 2019

Really weird - I created a blank Xamarin Forms app and added the Microsoft.Identity.Client nuget and I get the same error as soon as it starts up too...

VS 16.3.5
Xamarin: 16.3.0.277
Xamarin.Android.SDK 10.0.3.0

UNHANDLED EXCEPTION:
10-16 13:18:43.263 I/MonoDroid(23861): System.TypeInitializationException: The type initializer for 'Attribute' threw an exception. ---> System.TypeLoadException: Could not resolve type with token 01000022 from typeref (expected class 'Microsoft.Identity.Client.Ref.Resource' in assembly 'Microsoft.Identity.Client, Version=4.5.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae')
10-16 13:18:43.263 I/MonoDroid(23861): at Android.Runtime.ResourceIdManager.UpdateIdValues () [0x00097] in <11a340ccc8de43f09c97400139266ef5>:0
10-16 13:18:43.263 I/MonoDroid(23861): at Xamarin.Forms.Platform.Android.Resource+Attribute..cctor () [0x012a2] in D:\a\1\s\Xamarin.Forms.Platform.Android\Resources\Resource.Designer.cs:1579
10-16 13:18:43.263 I/MonoDroid(23861): --- End of inner exception stack trace ---
10-16 13:18:43.263 I/MonoDroid(23861): at (wrapper managed-to-native) System.Object.__icall_wrapper_mono_generic_class_init(intptr)
10-16 13:18:43.263 I/MonoDroid(23861): at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.ActionBarHeight () [0x00000] in D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\NavigationPageRenderer.cs:476
10-16 13:18:43.263 I/MonoDroid(23861): at Xamarin.Forms.Platform.Android.AppCompat.NavigationPageRenderer.OnLayout (System.Boolean changed, System.Int32 l, System.Int32 t, System.Int32 r, System.Int32 b) [0x0001a] in D:\a\1\s\Xamarin.Forms.Platform.Android\AppCompat\NavigationPageRenderer.cs:392
10-16 13:18:43.263 I/MonoDroid(23861): at Xamarin.Forms.Platform.Android.FormsViewGroup.n_OnLayout_ZIIII (System.IntPtr jnienv, System.IntPtr native__this, System.Boolean p0, System.Int32 p1, System.Int32 p2, System.Int32 p3, System.Int32 p4) [0x00008] in D:\a\1\s\Xamarin.Forms.Platform.Android.FormsViewGroup\obj\Release\generated\src\Xamarin.Forms.Platform.Android.FormsViewGroup.cs:198
10-16 13:18:43.263 I/MonoDroid(23861): at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.40(intptr,intptr,bool,int,int,int,int)
10-16 13:18:43.278 W/zygote64(23861): JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable

@bgavrilMS
Copy link
Member

You're on a newer version of VS than I am, the update must have just come out. Let me upgrade.

@WilliamWatterson86
Copy link

I thought that might have been it too since I only updated VS this morning - but I tried on another dev's machine who is on an earlier version of VS 2019 and the same error occurred.

@WilliamWatterson86
Copy link

Did you install the Microsoft.Identity.Client from nuget then? v4.5.0?
Do you want me to upload my blank project? I didnt even configure MSAL in it, i just added the nuget package and the app crashes on startup

@bgavrilMS
Copy link
Member

Yes, I have the exact version of VS and xamarin SDKs as you do now. I am using an Android emulator.

The exception seems to suggest that there is an issue with the android resource file. This is a cs file that is generated and there were some bugs in the past where VS would not re-generate it. Still, very strange that I am not able to repro this.

@WilliamWatterson86
Copy link

This is a blank app using the VS2019 template and I have added the MSAL library

App4.zip

@bgavrilMS
Copy link
Member

I can repro with your app! Investigating.

@WilliamWatterson86
Copy link

WilliamWatterson86 commented Oct 16, 2019

Ok great - just noticed that the Resource.designer.cs does not have any entries for Microsoft.Identity.Client in versions 4.4.0 and 4.3.1 - but when I add in reference to 4.5.0 I get loads of these in the Resource.designer.cs - so it looks like these are new?

global::Microsoft.Identity.Client.Ref.Resource.Animation.abc_fade_in = global::App4.Droid.Resource.Animation.abc_fade_in;
global::Microsoft.Identity.Client.Ref.Resource.Animation.abc_fade_out = global::App4.Droid.Resource.Animation.abc_fade_out;

... list continues ...

@bgavrilMS bgavrilMS reopened this Oct 16, 2019
@bgavrilMS
Copy link
Member

Resources.designer.cs is generated by the build. I'm looking into the DLL with a dissasembler and I can see that in 4.4. there is no Resource class, while there is indeed a resource class in 4.5

@WilliamWatterson86
Copy link

Ok thanks @bgavrilMS

@bgavrilMS
Copy link
Member

I have a potential workaround - downgrade MSAL to 4.4 on the Android head but keep the iOS at 4.5. You can also keep the shared project at 4.5, it doesn't really matter.

At runtime, the Android will use MSAL 4.4 and iOS will use MSAL 4.5. This should be fine because the 4.5 release has virtually no impact on Android code paths.

@WilliamWatterson86
Copy link

Ok great thanks @bgavrilMS - sounds good let me try that here

@WilliamWatterson86
Copy link

@bgavrilMS - just to confirm I tried that and it seems to work no problem - Android app loads and can log in etc. Thanks for your help :)

@bgavrilMS
Copy link
Member

Thanks for confirming @WilliamWatterson86, now for the fun part of hunting down obscure Xamarin build bugs :)

@jennyf19
Copy link
Collaborator

@bgavrilMS I think we should open a separate issue for this. What do you think?

@jmprieur
Copy link
Contributor

@bgavrilMS @jennyf19 yes I agree. Let's open a different one (this one is fixed)

@bgavrilMS
Copy link
Member

Tracking the typeload exception here: #1449

@jennyf19 jennyf19 changed the title [Bug] MSAL .NET on iOS 13 does not support system browser [Bug] MSAL .NET versions < 4.5.0 do not support system browser on iOS 13 Oct 16, 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