Microsoft-authentication-library-for-dotnet: [Bug] MSAL .NET versions < 4.5.0 do not support system browser on iOS 13

Created on 24 Sep 2019  路  84Comments  路  Source: AzureAD/microsoft-authentication-library-for-dotnet

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

Fixed Supportability bug iOS13 Mobile-iOS

Most helpful comment

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

All 84 comments

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

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.

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

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

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

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.

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

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

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

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

@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?

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

My app is B2C

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

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

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

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).

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

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/2019-06@7af64d1ebe9
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip/rel-1-5-1@b95cf3f
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.27.1@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.

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

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/2019-06@7af64d1ebe9
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip/rel-1-5-1@b95cf3f
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.27.1@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.

@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

@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

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/2019-06@7af64d1ebe9
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip/rel-1-5-1@b95cf3f
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.27.1@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

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/2019-06@7af64d1ebe9
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip/rel-1-5-1@b95cf3f
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.27.1@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/2019-06@7af64d1ebe9
Java.Interop: xamarin/java.interop/d16-3@5836f58
LibZipSharp: grendello/LibZipSharp/d16-3@71f4a94
LibZip: nih-at/libzip/rel-1-5-1@b95cf3f
ProGuard: xamarin/proguard/master@905836d
SQLite: xamarin/sqlite/3.27.1@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:
https://github.com/AzureAD/microsoft-authentication-library-for-objc/issues/698

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

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

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

@stephan14x if you can set this up, it should do the trick. you can send via email if you prefer. [email protected]
thank you.

@jennyf19 email is on its way

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: a583c35f-fc20-46ad-9d83-2da94989a4d7
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 Versions:
3.0.100
2.1.701
2.1.700
2.1.505
2.1.504
2.1.503
2.1.302
2.1.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/6.4.0/lib/mono/msbuild/Current/bin/Sdks

=== .NET Core Runtime ===

Runtime: /usr/local/share/dotnet/dotnet
Runtime Versions:
3.0.0
2.1.12
2.1.11
2.1.9
2.1.8
2.1.7
2.1.2
2.0.5

=== Xamarin.Profiler ===

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

=== Updater ===

Version: 11

=== Xamarin.Android ===

Version: 10.0.0.43 (Visual Studio Enterprise)
Commit: xamarin-android/d16-3/8af1ca8
Android SDK: /Users/758792/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
8.0 (API level 26)
8.1 (API level 27)

SDK Tools Version: 26.1.1
SDK Platform Tools Version: 29.0.1
SDK Build Tools Version: 28.0.3

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

=== Microsoft Mobile OpenJDK ===

Java SDK: /Users/758792/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_8.0.25
1.8.0-25
Android Designer EPL code available here:
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

=== Apple Developer Tools ===

Xcode 11.0 (14936)
Build 11A420a

=== Xamarin.Mac ===

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

=== 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

=== 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

Same issue here with both iOS 13 simulator and iPhone 6s plus device running iOS 13.1.
Using B2C app, MSAL v4.40
But the Suggested workaround given by stephan14x worked.

I can also confirm the workaround by stephan14x:

.WithUseEmbeddedWebView(true)

solve the issue even if the behaviour is different (no popup warning the user about a login through microsoftonline)

Adding .WithUseEmbeddedWebView(true) on the AcquireTokenInteractive call works.
Now our code, @lperezj too, code is working on iOS 13 Emulator.
:)

I confirm that the solution given by stephan14x works, but we cannot use Google authentication with Azure B2C. :P

Great! The solution works correctly thanks

Thank you stephan14x the solution works great, and losing that popup warning about logging in with Microsoft is a nice bonus :)

Please note that using an Embedded Web View instead of the System Browser leads to a poorer experience in terms of SSO - i.e. the system browser will remember the account used to sign in across different applications and end-users do not need to retype their password. The embedded browser does not do this as far as I remember.

Also, note @ChristopherSt-Pierre's observation - B2C configured with Google provider is prevented from working from the embedded browser.

Because of these reasons, we have consciously chosen to make the system browser the default option in MSAL.

I'd recommend logging in a few time with the embedded browser and seeing if the experience is good enough. Consider keeping the system browser on Android until we have a solution for this.

I was able to login with Google (as a B2C provider) without any apparent issues

Please note that using an Embedded Web View instead of the System Browser leads to a poorer experience in terms of SSO - i.e. the system browser will remember the account used to sign in across different applications and end-users do not need to retype their password. The embedded browser does not do this as far as I remember.

Also, note @ChristopherSt-Pierre's observation - B2C configured with Google provider is prevented from working from the embedded browser.

Because of these reasons, we have consciously chosen to make the system browser the default option in MSAL.

I'd recommend logging in a few time with the embedded browser and seeing if the experience is good enough. Consider keeping the system browser on Android until we have a solution for this.

I can confirm that via Embedded Web View, I do have to retype password each time. This isn't ideal, but it will work as a stop gap until a resolution is found. Thanks.

@jennyf19 - can you comment on issues with B2C with Google provider? I remember there was smth done to prevent embedded weview.

@bgavrilMS For Google provider.

The error I got is : 403, Error: disallowed_useragent "Google can't sign you in safely inside this app. You can use Google sign-in by visiting this app's website in a browser like Safari or Chrome".

From Google : "In the coming months, we will no longer allow OAuth requests to Google in embedded browsers knows as 'web-views'"

@bgavrilMS @ChristopherSt-Pierre I documented this in our wiki...embedded webview will not work for google w/b2clogin.com. only if using login.microsoftonline.com...b2clogin.com is not on their allow list.

I also have this issue on physical iOS 13 devices, not just simulators

@SamuelDebruyn Thanks for adding on here. We need to implement a presentation context w/iOS 13 when using system browser. We are in the process of making the changes necessary in MSAL.NET. This thread will be updated accordingly.

the work around suggested does not work for intune managed devices. We get the prompt to login but fails on "Device Needs to be managed" policy. I am assuming it is because UseWithEmbeddedWebView does not share the same cookie information used by Company Portal.

Thanks for the additional info @krudraiah

Sigh, I am happy to see an already existing workaround for this library, thanks @stephan14x
Releasing our latest build to the App store has been a nightmare thanks to iOS13 breaking so many libraries.

Special thanks also to @jennyf19 and @jmprieur for all your work on MSAL (including the documentation) over the last couple of years. You've done a great job.

Special thanks also to @jennyf19 and @jmprieur for all your work on MSAL (including the documentation) over the last couple of years. You've done a great job.

@RhomGit ... @jmprieur, myself, and our entire team appreciate the feedback! Thank you.

@mtanml @andresbj16 @zachgreencbt @rulasg @RhomGit @krudraiah @SamuelDebruyn @ChristopherSt-Pierre @uarcho

FYI - we have updated our wiki and determined the root cause. Thanks @stephan14x for figuring out the workaround so quickly.

Will update here as needed.

cc: @jmprieur @bgavrilMS @henrik-me

First, thanks to jennyf19 and jmprieur for working on this issue.

Could you please provide an estimated time frame for resolving this issue?

Thank you.

@mehamm We are looking to release this on Friday (10/11) end of day (PST).

Great news!

Thanks.

@jennyf19 - will this one be released this week?

@WilliamWatterson86 yes...we had some issues w/AzureDevOps late last week and needed to get an ADAL build out yesterday. Will update here when the MSAL release happens.

@mtanml @andresbj16 @zachgreencbt @rulasg @RhomGit @krudraiah @SamuelDebruyn @ChristopherSt-Pierre @uarcho @stephan14x @WilliamWatterson86

Fix included in the 4.5.0 release.

@jennyf19 - works well for iOS - but in 4.5.0 I am getting an error in Android - is there something special I need to do for this release?

System.TypeLoadException: 'Could not resolve type with token 010000f6 from typeref (expected class 'Microsoft.Identity.Client.Ref.Resource' in assembly 'Microsoft.Identity.Client, Version=4.5.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae')'

@jmprieur - yes the 4.5.0 release is fine for iOS but not for Android - getting an error:

System.TypeLoadException: 'Could not resolve type with token 010000f6 from typeref (expected class 'Microsoft.Identity.Client.Ref.Resource' in assembly 'Microsoft.Identity.Client, Version=4.5.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae')'

@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

Should I raise a new issue for it?

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)

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

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

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

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

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

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

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.

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

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

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.

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

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.

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

App4.zip

I can repro with your app! Investigating.

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

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

Ok thanks @bgavrilMS

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.

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

@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 :)

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

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

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

Was this page helpful?
0 / 5 - 0 ratings