使用我的应用程序允许备份到skydrive,我能够让“SignIn”按钮正常工作。经过进一步细化后,我开始使用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一起用于Windows Phone和Live SDK的第5版。非常感谢任何帮助/见解!
答案 0 :(得分:1)
可能是愚蠢的答案,但是......
我认为“ClientId”只是您发布的代码中的占位符,对吗?
否则,应用程序注册后获得的正确ClientId应该在那里