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

Microsoft.Identity.Web.GraphServiceClient Version="2.18.1" TypeLoadException #2488

Closed
arabzade opened this issue May 13, 2024 · 2 comments
Closed

Comments

@arabzade
Copy link

arabzade commented May 13, 2024

we use MSAL libraries for authentication and authorization in our service and "Microsoft.Identity.Web.GraphServiceClient" Version="2.18.1" which uses Microsoft Graph v5 to be able to leverage .AddMicrosoftGraph to pass token to downstream graph apis but we are getting TypeLoadException when it tries to call downstream graph api:

The code:
services.AddAuthentication(S2SAuthenticationDefaults.AuthenticationScheme)
.AddMiseWithDefaultAuthentication(_config.RawConfig)
.EnableTokenAcquisitionToCallDownstreamApiAndDataProviderAuthentication(S2SAuthenticationDefaults.AuthenticationScheme)
.AddMicrosoftGraph()
.AddInMemoryTokenCaches();

The exception:

System.TypeLoadException: Could not load type 'Microsoft.Graph.IGraphServiceUsersCollectionPage' from assembly 'Microsoft.Graph, Version=5.31.0.0, Culture=neutral, at ScenarioHealth.Adapters.GraphApi.MicrosoftGraphAdapter.CheckUserEmailAsync(String emailOrAlias)

The packages being used:

"Microsoft.Identity.ServiceEssentials.AspNetCore" Version="1.25.0"
"Microsoft.Identity.ServiceEssentials.TokenAcquisitionIdWeb" Version="1.25.0"
"Microsoft.IdentityModel.S2S" Version="4.6.0"
"Microsoft.Identity.Web.GraphServiceClient" Version="2.18.1"

Is there any mismatch in the packages that are being used? what could cause this error?

@andrueastman
Copy link
Member

Thanks for raising this @arabzade

Any chance you can raise this at the link below to get more context from the owners of the Microsoft.Identity.Web.GraphServiceClient library? It looks like the code is trying to reference Microsoft.Graph.IGraphServiceUsersCollectionPage which is not available in v5 of the SDK.

https://github.com/AzureAD/microsoft-identity-web/issues

Copy link
Contributor

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants