msgraph-sdk-dotnet-core icon indicating copy to clipboard operation
msgraph-sdk-dotnet-core copied to clipboard

Creating new GraphServiceClient in a Blazor WASM project throws an exception

Open jasonjoh opened this issue 5 years ago • 0 comments

Creating a client like so (BlazorAuthProvider is a custom auth provider in the project):

var errClient = new GraphServiceClient(new BlazorAuthProvider(accessor));

Results in the following error:

Unhandled exception rendering component: Property Proxy is not supported.
System.PlatformNotSupportedException: Property Proxy is not supported.
  at System.Net.Http.HttpClientHandler.set_Proxy (System.Net.IWebProxy value) <0x37f1a50 + 0x0000c> in <filename unknown>:0 
  at Microsoft.Graph.GraphClientFactory.GetNativePlatformHttpHandler (System.Net.IWebProxy proxy) <0x37f1120 + 0x00012> in <filename unknown>:0 
  at Microsoft.Graph.HttpProvider..ctor (System.Net.Http.HttpMessageHandler httpMessageHandler, System.Boolean disposeHandler, Microsoft.Graph.ISerializer serializer) <0x37e5098 + 0x00046> in <filename unknown>:0 
  at Microsoft.Graph.HttpProvider..ctor (Microsoft.Graph.ISerializer serializer) <0x37e4e48 + 0x0000a> in <filename unknown>:0 
  at Microsoft.Graph.BaseClient..ctor (System.String baseUrl, Microsoft.Graph.IAuthenticationProvider authenticationProvider, Microsoft.Graph.IHttpProvider httpProvider) <0x37d8b18 + 0x00036> in <filename unknown>:0 
  at Microsoft.Graph.GraphServiceClient..ctor (System.String baseUrl, Microsoft.Graph.IAuthenticationProvider authenticationProvider, Microsoft.Graph.IHttpProvider httpProvider) <0x37d8698 + 0x0000e> in <filename unknown>:0 
  at Microsoft.Graph.GraphServiceClient..ctor (Microsoft.Graph.IAuthenticationProvider authenticationProvider, Microsoft.Graph.IHttpProvider httpProvider) <0x37d85d0 + 0x0000e> in <filename unknown>:0 
  at GraphTutorial.Graph.GraphUserAccountFactory.AddGraphInfoToClaims (Microsoft.AspNetCore.Components.WebAssembly.Authentication.Internal.IAccessTokenProviderAccessor accessor, System.Security.Claims.ClaimsPrincipal claimsPrincipal) [0x0001d] in C:\Source\Repos\msgraph-training-blazor-clientside\demo\GraphTutorial\Graph\GraphUserAccountFactory.cs:68 
  at GraphTutorial.Graph.GraphUserAccountFactory.CreateUserAsync (Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteUserAccount account, Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationUserOptions options) [0x000ee] in C:\Source\Repos\msgraph-training-blazor-clientside\demo\GraphTutorial\Graph\GraphUserAccountFactory.cs:47 
  at System.Threading.Tasks.ValueTask`1[TResult].get_Result () <0x37b4830 + 0x00034> in <filename unknown>:0 
  at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService`3[TRemoteAuthenticationState,TAccount,TProviderOptions].GetAuthenticatedUser () <0x358c980 + 0x00260> in <filename unknown>:0 
  at System.Threading.Tasks.ValueTask`1[TResult].get_Result () <0x37b4830 + 0x00034> in <filename unknown>:0 
  at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService`3[TRemoteAuthenticationState,TAccount,TProviderOptions].GetUser (System.Boolean useCache) <0x35602d0 + 0x00138> in <filename unknown>:0 
  at Microsoft.AspNetCore.Components.WebAssembly.Authentication.RemoteAuthenticationService`3[TRemoteAuthenticationState,TAccount,TProviderOptions].GetAuthenticationStateAsync () <0x3542ee0 + 0x000b6> in <filename unknown>:0 
  at Microsoft.AspNetCore.Components.Authorization.AuthorizeViewCore.OnParametersSetAsync () <0x36fc0d0 + 0x00126> in <filename unknown>:0 
  at Microsoft.AspNetCore.Components.ComponentBase.CallStateHasChangedOnAsyncCompletion (System.Threading.Tasks.Task task) <0x36fccb8 + 0x000da> in <filename unknown>:0 
  at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync () <0x34176b8 + 0x001d8> in <filename unknown>:0 
  at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask (System.Threading.Tasks.Task taskToHandle) <0x37001c0 + 0x000b6> in <filename unknown>:0 

AB#7180

jasonjoh avatar Sep 25 '20 18:09 jasonjoh