0

我正在玩这个代码块:

 try
 {
   mscvUser = imstUser
    .Where(User => User.Id == intId)
    .Take(1000)
    .ToCollectionView();
 }
 catch(MobileServiceInvalidOperationException f){

  MessageBox.Show(f.ToString());

 }

它工作正常,但我一直故意断开我的互联网以进行测试,并且我一直在遇到 MobileServiceInvalidOperationException,但它不会在那个块中捕获它;它将它扔回 App.xaml.cs、中断并关闭应用程序。

4

1 回答 1

1

我认为您没有使用最新版本的 Azure 移动服务。SDK 最近更新到 1.0 版:http: //nuget.org/packages/WindowsAzure.MobileServices/

我检查了这个版本,异常被正确捕获。

在最新版本中,“ToCollectionView”已被替换,您现在必须使用

try
 {
   mscvUser = await imstUser
    .Where(User => User.Id == intId)
    .Take(1000)
    .ToCollectionAsync();
 }
 catch(MobileServiceInvalidOperationException f){

  MessageBox.Show(f.ToString());

 }

希望这可以帮助

编辑:来自变更日志:

MobileServiceTable.ToCollectionView() 现在是 ToCollection():collection view 实现有一些错误,并且已经被重写。

正如你可以在这里阅读

于 2013-06-21T10:28:54.240 回答