question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BUG : System.IdentityModel.Tokens.Jwt 6.12.1 causes exceptions

See original GitHub issue

I have several API projects where this package was installed. I recently updated to 6.12.1 from 6.12.0 through nuget and started getting exceptions.

System.InvalidOperationException: IDX20803: Unable to obtain configuration from: 'System.String'.
 ---> System.MissingMethodException: Method not found: 'Void Microsoft.IdentityModel.Logging.IdentityModelTelemetryUtil.SetTelemetryData(System.Net.Http.HttpRequestMessage)'.
   at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(String address, CancellationToken cancel)
   at Microsoft.IdentityModel.Protocols.OpenIdConnect.OpenIdConnectConfigurationRetriever.GetAsync(String address, IDocumentRetriever retriever, CancellationToken cancel)
   at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
   --- End of inner exception stack trace ---
   at Microsoft.IdentityModel.Protocols.ConfigurationManager`1.GetConfigurationAsync(CancellationToken cancel)
   at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
   at Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler.HandleAuthenticateAsync()
   at Microsoft.AspNetCore.Authentication.AuthenticationHandler`1.AuthenticateAsync()
   at Microsoft.AspNetCore.Authentication.AuthenticationService.AuthenticateAsync(HttpContext context, String scheme)
   at Microsoft.AspNetCore.Authorization.Policy.PolicyEvaluator.AuthenticateAsync(AuthorizationPolicy policy, HttpContext context)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Serilog.AspNetCore.RequestLoggingMiddleware.Invoke(HttpContext httpContext)

Oddly, I found that I actually no longer need this package at all, and have removed it, thus solving my issue. But I’m wondering if 6.12.1 has some dependency problem when installed.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:34 (16 by maintainers)

github_iconTop GitHub Comments

2reactions
ErikPilsits-RJWcommented, Aug 13, 2021

Confirmed. If I take another explicit dependency on

<PackageReference Include="Microsoft.IdentityModel.Protocols" Version="6.12.1" />

the exception is resolved.

2reactions
BlacKCaT27commented, Aug 13, 2021

In my case, it may have been related to a cached instance of our repository manager on my local machine. Once the bad package was removed from nuget and I invalidated my cache, builds succeeded again.

My repro was to reference a dependency which referenced this package. Beyond that I can’t say unfortunately.

On Fri, Aug 13, 2021 at 6:13 PM henrikm @.***> wrote:

@BlacKCaT27 https://github.com/BlacKCaT27 @ErikPilsits-RJW https://github.com/ErikPilsits-RJW we are not able to reproduce this issue. Did you update all packages to the latest version? Can you please share a list of all your package references and versions to packages named Microsoft.IdentityModel and System.IdentityModel?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/issues/1686#issuecomment-898746112, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABH7TYJ6N75VGUM7BTCGZBDT4WKIPANCNFSM5CEFXQLA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error loading System.IdentityModel.Tokens.Jwt dll in ...
I ran into the exactly same troubles. The reason is, that the latest versions of System.IdentityModel.Tokens.Jwt and System.IdentityModel.
Read more >
Could not load file or assembly System.IdentityModel. ...
The error occurs when upgrading Microsoft.NET.Sdk.Functions to version 3.0.4 or 5 from 3.0.3 Full error: Could not load file or assembly ...
Read more >
SecurityTokenValidationException Class
Initializes a new instance of the SecurityTokenValidationException class using the specified error message. SecurityTokenValidationException(String, Exception).
Read more >
System.IdentityModel.Tokens.Jwt 6.32.1
Includes types that provide support for creating, serializing and validating JSON Web Tokens.
Read more >
SecurityTokenExpiredException reported in Azure #10625
That error is thrown by System.IdentityModel.Tokens.Jwt.ValidateToken method, (see:https://docs.microsoft.com/en-us/dotnet/api/system.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found