Microsoft.SharePoint.Client.ClientContext UWP APP 重置后失败

Microsoft.SharePoint.Client.ClientContext in UWP APP fails after reset

我正在尝试连接到 SharePointOnline 2013。

在我的 C# 控制台应用程序中,一切正常,但如果我在通用应用程序中尝试(几乎)相同的代码,无法创建 ClientContext 的多个实例,也无法将凭据设置为多个次.

我使用的是 Microsoft.SharepointOnline.CSOM 版本:16.1.4727.1204(2015 年 12 月 11 日发布)

class Program
{
    static void Main(string[] args)
    {
        UseContextMultipleTime();
        UseContextMultipleTime();
    }

    public static void UseContextMultipleTime()
    {
        using (var context = new ClientContext("https://something.sharepoint.com"))
        {
            var securePassword = new SecureString();

            foreach (char c in "password".ToCharArray()) securePassword.AppendChar(c);

            context.Credentials = new SharePointOnlineCredentials("username", securePassword);

            try
            {
                context.ExecuteQuery();
                string status = "OK";
            }
            catch (Exception ex)
            {
                string test = ex.ToString();
            }
        }
    }   
}

通用应用程序版本以下,在第二个方法调用中崩溃:

public sealed partial class MainPage : Page
{
    public MainPage()
    {
        this.InitializeComponent();

        UseContextMultipleTime();
        UseContextMultipleTime();
    }

    public void UseContextMultipleTime()
    {
        using (var context = new ClientContext("https://something.sharepoint.com"))
        {
            context.Credentials = new SharePointOnlineCredentials("username", "password");
            try
            {
                context.ExecuteQueryAsync().Wait();
                string status = "OK";
            }
            catch (Exception ex)
            {
                string test = ex.ToString();
            }
        }
    }
}

当我只设置一次凭据时,它会起作用。

有人知道这个问题的解决方案吗?我会感谢各种提示。

问题已在最新的 CSOM 更新中解决。现在一切正常。