Beware of using Edit Template in a UWP app

Hello Devs,

When Microsoft released the Windows 10 April 2018 update, I installed it and I updated Visual Studio with the latest SDK. If you develop UWP apps where the min version is set to the latest Windows update (in this case Windows 10, version 1803, build 17134), you can stop reading here. However, if for example, the min version if the Fall Creators Update, please read on.

image

The other day, I was testing on my desktop machine the style that I modified of a simple TextBox. It was working well, until I deployed on my Dell Venue Pro 8. When I navigated to a page where I modified the TextBox, the app crashes every single time. I was wondering what was going on since Visual Studio didn’t warn me of anything.

If you add an TextBox and you click on “Edit Template”, the latest SDK will introduce the usage of the ThemeResource IsApplicationFocusVisualKindReveal. This resource does not exist in previous Windows 10 updates, so when the app runs on previous version, the app will crash.

image

What is worrisome is Visual Studio does not warn about anything (no warning message and no wiggle underline under the resource name).

I wrote an email to my XAML friends at Microsoft and they acknowledged what I found. They were actually surprised by that too. I will report back when they will find the solution for it.

In the meantime, I highly suggest that if you do an Edit Template with the April 10 SDK, go ahead and try in all of your supported Windows 10 updates.

Happy testing Smile

PS: it’s been quite a long time from my previous blog. Having kids and a new passion (Magic the Gathering competition) took a lot of my free time. I still work full time on UWP projects for years and I enjoy this more than ever!