[英]Active Directory Graph Client: Delete an Application using the C# API
下面有一個調用導致我的程序終止。 請告訴我為什么。
TaskCompletionSource<string> tcs = new TaskCompletionSource<string>();
tcs.SetResult(accessToken);
ActiveDirectoryClient graphClient = new ActiveDirectoryClient(
new Uri($"https://graph.windows.net/{tenantId}"),
async () => { return await tcs.Task; });
// this part runs fine and I can see a list of applications being printed
foreach (var app in graphClient.Applications.ExecuteAsync().Result.CurrentPage)
{
Console.WriteLine($"{app.AppId}, {app.DisplayName}");
}
// this call causes the program to terminate
var matches = await graphClient.Applications
.Where(app => app.AppId == clientId)
.ExecuteAsync();
// the execution never gets to this part:
foreach (IApplication app in matches.CurrentPage.ToList())
{
await app.DeleteAsync();
}
正如Thomas在評論中提到的那樣,問題不在於等待異步調用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.