IdentityModel / IdentityModel.OidcClient.Samples

Apache License 2.0
296 stars 164 forks source link

The type initializer for 'System.Text.Json.JsonSerializer' threw an exception #108

Open dhruvgohiloo7 opened 3 years ago

dhruvgohiloo7 commented 3 years ago

After updating IdentityModel to 5.1.0 and IdentityModel.OidcClient to 4.0.0, I started getting below exception (only in iOS)

Error loading discovery document: Error connecting to https://auth.example.org/.well-known/openid-configuration/jwks. The type initializer for 'System.Text.Json.JsonSerializer' threw an exception..

leastprivilege commented 3 years ago

see here:

https://github.com/IdentityModel/IdentityModel.OidcClient/issues/292

dhruvgohiloo7 commented 3 years ago

@leastprivilege I went through the link you provided and tried migrating nuget management format to PackageReference but after migrating to PackageReference, I started getting lots of other errors.

leastprivilege commented 3 years ago

Well - yes - it sucks ;)

If you read through the thread you can see this is a Microsoft package mismatch issue - I am surprised it has not been fixed yet.

I fixed this sample:

https://github.com/IdentityModel/IdentityModel.OidcClient.Samples/blob/main/iOS_AuthenticationServices/iOS11Client/iOS11Client.csproj

dhruvgohiloo7 commented 3 years ago

@leastprivilege I have started getting xamarin package issues so I have downgraded the identitymodel version for now. Will this issue resolved in the next identitymodel release or I must have to migrate to PackageReference for iOS?

leastprivilege commented 3 years ago

It is not an IdentityModel issue. It's a Microsoft issue as you can see from the referenced thread. It's out of my control.