diff --git a/WpfAnalyzers.Test/WPF0004ClrMethodShouldMatchRegisteredNameTests/Valid.cs b/WpfAnalyzers.Test/WPF0004ClrMethodShouldMatchRegisteredNameTests/Valid.cs
index ae300e38..b69d5984 100644
--- a/WpfAnalyzers.Test/WPF0004ClrMethodShouldMatchRegisteredNameTests/Valid.cs
+++ b/WpfAnalyzers.Test/WPF0004ClrMethodShouldMatchRegisteredNameTests/Valid.cs
@@ -1,4 +1,4 @@
-namespace WpfAnalyzers.Test.WPF0004ClrMethodShouldMatchRegisteredNameTests
+namespace WpfAnalyzers.Test.WPF0004ClrMethodShouldMatchRegisteredNameTests
{
using Gu.Roslyn.Asserts;
using NUnit.Framework;
@@ -461,5 +461,78 @@ public static int Meh(FrameworkElement element)
RoslynAssert.Valid(Analyzer, code);
}
+
+ [Test]
+ public static void AttachedPropertyNullableEnumerable()
+ {
+ var binary = MetadataReferences.CreateBinary(@"
+namespace BinaryReference
+{
+ using System.Collections;
+ using System.Windows;
+ using System.Windows.Controls;
+
+ public static class DataGridExt
+ {
+ ///
+ /// An of rows where each row is an with the values.
+ ///
+ public static readonly DependencyProperty EnumerableProperty = DependencyProperty.RegisterAttached(
+ ""Enumerable"",
+ typeof(IEnumerable),
+ typeof(DataGridExt),
+ new PropertyMetadata(default(IEnumerable)));
+
+ /// Helper for setting on .
+ /// to set on.
+ /// Enumerable property value.
+ public static void SetEnumerable(this DataGrid element, IEnumerable? value)
+ {
+ if (element is null)
+ {
+ throw new System.ArgumentNullException(nameof(element));
+ }
+
+ element.SetValue(EnumerableProperty, value);
+ }
+
+ /// Helper for getting from .
+ /// to read from.
+ /// Enumerable property value.
+ [AttachedPropertyBrowsableForChildren(IncludeDescendants = false)]
+ [AttachedPropertyBrowsableForType(typeof(DataGrid))]
+ public static IEnumerable? GetEnumerable(this DataGrid element)
+ {
+ if (element is null)
+ {
+ throw new System.ArgumentNullException(nameof(element));
+ }
+
+ return (IEnumerable)element.GetValue(EnumerableProperty);
+ }
+ }
+}");
+ var code = @"
+namespace N
+{
+ using System.Collections.ObjectModel;
+ using System.Windows.Controls;
+
+ using BinaryReference;
+
+ public static class C
+ {
+ public static DataGrid M1()
+ {
+ var dataGrid = new DataGrid();
+ var xs = new ObservableCollection(new[] { 1, 2 });
+ dataGrid.SetValue(DataGridExt.EnumerableProperty, xs);
+ return dataGrid;
+ }
+ }
+}";
+
+ RoslynAssert.Valid(Analyzer, code, metadataReferences:MetadataReferences.FromAttributes().Add(binary));
+ }
}
}