我们正在使用LiveLink SDK 5.0,从我们的Windows 7.5申请中检索Sky司机的照片。
The application code (simplified) below used to work until a few days ago. Now when we try to access the imageStream (or any other information captured in a callback) we get a System.Argument exception (HResult = -2147024809, "Value does not fall within the expected range", but as usual the offending value is not mentioned). We checked our code base and there were no code changes in this area of the product recently.
是否发生了任何变化? 是否有办法(Fiddler,但对于非E的申请)检查网络的交通,希望从服务器传送更多的信息? 是否有任何地方价值观可能受到干扰?
Here s the relevant code:
public partial class OptionsPage : PhoneApplicationPage
{
private LiveConnectClient _liveClient = null;
public OptionsPage()
{
InitializeComponent();
}
private void OnSessionChanged(Object sender, LiveConnectSessionChangedEventArgs args)
{
if (args != null && args.Session != null && args.Session.Status == LiveConnectSessionStatus.Connected)
{
this._liveClient = new LiveConnectClient(args.Session);
this.GetUserPicture();
}
}
private void GetUserPicture()
{
var memoryStream = new MemoryStream();
_liveClient.DownloadCompleted += new EventHandler<LiveOperationCompletedEventArgs>(this.GetUserPictureCallback);
_liveClient.DownloadAsync("/me/picture?return_ssl_resources=true", memoryStream, memoryStream);
}
private void GetUserPictureCallback(object sender, LiveOperationCompletedEventArgs e)
{
_liveClient.DownloadCompleted -= this.GetUserPictureCallback;
try
{
if (e.Error == null)
{
MemoryStream imageStream = e.UserState as MemoryStream;
BitmapImage b = new BitmapImage();
b.SetSource(imageStream);
}
else
{
MessageBox.Show(e.Error.Message, "Windows Live Error", MessageBoxButton.OK);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "SkyDrive Exception", MessageBoxButton.OK);
}
}
}
签字国的定义如下:
<live:SignInButton Content="Button" Height="65" HorizontalAlignment="Left" Margin="110,41,0,0"
Name="signInButton1" VerticalAlignment="Top" Width="215" ClientId="[REAL_CLIENT_ID]"
Scopes="wl.offline_access wl.signin wl.basic wl.skydrive wl.skydrive_update"
RedirectUri="https://oauth.live.com/desktop"
Branding="Skydrive"
TextType="SignIn"
Background="Red"
SessionChanged="OnSessionChanged" />