OneDriveService尝试登录NullReferenceException [英] OneDriveService trying log in NullReferenceException

查看:69
本文介绍了OneDriveService尝试登录NullReferenceException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写的UWP项目包含允许用户上传谷歌驱动器中的文件。我正在使用Microsoft.Toolkit.Services.OneDrive.OneDriveService连接到一个驱动器。

I write UWP project that contains allowing user to upload files in google drive. I'm using Microsoft.Toolkit.Services.OneDrive.OneDriveService for connection to one drive.

var scopes = new string[] {"files.read" };     
OneDriveService.Instance.Initialize("my app code", scopes, null, null);
if(await OneDriveService.Instance.LoginAsync()) //here!
Frame.Navigate(typeof(OneDrivePage));




我是已经输入的登录名和密码,但在此之后抛出了NullReferenceException(对象引用没有设置为对象的实例)。

I'd enetered login and password, but after this NullReferenceException (Object reference not set to an instance of an object) thrown.

我不知道什么可以是原因。我已经用Google搜索了,但仍然不明白。

I have no idea what can be a reason. I've googled about it, but still dont understand.




这是堆栈跟踪:

  在Microsoft.Identity.Client.TokenCache.SaveAccessAndRefreshToken(AuthenticationRequestParameters requestParams,TokenResponse response)

  在Microsoft.Identity.Client.Internal.Requests.RequestBase.SaveTokenResponseToCache()

  在Microsoft.Identity.Client.Internal.Requests.RequestBase.PostTokenRequest()

  在Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync()

  在Microsoft.Identity.Client.PublicClientApplication.AcquireTokenForLoginHintCommonAsync(授权机构,IEnumerable`1范围,IEnumerable`1 extraScopesToConsent,String loginHint,UIBehavior行为,字符串extraQueryParameters,UIParent
parent,ApiIds apiId)

   at Microsoft.Identity.Client.PublicClientApplication.AcquireTokenAsync(IEnumerable`1 scopes,String loginHint,UIParent parent)

  在Microsoft.Toolkit.Services.MicrosoftGraph.MicrosoftGraphAuthenticationHelper.GetUserTokenV2Async(String appClientId,UIParent uiParent,String redirectUri,String loginHint)

  在Microsoft.Toolkit.Services.MicrosoftGraph.MicrosoftGraphAuthenticationHelper.GetUserTokenV2Async(String appClientId,String loginHint)

  在Microsoft.Toolkit.Services.MicrosoftGraph.MicrosoftGraphService.LoginAsync(String loginHint)

  在Microsoft.Toolkit.Services.OneDrive.OneDriveService.LoginAsync()

  在MediaImporter.Views.RootPage.ImportOneDrive_Click(对象发件人,RoutedEventArgs e)

   at Microsoft.Identity.Client.TokenCache.SaveAccessAndRefreshToken(AuthenticationRequestParameters requestParams, TokenResponse response)
   at Microsoft.Identity.Client.Internal.Requests.RequestBase.SaveTokenResponseToCache()
   at Microsoft.Identity.Client.Internal.Requests.RequestBase.PostTokenRequest()
   at Microsoft.Identity.Client.Internal.Requests.RequestBase.RunAsync()
   at Microsoft.Identity.Client.PublicClientApplication.AcquireTokenForLoginHintCommonAsync(Authority authority, IEnumerable`1 scopes, IEnumerable`1 extraScopesToConsent, String loginHint, UIBehavior behavior, String extraQueryParameters, UIParent parent, ApiIds apiId)
   at Microsoft.Identity.Client.PublicClientApplication.AcquireTokenAsync(IEnumerable`1 scopes, String loginHint, UIParent parent)
   at Microsoft.Toolkit.Services.MicrosoftGraph.MicrosoftGraphAuthenticationHelper.GetUserTokenV2Async(String appClientId, UIParent uiParent, String redirectUri, String loginHint)
   at Microsoft.Toolkit.Services.MicrosoftGraph.MicrosoftGraphAuthenticationHelper.GetUserTokenV2Async(String appClientId, String loginHint)
   at Microsoft.Toolkit.Services.MicrosoftGraph.MicrosoftGraphService.LoginAsync(String loginHint)
   at Microsoft.Toolkit.Services.OneDrive.OneDriveService.LoginAsync()
   at MediaImporter.Views.RootPage.ImportOneDrive_Click(Object sender, RoutedEventArgs e)




 

 

推荐答案

由于问题与OneDrive有关,您可能需要在Stack Overflow中使用 标记"OneDrive"来询问此问题。   OneDrive团队是  回答
OneDrive开发问题在Stack Overflow上。

Since the problem is more related to OneDrive, you might need to ask about this in Stack Overflow with tag "OneDrive". The OneDrive team is answering OneDrive development questions on Stack Overflow.

祝你好运,

Roy


这篇关于OneDriveService尝试登录NullReferenceException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆