.net core MS Graph.netcore客户端SDK在令牌无效时引发NullReferenceException

.net core MS Graph.netcore客户端SDK在令牌无效时引发NullReferenceException,.net-core,onedrive,microsoft-graph-sdks,.net Core,Onedrive,Microsoft Graph Sdks,我正在使用Microsoft Graph.netcore SDK版本3.14向OneDrive For Business发出请求。 然而,每当有401未经授权的响应时,我都会得到NullReferenceException,而不是正确的错误响应。 我应该如何处理此错误以确保NullReferenceException的根本原因是401? 以下是我请求删除OneDrive订阅的示例: IGraphServiceSubscribedSkusCollectionRequestBuilder subsc

我正在使用Microsoft Graph.netcore SDK版本3.14向OneDrive For Business发出请求。 然而,每当有401未经授权的响应时,我都会得到NullReferenceException,而不是正确的错误响应。 我应该如何处理此错误以确保NullReferenceException的根本原因是401? 以下是我请求删除OneDrive订阅的示例:

IGraphServiceSubscribedSkusCollectionRequestBuilder subscriptions = this.GetSubscriptions(credentials);
await subscriptions[webhookId]
   .Request()
   .DeleteAsync();
从小提琴手那里,我可以看到答案是401。 下面的Ans是NullReferenceException的一个片段。它不包含任何信息来表明它由于401而失败

   Object reference not set to an instance of an object.
            
   at Microsoft.Graph.HttpProvider.<SendAsync>d__18.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Graph.BaseRequest.<SendRequestAsync>d__38.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Graph.BaseRequest.<SendAsync>d__34`1.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Graph.SubscriptionRequest.<DeleteAsync>d__4.MoveNext()
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
对象引用未设置为对象的实例。
在Microsoft.Graph.HttpProvider.d_u18.MoveNext()上
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中
在Microsoft.Graph.BaseRequest.d_u38.MoveNext()中
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中
在Microsoft.Graph.BaseRequest.d_u34`1.MoveNext()中
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中
在Microsoft.Graph.SubscriptionRequest.d_u4.MoveNext()中
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()中
在System.Runtime.CompilerServices.TaskWaiter.HandleNonSuccessAndDebuggerNotification(任务任务)中

这是由SDK中的错误引起的。请尝试升级到sdk的最新版本,看看问题是否仍然存在


您找到解决方案了吗?