Skip to content

Improper exception handling demonstration #3888

@jinek

Description

@jinek

On this page https://docs.microsoft.com/en-us/dotnet/api/system.windows.controls.contentcontrol.contenttemplateselector?f1url=https%3A%2F%2Fmsdn.microsoft.com%2Fquery%2Fdev15.query%3FappId%3DDev15IDEF1%26l%3DEN-US%26k%3Dk(System.Windows.Controls.ContentControl.ContentTemplateSelector);k(VS.XamlEditor);k(SolutionItemsProject);k(TargetFrameworkMoniker-.NETFramework,Version%3Dv4.7)%26rd%3Dtrue&view=netframework-4.7.1
There is an example with following code:
catch { return null; }
The behavior of this code does not match the expectations. For example, catched OutOfMemoryException or NullReferenceException do not mean we should provide empty Template. Better to rewrite that as
'catch(FormatException)
{
return null;
}'

Metadata

Metadata

Assignees

Labels

help wantedGood for community contributors to help [up-for-grabs]

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions