Bug 35078 - Checking IsInvokeRequired on WinRT when off the dispatcher thread causes a null reference exception
Summary: Checking IsInvokeRequired on WinRT when off the dispatcher thread causes a nu...
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 1.5.0
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: E.Z. Hart [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2015-10-20 03:04 UTC by Shane
Modified: 2017-01-04 18:14 UTC (History)
3 users (show)

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


Attachments
Click the SWITCH and get a null reference exception when trying to add an item from the Task Pool Scheduler (370.67 KB, application/x-zip-compressed)
2015-10-20 03:04 UTC, Shane
Details


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:
Status:
RESOLVED FIXED

Description Shane 2015-10-20 03:04:54 UTC
Created attachment 13446 [details]
Click the SWITCH and get a null reference exception when trying to add an item from the Task Pool Scheduler

I think this happens because inside of

WindowsBasePlatformServices

IsInvokeRequired is using

-Window.Current.Dispatcher.HasThreadAccess;

whereas I think

-CoreApplication.MainView.CoreWindow.Dispatcher.HasThreadAccess;

Makes WINRT life happier :-)


This just makes debugging a little confusing because instead of getting an error about cross thread access I just get a Null reference exception error
Comment 1 Shane 2015-10-20 03:05:35 UTC
=== Xamarin Studio ===

Version 5.9.7 (build 22)
Installation UUID: 5f3e1f3d-a9ab-4075-8548-c0cc8f9cf6e1
Runtime:
	Microsoft .NET 4.0.30319.42000
	GTK+ 2.24.22 (MS-Windows theme)
	GTK# 2.12.26

=== Xamarin.Android ===

Version: 5.1.7 (Business Edition)
Android SDK: H:\SDKs\android-sdk
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.1   (API level 16)
		4.2   (API level 17)
		4.4   (API level 19)
		5.0   (API level 21)
		5.1   (API level 22)
Java SDK: C:\Program Files (x86)\Java\jdk1.7.0_55
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) Client VM (build 24.55-b03, mixed mode, sharing)

=== Xamarin Android Player ===

Version: 0.4.4
Location: C:\Program Files\Xamarin Android Player\DeviceManager.exe

=== Build Information ===

Release ID: 509070022
Git revision: 6bd1f169df44ca96addf8a035316c535a4fa46fa
Build date: 2015-09-30 10:13:51-04
Xamarin addins: 1c3e5c0859bdfec0ecd481a57ad6c03bc22f5536

=== Operating System ===

Windows 6.2.9200.0 (64-bit)
Comment 2 E.Z. Hart [MSFT] 2016-02-03 23:04:15 UTC
Confirmed still present in 2.0.1.6505
Comment 3 Samantha Houts [MSFT] 2017-01-04 18:14:04 UTC
Should be fixed as of 2.2.0. Thank you!