using signalr client with xamarin forms - xamarin.forms

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.

Related

Cannot update msal to v4.51 on Xamarin forms ios

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.

Error: Failed to resolve "AuthenticationServices.ASWebAuthenticationSession" reference from "Xamarin.iOS

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.

Unable to install Nuget package in my Xamarin Cross Platform Application

I am developing a xamarin cross platform that is composed of following projects
1)Portable
2)IOS
3)Android
4)UWP
I am facing an issue while installing NuGet package for the xamarin portable project. Actually the NuGet that i am trying to install is targeted on .net Framework version 4.5.2. So we need the .net Version 4.5.2 or higher in our application in order to install this library. However when i try to change target framework version in my project properties to 4.6 then also i am facing the compatibility error that given package is not compatible with .net 4.5.
So what is the correct way that to set the .Net framework version in the project so that i can install it any project.
I have also referred to this doc by Microsoft
https://learn.microsoft.com/en-gb/dotnet/standard/net-standard#comparison-to-portable-class-libraries
that shows compatibility matrix.
I think it is related to .net standard 2.0. use these links
https://xamarinhelp.com/upgrade-pcl-net-standard-class-library/
https://blogs.msdn.microsoft.com/dotnet/2017/08/14/announcing-net-standard-2-0/

Xamarin forms failing ti install NotificationHub Nuget in UWP project

Trying this : https://learn.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-xamarin-forms-get-started-push, using VS 2017 portable Xamarin Forms project. Except UWP all other projects including IOS , Android and Portable library are getting installed with the Notificaiton nuget package. In UWP its always failing with the below error message. Thanks for your help.
Package Microsoft.Azure.NotificationHubs 1.0.9 is not compatible with uap10.0.10240 (UAP,Version=v10.0.10240) / win10-x86-aot. Package Microsoft.Azure.NotificationHubs 1.0.9 supports: net45 (.NETFramework,Version=v4.5)
As of July 2016 Notification Hubs SDK is not available for UWP. The product team is aware of it and working on providing it.
At the moment, there are one way to workaround it:
Use WindowsAzure.Messaging.Managed Nuget package as described in Getting started with Notification Hubs for Windows Universal Platform Apps
Certain Hubs SDKs are open sourced. But, unfortunately, not Windows ones at the moment.

Attempt by method 'HttpConfiguration..ctor(HttpRouteCollection)' to access method 'HttpConfiguration.DefaultFormatters()' failed

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

Resources