Closed vikram-ma closed 5 years ago
I can reproduce this issue with 2.6.1 and Xamarin Forms.
My Android Build fails with 'Link Framework SDKs only' and with 'None' the build runs till the end, but the App crashes during the splash screen.
@chixlol Crash in splash screen is due to MissingMethodException, it is already logged, issue number https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/issues/744
I am having this issue as well. In fact none of the link options compiles successfully in my Azure DevOps Pipeline -- which is quite discouraging.
Seeing the same issues with DevOps Pipeline. I raised this issue in the Visual Studio for Mac Group, and back channelling through them. But does anyone have a direct connect with the DevOps Team. A simple request, create an Agent that has all version of Tooling and SDK, or Libraries needs Unit Tests for DevOps? Not sure which.
***Update to VS Community Build 15.9.4 resolved the linker error.
I can reproduce it with version 2.6.2. The cause seems to be the TrimStart method in JsonSchemaModelBuilder. This method is not present in mscorlib version 4.0.0.0 or in .NET standard (2.0) implementation of String and fails. Could have used TrimStart(new char[] { '#' }) instead of TrimStart('#'). Same issue with String.Split function that takes a char.
Looking at these 2 issues
@narindermakin - thanks for digging this up. Indeed I can see that the VSTS Hosted 2017 agent is still using VisualStudio/15.8.7, which would explain why I can see this issue at all (I use the latest 15.9.4).
Will investigate some more and contact the VSTS team to get an update on when the hosted agent image will be updated.
I logged a bug on the Xamarin folk. Still investigating on Mac.
It looks like a Mono or Xamarin bug. I can repro it with VS 15.8.7 on Windows.
Please upgrade to latest VS (15.9.*) or VS for Mac.
@bgavrilMS thank you for confirming the resolution. One more assistance needed - with upgrade to 2.6.2 version and Visual Studio 15.9.4, iOS throws following linker exception. It works with version 1.12 preview 0008
{Microsoft.Identity.Client.MsalClientException: Failed to invoke SFSafariViewController ---> ObjCRuntime.RuntimeException: BlockLiteral.SetupBlock is not supported when the dynamic registrar has been linked away.
at ObjCRuntime.BlockLiteral.SetupBlock (System.Delegate trampoline, System.Delegate userDelegate, System.Boolean safe) [0x00002] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.12/src/Xamarin.iOS/ObjCRuntime/Blocks.cs:94
at ObjCRuntime.BlockLiteral.SetupBlockUnsafe (System.Delegate trampoline, System.Delegate userDelegate) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.12/src/Xamarin.iOS/ObjCRuntime/Blocks.cs:162
at AuthenticationServices.ASWebAuthenticationSession..ctor (Foundation.NSUrl url, System.String callbackUrlScheme, AuthenticationServices.ASWebAuthenticationSessionCompletionHandler completionHandler) [0x00040] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.12/src/Xamarin.iOS/AuthenticationServices/ASWebAuthenticationSession.g.cs:81
at Microsoft.Identity.Client.Platforms.iOS.SystemWebview.SystemWebUI.Authenticate (System.Uri authorizationUri, System.Uri redirectUri, Microsoft.Identity.Client.Core.RequestContext requestContext) [0x00021] in <5ec94b08a95e4da5b60d34ec75f131dd>:0
--- End of inner exception stack trace ---
at Microsoft.Identity.Client.Platforms.iOS.SystemWebview.SystemWebUI.Authenticate (System.Uri authorizationUri, System.Uri redirectUri, Microsoft.Identity.Client.Core.RequestContext requestContext) [0x000dd] in <5ec94b08a95e4da5b60d34ec75f131dd>:0
at Microsoft.Identity.Client.Platforms.iOS.SystemWebview.SystemWebUI+
I am using the latest version of VS for mac; still have the problem with Azure Devops...
It looks like a Mono or Xamarin bug. I can repro it with VS 15.8.7 on Windows.
Please upgrade to latest VS (15.9.*) or VS for Mac.
see above
@irjudson - what agent are you using on VSTS? I just checked and all the hosted Mac agents use VS for Mac 7.7.1 or earlier.
@narindermakin - when do you get that exception? It looks like a runtime exception - please provide more details. Are you just performing normal interactive auth in iOS in a Xamarin XForms app? I will try our Xamarin sample on iOS and report back.
@narindermakin - I can't repro that exception. I tried with our sample https://github.com/Azure-Samples/active-directory-xamarin-native-v2 but also with an upgraded version (same code, but added to a brand new XForms project, using the latest xforms.dll)
@narindermakin - I can't repro that exception. I tried with our sample https://github.com/Azure-Samples/active-directory-xamarin-native-v2 but also with an upgraded version (same code, but added to a brand new XForms project, using the latest xforms.dll)
Which version of XForms are you using latest v.Next 4.0 or 3.x.
Also are you seeing this via Azure DevOps, or are you only running a local agent?
I am using latest stable 3.x. I have seen this running on my local machine. It should not matter if it is local machine or Azure DevOps, it's the Visual Studio version that matters.
I am using 3.4.0.1008975 last stable version of Xamarin.Forms with VS 15.9.4 on Windows paired with a Mac (cleared cache on mac also). The exception comes in the call App.PCA.AcquireTokenAsync(scopes, account, App.UiParent). I have monotouch extra args as --optimize=-blockliteral-setupblock. Removing these extra args get's past the acquiretokensync call. However, the token is not cached.
Note that App.PCA.AcquireTokenSilentAsync(scopes, account, authority, false) works as expected and returns below, (since account is null)
ex = {Microsoft.Identity.Client.MsalUiRequiredException: Null account was passed in AcquiretokenSilent API. Pass in an account object or call acquireToken to authenticate.
at Microsoft.Identity.Client.ClientApplicationBase+
<------App.PCA.AcquireTokenAsync(scopes, account, App.UiParent) where account is null ---->
2019-01-03 17:25:37.117 LitMemMobApp.iOS[5574:581218] Failed to invoke SFSafariViewController at Microsoft.Identity.Client.Platforms.iOS.SystemWebview.SystemWebUI.Authenticate (System.Uri authorizationUri, System.Uri redirectUri, Microsoft.Identity.Client.Core.RequestContext requestContext) [0x000dd] in <5ec94b08a95e4da5b60d34ec75f131dd>:0
at Microsoft.Identity.Client.Platforms.iOS.SystemWebview.SystemWebUI+
--- inner exception --- BlockLiteral.SetupBlock is not supported when the dynamic registrar has been linked away.
(ObjCRuntime.RuntimeException) at ObjCRuntime.BlockLiteral.SetupBlock (System.Delegate trampoline, System.Delegate userDelegate, System.Boolean safe) [0x00002] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.12/src/Xamarin.iOS/ObjCRuntime/Blocks.cs:94 at ObjCRuntime.BlockLiteral.SetupBlockUnsafe (System.Delegate trampoline, System.Delegate userDelegate) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.12/src/Xamarin.iOS/ObjCRuntime/Blocks.cs:162 at UIKit.UIAlertActio n.Create (System.String title, UIKit.UIAlertActionStyle style, System.Action`1[T] handler) [0x0002e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.12/src/Xamarin.iOS/UIKit/UIAlertAction.g.cs:106 at Xamarin.Forms.Platform.iOS.Platform.CreateActionWithWindowHide (System.String text, UIKit.UIAlertActionStyle style, System.Action setResult, UIKit.UIWindow window) [0x00015] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:311 at Xamarin.Forms.Platform.iOS.Platform.PresentAlert (Xamarin.Forms.Internals.AlertArguments arguments) [0x00098] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:329 at Xamarin.Forms.Platform.iOS.Platform.<.ctor>b__7_1 (Xamarin.Forms.Page sender, Xamarin.Forms.Internals.AlertArguments arguments) [0x0000a] in D:\a\1\s\Xamarin.Forms.Platform.iOS\Platform.cs:50 at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, System. Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0003b] in /Library/Frameworks/Xamarin.iOS.framework/Versions/12.2.1.12/src/Xamarin.iOS/mcs/class/corlib/System.Reflection/MonoMethod.cs:305 2
Closing, I will update this thread when I hear back from the VSTS people about them updating the Hosted build images.
I think Appcenter face the same issue
CSC : error CS1705: Assembly 'AgentWay' with identity 'AgentWay, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.Identity.Client, Version=2.6.2.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae' which has a higher version than referenced assembly 'Microsoft.Identity.Client' with identity 'Microsoft.Identity.Client, Version=2.1.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'
maybe that regarding to visual studio version installed
https://docs.microsoft.com/en-us/appcenter/build/software#visual-studio-for-mac
Yes, App Center will have the same problem.
The VSTS (Azure DevOps) team have a tentative deadline of end of January for updating the Hosted agents build. It seems to take longer because the new image is very large.
Any update related to this issue. Azure Devops build is failing from last few months @bgavrilMS : It is not failing in App Center. I verified, it is only failing in Azure Devops
@stezma - I am sorry I do not have any update. I will ping the DevOps guys again.
Possible workaround for VSTS https://github.com/AzureAD/microsoft-authentication-library-for-dotnet/issues/852#issuecomment-461318277
I also have this issue in iOS VSTS build.
MTOUCH : error MT2101: Can't resolve the reference 'System.String System.String::Trim(System.Char)', referenced from the method 'System.Threading.Tasks.Task`1
is there any solution for this ?
@kgbuddhima - yes, update Visual Studio
Is there a workaround, I just started getting this bug in devops.
(default target) (1) ->
(_CompileToNative target) ->
MTOUCH : error MT2101: Can't resolve the reference 'System.String System.String::Trim(System.Char)', referenced from the method 'System.Threading.Tasks.Task`1
Did anyone find a fix for this?
Which Version of ADAL are you using ? Microsoft.Identity.Client 2.6.2
Which platform has the issue? Xamarin iOS
Repro Add Microsoft.Identity.Client 2.6.2 package to Xamarin Forms project Set linker behavior to 'Link Framework SDKs only' Compile+Link
Expected behavior There should not be any linker error.
Actual behavior Setting Linker Behavior to 'Link Framework SDKs Only' causes MTouch MT2101 error.
Additional context/ Logs / Screenshots / Users/TestApp/iOS/MTOUCH: Error MT2101: Can't resolve the reference 'System.String System.String::TrimStart(System.Char)', referenced from the method 'Microsoft.Identity.Json.Schema.JsonSchema Microsoft.Identity.Json.Schema.JsonSchemaBuilder::ResolveReferences(Microsoft.Identity.Json.Schema.JsonSchema)' in 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e'. (MT2101) (TestApp.iOS)