Sumit Chourasia
Sumit Chourasia

Reputation: 2434

Xamarin.forms giving "invalid cross thread access" Exception in windows8 emulator

Xamarin.forms is working fine in android phones but in window8 emulator it is not loading image and giving invalid cross thread access exception.

I'm using Embedded Image Technique, I'm storing all images in common folder and accessing from shared project.

snapshot of my project is as follows:

enter image description here

Error is As follows :

enter image description here

In window8 simulator images are not loading

enter image description here

Any help will be much appreciated.

Upvotes: 2

Views: 500

Answers (1)

JMK
JMK

Reputation: 28069

This is because you are updating a UI element on a non UI thread, you want to use Device.BeginInvokeOnMainThread, like so:

Device.BeginInvokeOnMainThread(() => MainPage.DisplayAlert("Boom", message, "Cancel"));

Upvotes: 3

Related Questions