1

在我的应用程序上工作以允许备份到 Skydrive,我能够让“登录”按钮正常工作。经过进一步完善后,我开始使用 LiveAuthClient.InitializeAsync 但似乎无论我把它放在哪里(UI线程与否)或者我通过什么范围,我总是会收到错误消息:

"An unhandled exception of type 'System.Runtime.Serialization.InvalidDataContractException' occurred in System.Windows.ni.dll" 

使用以下调用堆栈:

System.Windows.ni.dll!MS.Internal.JoltHelper.OnUnhandledException(object sender, System.UnhandledExceptionEventArgs args)
[Native to Managed Transition]
[Managed to Native Transition]
System.Windows.ni.dll!System.Net.Browser.ClientHttpWebRequest.InvokeGetResponseCallback.AnonymousMethod__1b(object state2)
mscorlib.ni.dll!System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(object state)
mscorlib.ni.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.ni.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)
mscorlib.ni.dll!System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
mscorlib.ni.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()
mscorlib.ni.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
[Native to Managed Transition]

代码:

Microsoft.Live.LiveAuthClient auth = new Microsoft.Live.LiveAuthClient("ClientId");
        auth.InitializeCompleted += auth_InitializeCompleted;
        auth.InitializeAsync(new string[] { "wl.signin", "wl.offline_access", "wl.skydrive_update" });

使用 Windows Phone 7.1 和 VS 2012 express for Windows Phone 和 Live SDK 版本 5。任何帮助/见解将不胜感激!

4

1 回答 1

1

可能的愚蠢答案,但是...

我想“ClientId”只是您发布的代码中的占位符,对吧?

否则,您在 App 注册后获得的正确 ClientId 应该在那里

于 2013-03-22T19:49:34.663 回答