I'm doing some cloud operations involving a BitmapImage in my code, and on the response (basically a none-UI thread for sure) I'm getting a "The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))" on -
BitmapImage cImage = new BitmapImage();
AFAK this means that I've tried to access the UI from a none-UI thread, but I'm just instantiating the thing, didn't try to modify any ui related data..
Any ideas as to why is this happening? Am I restricted from using a class that's defined in a UI namespace on none-UI threads?
In Windows Runtime, the BitmapImage class inherits from the DependencyObject which will restrict the access from the non-UI thread. So you cannot manipulate the BitmapImage object in non-UI thread, as Aybe suggested, you need to use UI thread dispatcher.
User contributions licensed under CC BY-SA 3.0