Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not load file or assembly 'System.IdentityModel.Tokens.Jwt, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' after upgrading Azure Function's nuget packages to 3.0.4 or 3.0.5 #5756

Closed
Arash-Sabet opened this issue Mar 5, 2020 · 10 comments
Assignees

Comments

@Arash-Sabet
Copy link

We have had an Azure Function V3 that has a reference to another C# project in a VS 2019 solution. There are some extension methods in the other C# project using System.IdentityModel.Tokens.Jwt Version=5.6.0.0 assembly to perform token validation. The Azure Function has been working fine by using those extension methods to validate token. The following code snippet shows the nuget packages:

    <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.SignalRService" Version="1.0.2" />
    <PackageReference Include="Microsoft.Azure.EventGrid" Version="3.2.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventGrid" Version="2.1.0" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.3" />

We upgraded the nuget packages in the azure function according to the following list and started receiving the exception reflected the title of this ticket. What's the solution or workaround to solve this problem?

    <PackageReference Include="Microsoft.Azure.Functions.Extensions" Version="1.0.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.SignalRService" Version="1.0.2" />
    <PackageReference Include="Microsoft.Azure.EventGrid" Version="3.2.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.EventGrid" Version="2.1.0" />
    <PackageReference Include="Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator" Version="1.1.4" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.4" />

For now, we had to downgrade the packages again to be able to move forward.

/cc @jeffhollan @anthonychu

@Arash-Sabet Arash-Sabet changed the title Receiving System.IdentityModel.Tokens.Jwt, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 exception after upgrading nuget packages Receiving System.IdentityModel.Tokens.Jwt, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 exception after upgrading Azure Function's nuget packages Mar 5, 2020
@Arash-Sabet
Copy link
Author

We upgraded Microsoft.NET.Sdk.Functions to version 3.0.5 and the issue still persists. Unfortunately it has become a roadblock unless we do not upgrade.

/cc @paulbatum

@Arash-Sabet Arash-Sabet changed the title Receiving System.IdentityModel.Tokens.Jwt, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 exception after upgrading Azure Function's nuget packages Receiving System.IdentityModel.Tokens.Jwt, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 exception after upgrading Azure Function's nuget packages to 3.0.4 or 3.0.5 Mar 6, 2020
@Arash-Sabet Arash-Sabet changed the title Receiving System.IdentityModel.Tokens.Jwt, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 exception after upgrading Azure Function's nuget packages to 3.0.4 or 3.0.5 Could not load file or assembly 'System.IdentityModel.Tokens.Jwt, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' after upgrading Azure Function's nuget packages to 3.0.4 or 3.0.5 Mar 6, 2020
@paulbatum paulbatum transferred this issue from Azure/Azure-Functions Mar 6, 2020
@ghost ghost assigned yojagad Mar 6, 2020
@paulbatum paulbatum assigned fabiocav and unassigned yojagad Mar 6, 2020
@paulbatum
Copy link
Member

Thanks for the issue report! Go ahead and stay on 3.0.3 while we investigate.

cc @brettsam @fabiocav

@kuromukira
Copy link

I'm also getting this issue but with Microsoft.IdentityModel.Tokens 5.6.0 nuget package.

@fabiocav
Copy link
Member

@Arash-Sabet @kuromukira we'll take a closer look at this. In the meantime, you can also add the following property to your project (which will allow you to upgrade):

<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>

@AlexPshul
Copy link

Just came here to confirm the issue.
Upgraded to 3.0.5 and getting the same message when starting the functions app locally. Didn't try to publish it yet, though.
Downgrading to 3.0.3 solves it for now. Will wait for an update.

@jkerak
Copy link

jkerak commented Mar 23, 2020

same error and solution worked but i'm using v1.0.34

@tkcecek
Copy link

tkcecek commented Mar 27, 2020

Got into same problem... and worked out that it works with:
Microsoft.NET.Sdk.Functions <= 1.0.31 & System.IdentityModel.Tokens.Jwt <= 6.5.0 (latest)
OR
Microsoft.NET.Sdk.Functions <= 3.0.5 (latest) & System.IdentityModel.Tokens.Jwt <= 5.3.0
so it's your choice which one you need in the latest.
Hope this helps.

@kuromukira
Copy link

kuromukira commented Mar 27, 2020

Hi @TKC-GitHub , thank you for the information.
Have you tried Microsoft.NET.Sdk.Functions <= 3.0.5 (latest) & System.IdentityModel.Tokens.Jwt <= 6.5.0 (latest)?

@tkcecek
Copy link

tkcecek commented Mar 27, 2020

yes and it didn't work

the only way to make it working was to downgrade one of them as per my previous comment

@yojagad
Copy link
Contributor

yojagad commented Apr 23, 2020

If the workaround @fabiocav mentioned worked, I'm going ahead and closing this issue since we're tracking a fix for the same here. #5894

@ghost ghost locked as resolved and limited conversation to collaborators May 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants