Giter Site home page Giter Site logo

Cannot build Xamarin.iOS App when Azure.Identity Nugets are installed. If I remove them then it builds and runs fine about microsoft-authentication-extensions-for-dotnet HOT 31 CLOSED

norton287 avatar norton287 commented on August 25, 2024 3
Cannot build Xamarin.iOS App when Azure.Identity Nugets are installed. If I remove them then it builds and runs fine

from microsoft-authentication-extensions-for-dotnet.

Comments (31)

DRAirey1 avatar DRAirey1 commented on August 25, 2024 4

I build a Maui app from the template in Visual Studio 2022, ver. 17.3.1. Upgraded to the latest NuGet packages. Installed Microsoft.Identity.Client.Extensions.Msal 2.23.0 and added this code to the OnCounterClicked method of MainPage.xaml.cs:

        var signInApplication = PublicClientApplicationBuilder
            .Create("6a7fefdb-47b3-4a25-87a3-593c12a4115b")
            .WithIosKeychainSecurityGroup("com.microsoft.adalcache")
            .WithRedirectUri("msal6a7fefdb-47b3-4a25-87a3-593c12a4115b://auth")
            .WithB2CAuthority(@"https://thetarexproduction.b2clogin.com/tfp/thetarexproduction.onmicrosoft.com/B2C_1_SignIn")
            .Build();
        var accounts = await signInApplication.GetAccountsAsync("B2C_1_SignIn").ConfigureAwait(false);
        string[] scopes = new string[]
        {
            "https://aspen-asset-management.com/a47aac20-2077-4910-8cb6-b4bf32069c0b/read",
            "https://aspen-asset-management.com/a47aac20-2077-4910-8cb6-b4bf32069c0b/write"
        };
        AuthenticationResult authenticationResult = await signInApplication.AcquireTokenSilent(scopes, accounts.FirstOrDefault())
            .ExecuteAsync(CancellationToken.None)
            .ConfigureAwait(false);
        this.User = authenticationResult.ClaimsPrincipal;

The result is:

clang++ exited with code 1

This means that no one can build a Maui application that uses MSAL.

from microsoft-authentication-extensions-for-dotnet.

rolfbjarne avatar rolfbjarne commented on August 25, 2024 2

The fix is simple: change the library name to be /usr/lib/libSystem.dylib instead of /System/Library/Frameworks/System.framework/System (/usr/lib/libSystem.dylib exists on all Apple platforms)

from microsoft-authentication-extensions-for-dotnet.

DRAirey1 avatar DRAirey1 commented on August 25, 2024 2

Will check 4.46.0-preview2 anyway though just to see if it leaves us with a working version, thanks.

It allowed me to build a MAUI application and deliver it through the App Store.

from microsoft-authentication-extensions-for-dotnet.

MGohil avatar MGohil commented on August 25, 2024 2

@breenbob @bgavrilMS @DRAirey1

I tried with 3 different versions today and and found that Version 4.46.2 is giving clang++ error in ios while building the app. However, the latest version (4.47.0), recently launched, and 4.46.0-preview2 versions works well in Android and iOS both platforms and gives me the Access Token after B2C login.

image

from microsoft-authentication-extensions-for-dotnet.

breenbob avatar breenbob commented on August 25, 2024 1

We're having same issue with the MSAL sample app for iOS after updating the Nugets to the latest Microsoft.Identity.Client 4.46.2. Also tried installing the transitive dependency for Microsoft.IdentityModel.Abstractions as noticed that was bringing in the min version which was a few off the latest - made no difference. @norton287 can you confirm if the nugets fixed the issue for you? @bgavrilMS Can this issue be reopened, or should we log a new issue?

from microsoft-authentication-extensions-for-dotnet.

bgavrilMS avatar bgavrilMS commented on August 25, 2024

What is the exact error you are getting? Is it a compilation error? Can you build from the command line?

To me this a tooling error, because all of our code is (logically) like this:

if (IsWindws())
{
   PInvoke_Into_Windows_Api();
}
If (IsMacOs())
{
  PInvoke_Into_Mac_Api();
}

from microsoft-authentication-extensions-for-dotnet.

norton287 avatar norton287 commented on August 25, 2024

Here is the last output from the build. I attached a sample that demonstrates this to the first post. I think you'll get better info from it.

Here is the last output from VS 2022 Mac Preview that I get talking about the linker and not finding System framework.

MTOUCH : warning MT5215: References to ‘System’ might require additional -framework=XXX or -lXXX instructions to the native linker
MTOUCH : warning MT5215: References to ‘System.Net.Security’ might require additional -framework=XXX or -lXXX instructions to the native linker
MTOUCH : warning MT5215: References to ‘libsecret-1.so’ might require additional -framework=XXX or -lXXX instructions to the native linker
MTOUCH : warning MT5215: References to ‘kernel32’ might require additional -framework=XXX or -lXXX instructions to the native linker
MTOUCH : warning MT5215: References to ‘ntdll’ might require additional -framework=XXX or -lXXX instructions to the native linker
MTOUCH : warning MT5215: References to ‘advapi32’ might require additional -framework=XXX or -lXXX instructions to the native linker
MTOUCH : warning MT5215: References to ‘libsecret-1.so’ might require additional -framework=XXX or -lXXX instructions to the native linker
error MT5209 : Native linking error : framework not found System
MTOUCH : error MT5202: Native linking failed. Please review the build log.
clang : error : linker command failed with exit code 1 (use -v to see invocation)
20 Warning(s)
3 Error(s)

Process exited with code 1, command:
error MT5209 : Native linking error : framework not found System

MTOUCH : warning MT5215: References to 'System' might require additional -framework=XXX or -lXXX instructions to the native linker

MTOUCH : warning MT5215: References to 'System.Net.Security' might require additional -framework=XXX or -lXXX instructions to the native linker

MTOUCH : warning MT5215: References to 'libsecret-1.so' might require additional -framework=XXX or -lXXX instructions to the native linker

MTOUCH : warning MT5215: References to 'kernel32' might require additional -framework=XXX or -lXXX instructions to the native linker

MTOUCH : warning MT5215: References to 'ntdll' might require additional -framework=XXX or -lXXX instructions to the native linker

MTOUCH : warning MT5215: References to 'advapi32' might require additional -framework=XXX or -lXXX instructions to the native linker

MTOUCH : warning MT5215: References to 'libsecret-1.so' might require additional -framework=XXX or -lXXX instructions to the native linker

MTOUCH : error MT5202: Native linking failed. Please review the build log.

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -framework CoreFoundation -framework Security -framework CFNetwork -framework SafariServices -framework QuickLook -framework LocalAuthentication -framework ContactsUI -framework SystemConfiguration -framework Photos -framework OpenGLES -framework MobileCoreServices -framework MessageUI -framework MediaPlayer -framework ImageIO -framework GLKit -framework WebKit -framework Foundation -framework CoreVideo -framework CoreText -framework CoreTelephony -framework CoreSpotlight -framework CoreMedia -framework CoreLocation -framework CoreGraphics -framework QuartzCore -framework Contacts -framework AuthenticationServices -framework UIKit -framework AVKit -framework AVFoundation -framework GSS -weak_framework System /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/registrar.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/main.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/SimpleBlobManager.iOS.exe.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/mscorlib.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Xamarin.Forms.Core.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/System.Core.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/System.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Mono.Security.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/System.Xml.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/System.Numerics.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/System.Data.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/System.Drawing.Common.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/System.Net.Http.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Xamarin.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/System.Runtime.Serialization.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/System.ServiceModel.Internals.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/System.Web.Services.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/System.Xml.Linq.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Xamarin.Forms.Platform.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Xamarin.Forms.Platform.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/SimpleBlobManager.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Xamarin.Forms.Xaml.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Microsoft.Azure.Management.Storage.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Microsoft.Rest.ClientRuntime.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Newtonsoft.Json.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Microsoft.Rest.ClientRuntime.Azure.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Azure.Storage.Blobs.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Azure.Core.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Microsoft.Bcl.AsyncInterfaces.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/System.Text.Json.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/System.Text.Encodings.Web.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/System.Runtime.CompilerServices.Unsafe.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/System.Memory.Data.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/System.Diagnostics.DiagnosticSource.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Azure.Storage.Common.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/System.IO.Hashing.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Plugin.Fingerprint.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.Buttons.XForms.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.Core.XForms.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.Licensing.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Xamarin.Essentials.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/OpenTK-1.0.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfBusyIndicator.XForms.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfComboBox.XForms.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfListView.XForms.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.GridCommon.Portable.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.DataSource.Portable.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Microsoft.CSharp.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfNumericTextBox.XForms.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Azure.Identity.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Microsoft.Identity.Client.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Microsoft.Identity.Client.Extensions.Msal.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/System.Security.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Azure.Storage.Blobs.Batch.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Microsoft.IdentityModel.Clients.ActiveDirectory.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.Compression.Portable.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.XlsIO.Portable.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Xamarin.CommunityToolkit.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Microsoft.AppCenter.Analytics.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Microsoft.AppCenter.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Microsoft.AppCenter.iOS.Bindings.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Microsoft.AppCenter.Analytics.iOS.Bindings.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Microsoft.AppCenter.Crashes.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Microsoft.AppCenter.Crashes.iOS.Bindings.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfComboBox.XForms.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.Core.XForms.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfBusyIndicator.XForms.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfBusyIndicator.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfPicker.XForms.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfPicker.XForms.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfPicker.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfListView.XForms.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.Expander.XForms.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.Expander.XForms.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfRangeSlider.XForms.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfRangeSlider.XForms.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfRangeSlider.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfPopupLayout.XForms.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfPopupLayout.XForms.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.Buttons.XForms.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfBadgeView.XForms.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfBadgeView.XForms.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfChart.XForms.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfChart.XForms.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfPullToRefresh.XForms.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfPullToRefresh.XForms.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfNumericTextBox.XForms.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/Syncfusion.SfNumericTextBox.iOS.dll.o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/AppCenter.a /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/AppCenterAnalytics.a /Library/Frameworks/Xamarin.iOS.framework/Versions/15.10.0.1/SDKs/MonoTouch.iphoneos.sdk/lib/libmonosgen-2.0.a /Library/Frameworks/Xamarin.iOS.framework/Versions/15.10.0.1/SDKs/MonoTouch.iphoneos.sdk/lib/libxamarin.a /Library/Frameworks/Xamarin.iOS.framework/Versions/15.10.0.1/SDKs/MonoTouch.iphoneos.sdk/lib/libmono-native-unified.a -force_load /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/AppCenterCrashes.a -force_load /Library/Frameworks/Xamarin.iOS.framework/Versions/15.10.0.1/SDKs/MonoTouch.iphoneos.sdk/lib/libapp.a -lsqlite3 -lc++ -Wl,-pie -arch arm64 -miphoneos-version-min=14.3 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.5.sdk -lz -liconv -lz -o /Users/jnorton/Documents/GitHub/SimpleBlobManager/SimpleBlobManager/SimpleBlobManager.iOS/obj/iPhone/Release/mtouch-cache/arm64/SimpleBlobManager.iOS -u _xamarin_log -u _xamarin_release_managed_ref -u _xamarin_set_gchandle_with_flags_safe -u _UIApplicationMain -u _xamarin_find_protocol_wrapper_type -u _xamarin_release_block_on_main_thread -u _xamarin_get_block_descriptor -u _xamarin_IntPtr_objc_msgSend_IntPtr_exception -u _xamarin_IntPtr_objc_msgSendSuper_IntPtr_exception
ld: framework not found System
clang : error : linker command failed with exit code 1 (use -v to see invocation)
Done building target “_CompileToNative” in project “SimpleBlobManager.iOS.csproj” – FAILED.

Done building project “SimpleBlobManager.iOS.csproj” – FAILED

from microsoft-authentication-extensions-for-dotnet.

bgavrilMS avatar bgavrilMS commented on August 25, 2024

@norton287 - do you get the same when you build via the command line, i.e. dotnet build or msbuild ?

And what is the target framework of your project ?

from microsoft-authentication-extensions-for-dotnet.

norton287 avatar norton287 commented on August 25, 2024

same from the command line. it's xamarin.forms so netstandard 2.0

from microsoft-authentication-extensions-for-dotnet.

bgavrilMS avatar bgavrilMS commented on August 25, 2024

@SameerK-MSFT - can you please take a look at this? This would block development on MacOS when app is using Azure SDK. The error seems wrong and does not seem to appear on Windows.

@norton287 - we'll need to contact .NET folks / Xamarin folks for this. This works fine on Windows, so this seems to be a bad warning.

from microsoft-authentication-extensions-for-dotnet.

norton287 avatar norton287 commented on August 25, 2024

from microsoft-authentication-extensions-for-dotnet.

bgavrilMS avatar bgavrilMS commented on August 25, 2024

Was thinking about this some more, here's what I think happens:

  • AzureIdentity is built for netstandard2.0
  • AzureIdentity references Microsoft.Identity.Client.Extensions.Msal which is built for netstandrd 2.0 as well

NetStandard means the library is compatible with any target framework which uses MSAL, but this is not in fact the case for mobile targets. Microsoft.Identity.Client.Extensions.Msal only works on desktop OS - Windows, Mac, Linux and it defines some encryption at rest functionality. It is in fact not needed on mobile..

I am actually not sure how to mark Microsoft.Identity.Client.Extensions.Msal as "do not use" on mobile targets...

But I'm pretty sure that Azure.Identity is not meant to be used from mobile targets - I doubt that there are docs around it. Identity libraries are very much tied to the OS features, because we need to pop-up webviews and to perform encryption at rest.

My recommendation here to unblock you is for you to use Microsoft.Identity.Client library directly. It's a bit lower level that Azure.Identity, but we do have samples for Xamarin: https://github.com/Azure-Samples/active-directory-xamarin-native-v2

from microsoft-authentication-extensions-for-dotnet.

norton287 avatar norton287 commented on August 25, 2024

from microsoft-authentication-extensions-for-dotnet.

bgavrilMS avatar bgavrilMS commented on August 25, 2024
  1. ClientSecretCredential should not be used on a mobile device. You cannot securily store a secret / cert on a mobile device or on a desktop app. ClientSecretCredential is meant for web sites and web APIs, where you can secure the backend. Identity SDK (which Azure.Identity builds on) does not even enable this flow on mobile.

  2. InteractiveBrowserCredential is the recommended path indeed at a logical level, but I am not convinced that Azure.identity was ever tested on mobile and I doubt it works. Microsoft.identity.Client is a lower level SDK, so our API is slightly more complex, but we do have samples for Xamarin: https://github.com/Azure-Samples/active-directory-xamarin-native-v2

As far as I know this is the only SDK for Xamarin mobile apps.

from microsoft-authentication-extensions-for-dotnet.

norton287 avatar norton287 commented on August 25, 2024

Well I have been using and testing both the ClientSecretCredential and the InteractiveBrowserCredential on Android and UWP for like a couple of months now. I really want to use InteractiveBrowserCredential since it requires less credentials and secures the app better since it is a storage app. And storage will only take a Credential, so InteractiveBrowserCredential fits the bill perfectly.

So if you can fix the iOS issue I can stop running parallel code In my production app and move everything together again and save the pain of having to maintain a fork just for iOS.

from microsoft-authentication-extensions-for-dotnet.

bgavrilMS avatar bgavrilMS commented on August 25, 2024

I'm sorry, I don't know how to fix this, but am happy to be educated. Maybe the issue is on Xamarin SDK or the analyzer which breaks the build? (obviously the same warning should exist on Android, but as you say - it seems to be ok).

from microsoft-authentication-extensions-for-dotnet.

norton287 avatar norton287 commented on August 25, 2024

The only one with this issue is iOS and Azure.Identity broke it down to this like I quoted in the first post.

Thank you for your feedback!
This happens because:
During the build, we look at all the P/Invokes and figure out which libraries the app needs to link with.
The Microsoft.Identity.Client.Extensions.Msal.dll assembly has a P/Invoke to the dlopen function from the library /System/Library/Frameworks/System.framework/System.
/System/Library/Frameworks/System.framework/System does not exist on iOS, and thus the native linker complains that it can't link with that library.
The Microsoft.Identity.Client.Extensions.Msal.dll assembly comes from this nuget: https://www.nuget.org/packages/Microsoft.Identity.Client.Extensions.Msal/
Looking at their website, the offending code comes from here:

private const string LibSystemLib = "/System/Library/Frameworks/System.framework/System";
[DllImport(LibSystemLib, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr dlopen(string name, int flags);
[DllImport(LibSystemLib, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr dlsym(IntPtr handle, string symbol);

My suggestion would be to file an issue here: https://github.com/AzureAD/microsoft-authentication-extensions-for-dotnet/issues/new.
Happy coding!

<

So, I'm not sure the others will even touch it with that in the air.

from microsoft-authentication-extensions-for-dotnet.

norton287 avatar norton287 commented on August 25, 2024

Try building my sample solution with your expertise and see where I need to go? I mean you can tell more than I can.

from microsoft-authentication-extensions-for-dotnet.

bgavrilMS avatar bgavrilMS commented on August 25, 2024

Thanks for the suggestion @rolfbjarne - the integration tests seem to pass, so I'm happy to take this. We'll probably do a release by end of week / mid next week @norton287

from microsoft-authentication-extensions-for-dotnet.

norton287 avatar norton287 commented on August 25, 2024

@rolfbjarne @bgavrilMS Thanks a lot guys really appreciate it very very very very very much!

from microsoft-authentication-extensions-for-dotnet.

bgavrilMS avatar bgavrilMS commented on August 25, 2024

@DRAirey1 - can you please open a bug on the MSAL repo for this?
@breenbob - I think a new issue should be opened on the MSAL repo - https://github.com/AzureAD/microsoft-authentication-library-for-dotnet

from microsoft-authentication-extensions-for-dotnet.

DRAirey1 avatar DRAirey1 commented on August 25, 2024

It looks like someone already fixed this. If you install the pre-release of the MSAL package, the problem goes away:

    <PackageReference Include="Microsoft.Identity.Client" Version="4.46.0-preview2" />
    <PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="2.22.0" />

Just push this into production and it should get rid of the problem.

from microsoft-authentication-extensions-for-dotnet.

breenbob avatar breenbob commented on August 25, 2024

@DRAirey1 @bgavrilMS have not tried 4.46.0-preview2 because there are 4 releases since that release all with same or higher version number, so assumed it was an outdated preview. Targeting the very latest 4.46.2 packages does not fix the issue, so I guess whatever fix was implemented has regressed somehow? Will check 4.46.0-preview2 anyway though just to see if it leaves us with a working version, thanks.

from microsoft-authentication-extensions-for-dotnet.

bgavrilMS avatar bgavrilMS commented on August 25, 2024

Only MSAL 4.47.0 and 4.46.0-preview2 have MAUI support. You can check this on nuget by looking at the Frameworks tab. We will be shipping MAUI support in each version from now on.

from microsoft-authentication-extensions-for-dotnet.

DRAirey1 avatar DRAirey1 commented on August 25, 2024

You can check this on nuget by looking at the Frameworks tab

Could you help us out please. It would be useful, in the future, to know what we're getting when we install these packages. How do I determine that this release supports MAUI from this display:

MSAL Support

from microsoft-authentication-extensions-for-dotnet.

bgavrilMS avatar bgavrilMS commented on August 25, 2024

@DRAirey1 - MSAL does 3 things which are highly tied to a specific platform:

  • pops up browsers (embedded browsers or system browsers)
  • talks to brokers (Authenticator on mobile / WAM on Windows, tbd on Mac / Linux)
  • stores tokens in an encrypted location (KeyChain on ios etc.)

Each of these have different implementation on Android, iOS, Windows, Mac and Linux.

net6-android / net6-ios / net6-windows are typical for MAUI and MSAL will keep releasing them with each version from now on. Please have a look at the sample for details on how to integrate MSAL - https://github.com/Azure-Samples/active-directory-xamarin-native-v2/tree/main/MAUI

from microsoft-authentication-extensions-for-dotnet.

norton287 avatar norton287 commented on August 25, 2024

from microsoft-authentication-extensions-for-dotnet.

norton287 avatar norton287 commented on August 25, 2024

from microsoft-authentication-extensions-for-dotnet.

bgavrilMS avatar bgavrilMS commented on August 25, 2024

I'm sorry if you have a bad experience with the libs or if you feel insulted @norton287 . It was not my intention. Yes you can use InteractiveBrowserCredential on UWP and iOS, I'm just saying that Azure SDK do not test those scenarios afaik

The bug mentioned in this thread has been fixed as per recommendation from Xamarin folks. For any other bugs, please open new issues or comment on existing ones.

from microsoft-authentication-extensions-for-dotnet.

norton287 avatar norton287 commented on August 25, 2024

from microsoft-authentication-extensions-for-dotnet.

norton287 avatar norton287 commented on August 25, 2024

from microsoft-authentication-extensions-for-dotnet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.