IdentityModel: JsonSerializer error in Visual Studio 2022 (preview)
Hi all, When calling GetDiscoveryDocumentAsync in my Xamarin.Forms project, inside Vs2022 i get this error
_discoveryResponse = await _tokenClient.GetDiscoveryDocumentAsync(new DiscoveryDocumentRequest
{
Address = App.Current.AppSettings.AuthEndpointUrl,
});
Error connecting to endpoint Error connecting to https://{myidentityserverurl}/.well-known/openid-configuration/jwks. The type initializer for ‘System.Text.Json.JsonSerializer’ threw an exception.
This not happen when using VS 2019 or from device (without debugger attached)
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 15 (4 by maintainers)
Hi I encountered this problem with a Xamarin.Forms app and found a solution here.
I have a working example in the WebAuthenticatorDemo-OIDCClient folder.
I used the nuget package references:- IdentityModel.OidcClient v5.0.0 System.Text.Json v6.0.2
Add this to the iOS project file:-
Set the project (Xamarin.Forms in this case) to use .Net standard 2.1
Hope this helps
@amellini I used your text reporting the problem and registered it in the visual studio community. Follow the link below. If everyone reinforces the request, it would help.
https://developercommunity.visualstudio.com/search?space=61&q=System.Text.Json.JsonSerializer+error+visual+studio+2022
@leastprivilege does it happen to you (if you have VS2022)?