Bug 30688 - [Windows Phone 8.1]The application called an interface that was marshalled for a different thread.
Summary: [Windows Phone 8.1]The application called an interface that was marshalled fo...
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 1.4.2
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-06-02 15:37 UTC by Jon Douglas [MSFT]
Modified: 2016-04-09 01:19 UTC (History)
3 users (show)

Tags: ac
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Jon Douglas [MSFT] 2015-06-02 15:37:03 UTC

When using a simple Task.Run(() => { }); on Windows Phone 8.1, it crashes with the following exception:

The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD))

Sample Code:

Task.Run(() =>
                Page3 page = new Page3();
                Device.BeginInvokeOnMainThread(() =>
                    MainPage = page;

*Reproduction Steps

1. Run the sample ensuring that the ThreadingIssue() method is in the App.cs ctor

2. Notice the following error above will appear

*Xamarin Forms Version


*Version Information

Xamarin 3.11.586



Windows Phone 8.1 SDK Integration 1.0
Comment 2 Chris King 2015-06-02 17:12:32 UTC
Thank you for taking the time to submit the bug. We tried to reproduce the issue you reported but were unable given the description. If you could please attach a reproduction to the bug by starting with a clean Xamarin.Forms project and adding just the code necessary to demonstrate the issue we would very much appreciate it. 

Copying the code you supplied into a blank windows phone app successfully loaded the "Welcom to Xamarin Forms!" splash screen. 

Warm regards,
Xamarin Forms Team
Comment 3 Mobiledev 2015-06-02 17:17:55 UTC
Hello Chris, When you copied this into a blank windows phone app, was it Windows Phone 8.1 Non-Silverlight aka RT?  Also I have added an attachment containing a link to my onedrive where you can download a sample project that demonstrates the issue.
Comment 5 Jason Smith [MSFT] 2016-04-09 01:19:32 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Forms. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.
For your convenience, we have created some reproduction best practices viewable here: https://gist.github.com/jassmith/92405c300e54a01dcc6d

Warm regards,
Xamarin Forms Team