Note that there are some explanatory texts on larger screens.

plurals
  1. POInvalidOperationException with MediaLibrary pictures
    primarykey
    data
    text
    <p>I have a windows phone app and get sometimes InvalidOperationExceptions but not sure why and how to avoid them. The problem function from the error report is <code>Microsoft.Xna.Framework.Media.MediaLibraryEnumerator_1[[System.__Canon,_mscorlib]].get_Item</code> and i get this stacktrace</p> <pre><code>"Frame Image Function Offset 0 Microsoft.Xna.Framework.ni.dll Microsoft.Xna.Framework.Media.MediaLibraryEnumerator_1[[System.__Canon,_mscorlib]].get_Item 0x0003e4d8 1 Microsoft.Xna.Framework.ni.dll Microsoft.Xna.Framework.Media.MediaLibraryEnumerator_1[[System.__Canon,_mscorlib]].System.Collections.IEnumerator.get_Current 0x00000006 2 Microsoft.Xna.Framework.ni.dll Microsoft.Xna.Framework.Media.MediaLibraryEnumerator_1[[System.__Canon,_mscorlib]].System.Collections.Generic.IEnumerator_T_.get_Current 0x0000001c 3 MapLense.ni.DLL MapLense.Helper.PictureMapping.Add 0x000000a8 4 MapLense.ni.DLL MapLense.Helper.PictureMapping+_GetPicture_d__b.MoveNext 0x000000f6 5 mscorlib.ni.dll System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess 0x00216c46 6 mscorlib.ni.dll System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification 0x0000003a 7 mscorlib.ni.dll System.Runtime.CompilerServices.TaskAwaiter_1[[System.__Canon,_mscorlib]].GetResult 0x0000001c 8 MapLense.ni.DLL MapLense.Helper.Map+_AddPictureToMap_d__17.MoveNext 0x00000118 9 mscorlib.ni.dll System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess 0x00216c46 10 mscorlib.ni.dll System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification 0x0000003a 11 mscorlib.ni.dll System.Runtime.CompilerServices.TaskAwaiter_1[[System.__Canon,_mscorlib]].GetResult 0x0000001c 12 MapLense.ni.DLL MapLense.MainPage+_ViewModelOnPropertyChanged_d__1e.MoveNext 0x00000204 13 mscorlib.ni.dll System.Runtime.CompilerServices.AsyncMethodBuilderCore._ThrowAsync_b__0 0x00000036" </code></pre> <p>I also tried to add a try-catch block around the code block, but without a result</p> <p> <pre><code>public static bool Add(DBPicture dbpicture) { if (Pictures.ContainsKey(dbpicture.UniqueID)) return true; var root = new MediaLibrary().RootPictureAlbum; foreach (var album in root.Albums) { if (album.Name != AppResources.CameraRollAlbumName) continue; for (var i = 0; i &lt; album.Pictures.Count; i++) { try { var picture = album.Pictures[i]; if (picture.Name == dbpicture.UniqueID) { Pictures.Add(picture.Name, picture); DBPictures.Add(picture.Name, dbpicture); return true; } } catch (System.Exception e) { #if DEBUG Logger.WriteLine("PictureMapping.Add(DBPicture)"); Logger.WriteLine(e); #endif } } } return false; } </code></pre> <p>Thanks for any suggestions</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload