Don't use newlines in AppBarButton label

Today I got a message from a friend that his Windows Phone 8.1 RT app was crashing after he added localizations for German with the Multilingual App Toolkit’s xlf files. Because adding a language shouldn’t crash your app, I went over to his place after work to help investigate the issue.

WinRT (both Windows and Windows Phone) usually gives you a hard time finding an error with very unclear error messages in the output window and on the exceptions thrown. But after checking on breaking on all CLR exceptions, we found the solution quite fast. We had following exception pop up in App.xaml.cs: “Newline characters not supported in app bar button labels.”

Newline not supported

It seems like a newline slipped into the translation of an AppBarButton’s label and Windows Phone doesn’t seem too happy with it.

Conclusion: when your app is showing unexpected behavior, turn on breaking on all CLR exceptions to maximize your chances in finding the culprit.

Bonus: we all know that opening the exceptions dialog can be rather slow. To speed up toggling this setting, you can use the Exception Breaker plugin. I’ve been using it for a few weeks now, and I’m a huge fan.

Licensed under CC BY-NC-SA 4.0; code samples licensed under MIT.
comments powered by Disqus
Built with Hugo - Based on Theme Stack designed by Jimmy