Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit cc866ba

Browse files
committed
Sprinkling the asserts
1 parent 4861655 commit cc866ba

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/GitHub.Exports/Exports/ExportMetadata.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using GitHub.ViewModels;
55
using System.Windows.Controls;
66
using System.Linq;
7+
using System.Diagnostics;
78

89
namespace GitHub.Exports {
910

@@ -49,7 +50,8 @@ public static class ExportViewAttributeExtensions
4950
{
5051
public static bool IsViewType(this UserControl c, UIViewType type)
5152
{
52-
return c.GetType().GetCustomAttributesData().Any(x => x.AttributeType.Equals(typeof(ExportViewAttribute)) && (UIViewType)x.NamedArguments[0].TypedValue.Value == type);
53+
Debug.Assert(c.GetType().GetCustomAttributesData().Any(x => x.AttributeType == typeof(ExportViewAttribute) && x.NamedArguments.Any() && x.NamedArguments[0].TypedValue.ArgumentType == typeof(UIViewType)), "Someone broke the ExportViewAttribute contract...");
54+
return c.GetType().GetCustomAttributesData().Any(x => x.AttributeType == typeof(ExportViewAttribute) && (UIViewType)x.NamedArguments[0].TypedValue.Value == type);
5355
}
5456
}
5557
}

0 commit comments

Comments
 (0)