I am trying to update MSAL 4.4 to MSAL 4.5.1 to fix an authentication issue on IOS : MSAL .NET on iOS 13 does not support system browser
fixed in 4.5 release of MSAL. Issue now, is that I cannot update MSAL to 4.5
Error Message - when trying to update MSAL library:
The package 'Microsoft.Identity.Client' tried to add a framework reference to 'System.Drawing.Common.dll' which was not found in the GAC. This is possibly a bug in the package. Please contact the package owners for assistance.
That is an issue w/Visual Studio when VS tries to upgrade the dependency. If you manually update to MSAL4.5.1 (by editing the csproj and the packages) it will work. The workaround is to move away from packages.config to PackageReference. Similar issue here.
Related
I just update all my nugget packages to Xamarinforms 5.0.0.2012, Xamarin Maps 5.0.0.2012, Xamarin.Forms.Visual.Material 5.0.0.2012, Xamarin Essentials 1.61 and prism 8.0.0.1909,.. all my packages and even my VS to the lastet version 16.9.3
Now when I run (f5) my android project on my samsung note 9,by usb, in the splash screen I got this error:
Java.Lang.RuntimeException Mensaje = Unable to get provider android.support.v4.content.FileProvider: java.lang.ClassNotFoundException: Didn't find class "android.support.v4.content.FileProvider" on path: DexPathList[[zip file "/data/app/com.XXX.yyyyyy-xjKonazvnj9Dk6-OE4QIZQ==/base.apk"],nativeLibraryDirectories=[/data/app/com.XXX.yyyyyy-xjKonazvnj9Dk6-OE4QIZQ==/lib/arm64, /data/app/com.XXX.yyyyyy-xjKonazvnj9Dk6-OE4QIZQ==/base.apk!/lib/arm64-v8a, /system/lib64, /system/product/lib64]]
and then the app hungs and got closed
thanks
When you upgrade your project from Xamarin.Forms 4.0 to 5.0 you have to migrate your Android project to AndroidX as well, which means that all Android.Support libraries changed to AndroidX libraries.
The crash error you posted shows that your project still have references to old Android.Support namespaces.
Microsoft provides some articles about how to migrate your app.
It's pretty straghtfoward and most of the process is done automatically for you:
AndroidX migration in Xamarin.Forms
How do I migrate my app to Xamarin.Forms 5.0?
Well thaks for the guide,...
The solution was easy
Open the AndroidManifest.xml
Search for android.support.v4.content.FileProvider
Replace in every place for androidx.core.content.FileProvider
Save and rebuild, that's all
Hope this help to someone
I needed to rebuild my fairly ancient Xamarin Forms app from scratch and in the process arrived at a situation where I had a new working iOS app but had needed to delete the draft Android app and start it again. So as a next step I added a vanilla Android app project out of the box and immediately what I saw was that (in MainActivity) Android.Support, Android.Views and Android.Content were undefined with wiggy red lines beneath -- for example in a reference to Android.Support.V7.Widget.Toolbar.
Trying to solve the problem, I set each of Target Framework, Minimum Android Version and Target Android Version to Android 9.0 Pie (API Level 28). In SDK Manager I checked that Android SDK Location and Java SDK Location were 'Found' and that Android SDK Platform 28 was installed.
The following NuGets came installed along with the project, I deleted them and reinstalled them (removing bin/obj folders in between): Xamarin.Android.Support.Core.Utils, Xamarin.Android.Support.CustomTabs and Xamarin.Android.Support.Design.
I tried installing NuGets Xamarin.Android.Support.v7.*. And I added the Xamarin.Forms NuGet. I tried adding 'use' declarations.
None of this helped.
For comparison I separately installed a blank Android app solution-- it worked perfectly out of the box.
Android is pretty new to me - would be grateful for suggestions on fixing this.
The app has a .NET Standard 2.0 project, an iOS project, the (vanilla) Android project (all three with Xamarin Forms), and a .NET Standard 2.0 library project.
I'm using Visual Studio for Mac V8.5.4 (stable) on MacOS 10.15.3.
I noticed that the content of MainActivity.cs is quite different, depending whether the Android project is created separately or as part of a Xamarin Forms solution. Also the provided NuGets are different. So perhaps what I was trying to do, adding an Android app to an existing XF solution, is simply not allowed.
To fix the problem, I created an empty Xamarin Forms solution with Android and iOS projects, added a further empty library project, then in Finder replaced the content of all the project folders, except the Android one, with the content of the corresponding folders in my working solution (the one with a working iOS app).
Migrating to AndroidX is a good idea though.
I don't know if this will help, but you should migrate to AndroidX as soon as possible, nevertheless. Xamarin has migrated to them, starting from Forms 4.5
Here is some more information about the libraries - Introducing AndroidX for Xamarin
There is a special NuGet package for the migration - Xamarin.AndroidX.Migration. Also available is a built-in functionality in Visual Studio - here
What I can suggest is you try to migrate to AndroidX libraries, since the old support libraries won't be supported from now on, and you will surely encounter some issues if not like this one, then something else will pop-up in the future.
We're using Azure DevOps to build our Xamarin Forms mobile app. This has been working without any problems for weeks now. For some reason I am now getting the following error when we build the iOS project:
MT2002: Failed to resolve "AuthenticationServices.ASWebAuthenticationSession" reference from "Xamarin.iOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065"
The Android and shared project are working perfectly. This is only a problem with the iOS project.
I haven't changed or updated Xamarin.iOS in any way whatsoever, so cannot understand why I am now getting this error.
I am using Visual Studio 2017 15.8.1 if that makes any difference.
I suspect the error first occurred after adding a reference to Microsoft.Identity.Client preview in the shared project. Is there an issue with this reference and Xamarin.iOS on Azure DevOps?
I had the same issues, and had to downgrade to version 2.1.0-preview.
2.2.0, 2.2.1 and 2.3.0 give the same error.
I had the same issue on Azure DevOps. I have updated mono version from 5.10 to 5.18.1 and build was succeeded.
I had the exact same issue. I downgraded my "Microsoft.Identity.Client" package from 2.3.1 to 2.1.0. My Xamarin.forms project version had to be 3.0.0 for this to work.
Hope this helps.
I have the same error with microsoft.identitymodel.clients.activedirectory 4.3.0 as well.
That package is also able to save tokens in MSAL-format so perhaps it is also using AuthenticationServices.ASWebAuthenticationSession.
AppCenter won't build at all since it's outdated and Azure DevOps fails with this.
You need to have Visual Studio 2017, at least 15.8.7, which has support for XCode10, and XCode10 installed on the Mac to get the classes needed to run ASWebAuthenticationSession (ex. AuthenticationServices). If you still have issues, please open an issue on the MSAL repo.
I am trying to install Microsoft.AspNetCore.SignalR.Client on Xamarin forms (on .net standard 2.0) and run the android app. I keep getting the error
Could not load assembly 'System.Threading.Tasks.Extensions' during startup registration
I have tried installing System.Threading.Tasks.Extensions nuget's latest prerelease, I still get the same error. I did not find any one else with this issue online.
You need Visual Studio 2017 Update 15.8 + Microsoft.AspNetCore.SignalR.Client Package with at least Version 1.0.1
ASP.NET Core 2.1.1 contains fixes to resolve blocking issues when
using the SignalR Client from Xamarin. However, these fixes also
require an updated build of Xamarin.iOS and Xamarin.Android, as
well as some additional dependencies.
In order to use the SignalR Client in Xamarin applications you will
need to:
Upgrade Microsoft.AspNetCore.SignalR.Client to 1.0.1.
Upgrade Xamarin to the appropriate version:
Xamarin.Android 8.4.0.1
VS2017 Update 15.8 comes with Xamarin.Android 9.0.x tools which contains the fix for the issue.
I have a Web API that has version 5.1.2 of the Microsoft.AspNet.WebApi.Client package installed.
I am trying to access the API from an ASP.NET MVC application, which also has the same version of the package installed.
However, in the Global.asax of the Web API project, on the line below, I get the following exception:
WebApiConfig.Register(GlobalConfiguration.Configuration);
Attempt by method 'System.Web.Http.HttpConfiguration..ctor(System.Web.Http.HttpRouteCollection)' to access method 'System.Web.Http.HttpConfiguration.DefaultFormatters()' failed.
I found that this error occurs when you have multiple projects pointing to different .net versions.
For example if you have a Web API project targeting .net 4.5 and a unit test project targeting .net 4.5.3 it seems that default settings mean nuget may silently update the .net 4.5 project references to incompatible versions one day when you open visual studio and cause your Web API project to fail with the recondite 'Attempt by method 'HttpConfiguration..ctor(HttpRouteCollection)' to access method 'HttpConfiguration.DefaultFormatters()' failed' error.
To avoid the error drop the higher .net version back on the new project to match the Web API project - for this example right click the unit test project, click properties, then change the target framework to .net framework 4.5.
In my case it was a discrepancy between versions of Microsoft.AspNet.WebApi.Client and Microsoft.AspNet.WebApi.Core, I tried updating both to the same version and it worked.
In my case, the issue was solved when I installed the Microsoft.AspNet.WebApi.Core as well. So three libraries should present and be in harmony (uninstall / install) Microsoft.AspNet.WebApi.Client, Microsoft.AspNet.WebApi.Core and Newtonsoft.json
same for the above answers in my case also it is working good after updating or reinstalling packages
Microsoft.AspNet.WebApi.Client
Microsoft.AspNet.WebApi.Core