question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Template10 throws exception on launch when my phone is set to High Contrast

See original GitHub issue

Only happens when the color scheme is set to High Contrast. Here are the details of the exception:

Exception:

{“Object reference not set to an instance of an object.”}

StackTrace:

at Template10.Controls.HamburgerMenu.UpdateFullScreen(Nullable1 manual)\r\n at Template10.Controls.HamburgerMenu.UpdateControl(Nullable1 manualFullScreen)\r\n at Template10.Controls.HamburgerMenu.HamburgerMenu_Loaded(Object sender, RoutedEventArgs args)"

This even happens on newly created app using Template10’s templates in VS.

I am using VS 2015 for the development and the min and max version of the targeted OS are both set to Windows Anniversary Update.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
PrefabErikcommented, Feb 1, 2017

I ran into the same problem using the Template10 Hamburger template. I’ve downloaded the Template10 code, ran the debugger on the Hamburger template code and found that there’s a problem with the defined brushes in the default Custom.xaml HighContrast resource dictionary.

The brushes for the HamburgerMenu control in HightContrast are assigned a SystemColor instead of a brush. This will cause all the defined brushes of the control to be set to null in the constructor by the InitializeComponent method. Later on, the UpdateFullScreen method is called where the Opacity of the HamburgerBackground is set, but set to null this will throw a NullReferenceException.

So, changing the defined colors to brushes will fix the problem.

0reactions
PrefabErikcommented, Feb 3, 2017

As a side note, there’s another issue with the default Custom.xaml. It uses style setters inside the ThemeDictionaries, the problem with that is if the user changes the light/dark setting on the Settings page it will not update the color scheme of the controls. The app has to be restarted to reflect the change.

A better way is to define brushes (or other properties) with a unique name and assign that brush in every theme. Then outside the ThemeDictionaries use the style setters to set the brushes of the controls once and refer to the unique brush names as a ThemeResource. This way if the user changes the light/dark theme it will update the color scheme immediately.

Read more comments on GitHub >

github_iconTop Results From Across the Web

High contrast mode shows an error when turning off
This theme can't be applied to the desktop. Try clicking a different theme. [Close]. but im trying to turn it off, I don't...
Read more >
How to Fix the Inability to Turn Off High Contrast Mode on ...
Start with basic troubleshooting and use the hotkeys to disable the high contrast theme. Then, update GPU drivers and Windows OS and reinstall ......
Read more >
Some settings aren't available in High Contrast mode
This article explains how to disable the High Contrast mode and remove Some settings aren't available in High Contrast mode message in ...
Read more >
eo
Exeter to barnstaple train, Delta com manage my booking, Us dept of education phone number, Is patriotism illegal in britain, Aeg competence oven...
Read more >
QL-810W QL-820NWB
Set the contrast of the LCD. The higher the number, the stronger the contrast. Backlight. On. Off. Switch the backlight On or Off....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found