locked
Is this Stack Trace a bug in WP8? SystemTray.IsVisible=True RRS feed

  • Question

  • Below find a stack trace that I can't reproduce from one of our programs.

    The crash is in the constructor of one of our Options pages, and is obviously caused by setting the xaml  to include shell:SystemTray.IsVisible="true" on the page.

    The exception raised is of type system.reflection.targetinvocationexception

    Any idea how you could possibly work around this, as it's thrown during page construction?

    Is it a bug in the Phone OS itself?  Anyone else seeing this in their stack traces?

    Frame    Image                             Function                                                                             Offset       

    0        Microsoft.Phone.Interop.ni.dll    Microsoft.Phone.Shell.Interop.NativeSystemTrayMethods.SetSysTrayVisible              0x00000001   

    1        Microsoft.Phone.Interop.ni.dll    Microsoft.Phone.Shell.Interop.NativeSystemTrayInteropWrapper.SetSystemTrayVisible    0x0000005a 

     


    2        Microsoft.Phone.ni.dll            Microsoft.Phone.Controls.PhoneApplicationPage.set_SystemTrayIsVisible                0x00000030   

    3        Microsoft.Phone.ni.dll            Microsoft.Phone.Controls.PhoneApplicationPage..ctor                                  0x000001b2   

    4        Terminator2.ni.DLL                Terminator2.OptionsPage..ctor                                                        0x00000016   

    5        mscorlib.ni.dll                   System.RuntimeType.CreateInstanceDefaultCtor                                         0x000000b2


    Anthony Wieser | Wieser Software Ltd | www.wieser-software.com

    Sunday, June 9, 2013 7:40 AM

All replies

  • Hi, you are not the only one. I also had a few of these errors and I'm as clueless as you are. :)

    It would be good to get some clarifications from MS here

    Sunday, June 9, 2013 10:23 AM
  • Can you share your xaml?

    http://pauliom.wordpress.com

    Sunday, June 9, 2013 1:11 PM
  • I see this sometimes as well.

    System.ArgumentException: Value does not fall within the expected range.
       at Microsoft.Phone.Shell.Interop.NativeSystemTrayMethods.SetSysTrayVisible(IntPtr pSysTray, Boolean fVisible)
       at Microsoft.Phone.Shell.Interop.NativeSystemTrayInteropWrapper.SetSystemTrayVisible(Boolean isVisible)
       at Microsoft.Phone.Controls.PhoneApplicationPage.set_SystemTrayIsVisible(Boolean value)
       at Microsoft.Phone.Controls.PhoneApplicationPage..ctor()
       at Cirrious.MvvmCross.WindowsPhone.Views.MvxPhonePage..ctor()
       at Gooroovster.UI.Views.MainView..ctor()


    Sunday, June 30, 2013 4:02 AM
  • +1, getting several crash reports for this

    Value does not fall within the expected range.
       at Microsoft.Phone.Shell.Interop.NativeSystemTrayMethods.SetSysTrayVisible(IntPtr pSysTray, Boolean fVisible)
       at Microsoft.Phone.Shell.Interop.NativeSystemTrayInteropWrapper.SetSystemTrayVisible(Boolean isVisible)
       at Microsoft.Phone.Controls.PhoneApplicationPage.set_SystemTrayIsVisible(Boolean value)
       at Microsoft.Phone.Controls.PhoneApplicationPage..ctor()

      ...

    Monday, August 5, 2013 1:48 AM
  • Please provide some examples :)

    http://pauliom.wordpress.com

    Monday, August 5, 2013 4:51 AM
  • I Also see this exception once in a while in my logs. Never been able to reproduce this error. I use same Xaml for WP7 and WP8, but see this exception only in the WP8 phones, seem slike WP7 phones do not suffer from this exception

    Stacktrace:

     at Microsoft.Phone.Shell.Interop.NativeSystemTrayMethods.SetSysTrayVisible(IntPtr pSysTray, Boolean fVisible)   
       at Microsoft.Phone.Shell.Interop.NativeSystemTrayInteropWrapper.SetSystemTrayVisible(Boolean isVisible)   
       at Microsoft.Phone.Controls.PhoneApplicationPage.set_SystemTrayIsVisible(Boolean value)   
       at Microsoft.Phone.Controls.PhoneApplicationPage..ctor()   
       at UXAdditives.Library.Animation.AnimatedBasePage..ctor()   
       at UXAdditives.GalleryBase.Views.BasePage..ctor()   
       at UXAdditives.GalleryBase.Views.MainPagePivot..ctor()

    Cannot give you an example, because I have no example where I know that this exception occurs in the example. I only see it sometimes happening in one of the apps on somebodies phone. It happens only very few times, to know if an example has the bug you have to start it a couple of thousand times to see if the exception happens. Would there be a way to automate the start/close of app on phone? then I could run some examples continuously to see if bug happens, and do the same for my apps

    I also removed the shell:SystemTray.IsVisible="true" from the xaml but still this exception occurs. It happens in the constructor but even before running your code in the constructor. 

    It looks like the App crashes immediately at start, before user can interact. It is one of the few bugs still in my app, but I'm not able to reproduce or solve it.



    Saturday, August 10, 2013 1:56 PM
  • I have the same exception in my app. Going to try putting the ctor into try/catch and seeing if this bug goes away on the next version.

    Update:

    Nope, same error still appears. Known bug? Response from WP?

    Stack trace is basically the same as what's mentioned above.

    Friday, August 23, 2013 2:38 PM
  • I have this bug too, and in my xaml  there is no shell:SystemTray.IsVisible="true",

    any MS guy knows why it happed?

    System.ArgumentException: Value does not fall within the expected range.
       at Microsoft.Phone.Shell.Interop.NativeSystemTrayMethods.SetSysTrayVisible(IntPtr pSysTray, Boolean fVisible)
       at Microsoft.Phone.Shell.Interop.NativeSystemTrayInteropWrapper.SetSystemTrayVisible(Boolean isVisible)
       at Microsoft.Phone.Controls.PhoneApplicationPage.set_SystemTrayIsVisible(Boolean value)
       at Microsoft.Phone.Controls.PhoneApplicationPage..ctor()

    Thursday, January 2, 2014 7:54 AM
  • Yup I'm going to add my name to this list. Having this reported through Crittercism. The page in question has the status bar disabled by default but code in the page can show and hide it based on events

    Reported Name Reason App Version Download
    19-Jan-14 07:07:14 AM System.ArgumentException
    Value does not fall within the expected range.
    2.1.0.1
    Crashed Thread
    0
    at Microsoft.Phone.Shell.Interop.NativeSystemTrayMethods.SetSysTrayVisible(IntPtr pSysTray, Boolean fVisible)
    1
    at Microsoft.Phone.Shell.Interop.NativeSystemTrayInteropWrapper.SetSystemTrayVisible(Boolean isVisible)
    2
    at Microsoft.Phone.Controls.PhoneApplicationPage.set_SystemTrayIsVisible(Boolean value)
    3
    at Microsoft.Phone.Controls.PhoneApplicationPage..ctor()
    4
    at ScoreAlerts.Pages.FixturesPageBase..ctor()
    5
    at ScoreAlerts.Pages.Fixtures..ctor()
    6
    at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)

    Sunday, January 19, 2014 5:01 PM
  • +1 on this

    Assembly info: Version=0.9.8.5, Culture=neutral, PublicKeyToken=null 0.9.8.5
    OS info: 8.0.10517.0
    Orientation: PortraitUp
    Screen size: 480,800

    System.ArgumentException: Value does not fall within the expected range.
       at Microsoft.Phone.Shell.Interop.NativeSystemTrayMethods.SetSysTrayVisible(IntPtr pSysTray, Boolean fVisible)

       at Microsoft.Phone.Shell.Interop.NativeSystemTrayInteropWrapper.SetSystemTrayVisible(Boolean isVisible)
       at Microsoft.Phone.Controls.PhoneApplicationPage.set_SystemTrayIsVisible(Boolean value)
       at Microsoft.Phone.Controls.PhoneApplicationPage..ctor()
       at xxxxxx..ctor()


    Monday, March 17, 2014 6:58 PM
  • I also have this error show up quite often in my error logs - frustrating. Although I have never experienced it personally.

    In my case I am navigating from a page with systray hidden - I wonder if this is a factor?

    I doubt there is any sort of workaround, as the base constructor is the very first thing called in your page - before the XAML is parsed in InitializeComponent(), which is where you can set systray shown/hidden.

    Below is the contstructor for PhoneApplicationPage, from Reflector. You can see that SystemTrayIsVisible is always assigned to the private variable _systemTrayIsVisible, which still has its default value of false at this point.

    public PhoneApplicationPage()
    {
    	PerfUtil.BeginLogMarker(MarkerEvents.TH_INIT_PAGE, "Page initialized: " + ((base.Title == null) ? "" : base.Title));
    	base.NavigationCacheMode = NavigationCacheMode.Disabled;
    	this.InitializePageOrientation();
    	base.IsTabStop = true;
    	if (PhoneApplicationPage.IsInDesignMode())
    	{
    		this.mSysTrayInterop = new DesignSystemTrayWrapper();
    	}
    	else
    	{
    		this.mSysTrayInterop = new NativeSystemTrayInteropWrapper();
    	}
    	this.mSysTrayInterop.CreateSystemTray();
    	this.SystemTrayIsVisible = this._systemTrayIsVisible;
    }

    Sunday, March 30, 2014 10:41 PM
  • I'm having this error in my app powernAPP, too. But only on Lumia 1520 devices with WP8.1 . Didn't had problems before. The strange thing the app only crashes on one page (MainPage.xaml). When I set another page to be the first page (which also has exactly the same SystemTray), the app is not crashing. I have absolutely no clue why this is happening.

    For a first solution, I will simply remove the SystemTray. But I would be happy to get an answer/solution or a reason for this bug from MS.

    Thanks and a nice weekend

    Benjamin

    Saturday, April 26, 2014 6:42 PM
  • My app hides and shows the system tray as it navigates around. Does anyone else hide and show the tray on different pages? Wondering if this is related.
    Saturday, April 26, 2014 7:18 PM
  • In my app, I don't show or hide the system tray. And the app crashes before the there is the chance to show/hide the system tray. The app doesn't even start. But I also have other apps having a system tray and these are working perfectly. In consequence, I think the error is a combination of showing the SystemTray and any other thing. But I don't know what the other thing is ;)
    Sunday, April 27, 2014 7:30 AM
  • Add another instance of this error.  Seeing it in BugSense logs.  The page in question doesn't do anything with the system tray in XAML or the code-behind, although the previous page has:

    shell:SystemTray.IsVisible="True" 

    The page exhibiting the crash has a WebBrowser control in case that correlates with anyone else.


    -- Arian T. Kulp | http://www.ariankulp.com Please remember to mark as helpful, or mark as answer if this helps you!

    Monday, May 12, 2014 4:35 AM
  • As I understand it, this should be fixed in Windows Phone 8.1 ...Have you tried to reproduce the problem on a phone running the Windows Phone 8.1 developer preview OS image?


    Eric Fleck, Windows Store and Windows Phone Developer Support. If you would like to provide feedback or suggestions for future improvements to the Windows Phone SDK please go to http://wpdev.uservoice.com/ where you can post your suggestions and/or cast your votes for existing suggestions.

    Wednesday, May 21, 2014 4:07 PM
  • We see the same errors right now on devices as they happen. 

    What we found out is that error occures usually on first pages users see (landing pages, welcome screens or main screens).

    Regarding 8.1 or 8.0, here is version distribution across our 2500+ errors (huge amount, right?):

    https://db.tt/DbHZfQvi

    How do we make app work on these 8.0 devices (only 6.5% of crashes are on 8.1, though still present)?

    If app crashes on start, how do we tell users to upgrade their phones to 8.1?


    Please advise

    Tuesday, February 16, 2016 6:01 AM