When I try to read in a jpg into a BitmapImage in a windows phone 8 app, and I get the following error:
System.UnauthorizedAccessException
I was reading up about it, and it told me that I need to check the Photo Capability in the app’s manifest file, which I did. I still get the error.
My code to read in is:
System.Windows.Media.Imaging.BitmapImage b =
new System.Windows.Media.Imaging.BitmapImage(new Uri(@"cat.jpg",
UriKind.RelativeOrAbsolute));
Are there any other causes for this error?
BitmapImageobject can only be constructed on the UI thread. You can do so usingDispatcher.BeginInvoke:Keep in mind that it’s asynchronous, though, so your execution will need to continue within the lambda passed to BeginInvoke