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

UWP: System.TypeLoadException: 'Could not load type 'Microsoft.Graph.AuthenticateRequestAsyncDelegate' from assembly 'Microsoft.Graph.Core' #2800

Closed
kinex opened this issue Jan 22, 2025 · 1 comment

Comments

@kinex
Copy link

kinex commented Jan 22, 2025

I upgraded my UWP app from Graph 4.54.0 to 5.68.0. After the upgrade this code stopped working:

public async Task SignInAsync(string clientId, string[] scopes)
{
    var webAccountProviderConfig =
        new WebAccountProviderConfig(WebAccountProviderType.Local, clientId);
    ProviderManager.Instance.GlobalProvider =
        new WindowsProvider(scopes, webAccountProviderConfig, null, true, CoreApplication.MainView.CoreWindow.DispatcherQueue);

    ProviderManager.Instance.ProviderStateChanged += OnProviderStateChanged;

    await ProviderManager.Instance.GlobalProvider.SignInAsync();
}

private void OnProviderStateChanged(object sender, ProviderStateChangedEventArgs e)
{
    if (e.NewState == ProviderState.SignedIn)
    {
        this.client = ProviderManager.Instance.GlobalProvider.GetClient(); // <== this throws the exception
    }
    else if (e.NewState == ProviderState.SignedOut)
    {
        this.client = null;
    }
}

Exception:

System.TypeLoadException
  HResult=0x80131522
  Message=Could not load type 'Microsoft.Graph.AuthenticateRequestAsyncDelegate' from assembly 'Microsoft.Graph.Core, Version=3.2.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
  Source=CommunityToolkit.Graph
  StackTrace:
   at CommunityToolkit.Graph.Extensions.ProviderExtensions.GetClient(IProvider provider)


@kinex
Copy link
Author

kinex commented Jan 22, 2025

I guess this is CommunityToolkit.Graph issue after all.

@kinex kinex closed this as completed Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant