0

我真的陷入了一个奇怪的问题,我最终无法重现,但它在用户端经常发生。根据堆栈跟踪,当用户导航到特定页面时,应用程序崩溃了。按照从 Microsoft 收到的该问题的堆栈跟踪。

Frame    Image                                                    Function                                                                                                               Offset        
0        Microsoft.Xna.Framework.MediaLibraryExtensions.ni.dll    Microsoft.Xna.Framework.Media.PhoneExtensions.MediaLibraryExtensions.ThrowExceptionFromResult                          0x00000f5e    
1        Microsoft.Xna.Framework.MediaLibraryExtensions.ni.dll    Microsoft.Xna.Framework.Media.PhoneExtensions.MediaLibraryExtensions.GetPathFromItemInternal                           0x00000050    
2        Microsoft.Xna.Framework.MediaLibraryExtensions.ni.dll    Microsoft.Xna.Framework.Media.PhoneExtensions.MediaLibraryExtensions.GetPath                                           0x00000022    
3        InstaRepost.ni.DLL                                       InstaRepost.Gallery.OnNavigatedTo                                                                                      0x000000ae    
4        Microsoft.Phone.ni.dll                                   Microsoft.Phone.Controls.PhoneApplicationPage.InternalOnNavigatedTo                                                    0x000002d4    
5        Microsoft.Phone.ni.dll                                   Microsoft.Phone.Controls.PhoneApplicationPage.Microsoft.Phone.Controls.IPhoneApplicationPage.InternalOnNavigatedToX    0x0000000c    
6        Microsoft.Phone.ni.dll                                   System.Windows.Navigation.NavigationService.RaiseNavigated                                                             0x0000038e    
7        Microsoft.Phone.ni.dll                                   System.Windows.Navigation.NavigationService.CompleteNavigation                                                         0x00000158    
8        Microsoft.Phone.ni.dll                                   System.Windows.Navigation.NavigationService.ContentLoader_BeginLoad_Callback                                           0x000002aa    
9        Microsoft.Phone.ni.dll                                   System.Windows.Navigation.PageResourceContentLoader.BeginLoad_OnUIThread                                               0x000002b4    
10       Microsoft.Phone.ni.dll                                   System.Windows.Navigation.PageResourceContentLoader+__c__DisplayClass4._BeginLoad_b__0                                 0x0000000a

我在代码中尝试做的是我在 Medialibrary 以及应用程序的独立存储中都有图像。因此,为了显示它们,我正在从隔离存储中读取它们的名称,然后从 MediaLibrary 中打开它。

for (int i = 0; i < filesNames.Length; i++)
       {
         if (!filesNames[i].Contains(".tmp") && !filesNames[i].Contains("_ApplicationSettings"))
            {
               obj = new VideoInformation();
               obj.videoName = filesNames[i];
               obj.timeCreated = isolatedStorageFile.GetCreationTime(filesNames[i]);
               for (int j = 0; j < instaRepostPictures.Count; j++)
                {
                   string imagePath = Pictures[j].GetPath();
                   if (imagePath.Contains(obj.videoName))
                    {
                     obj.thumbnailpath = PictureDecoder.DecodeJpeg(Pictures[j].GetThumbnail());
                            //obj.thumbnailpath.
                        }
                    }
                    pictureList.Add(obj);
                }
            }

我认为问题出在 GetPath 函数中。我检查了功能和 ID_CAP_MEDIALIB_PHOTO 功能。如果有人可以帮助我确定这个问题,请多多关照。我将不胜感激。

4

1 回答 1

0

尝试添加这段代码,因为您必须FrameworkDispatcher.Update自己调用该方法来调度XNA Framework消息队列中的消息。

Microsoft.Xna.Framework.FrameworkDispatcher.Update();

正如您所说,请确保您Capabilities已从Manifest.

参考:MSDN

于 2014-12-11T01:23:34.617 回答