Thursday, October 8, 2015

WPF Application.Current.FindResource() and uncaughtable exceptions

One more time to remind about The Old New Thing blog and trend to blame yourself first instead of Windows.
Today it was a trivial day with trivial task: find a resource by its name at a WPF app. What can be a problem, really? The plan was simple:
  1. Call Application.Current.FindResource()
  2. Wrap it into try...catch block as MSDN says we can meet ResourceReferenceKeyNotFoundException if the resource is absent or somehow missed in the app package.