Browse Source

Ensure properties registered.

When calling `AvaloniaPropertyRegistry.GetAttached`.
Steven Kirk 8 years ago
parent
commit
9a74e8409e
1 changed files with 3 additions and 0 deletions
  1. 3 0
      src/Avalonia.Base/AvaloniaPropertyRegistry.cs

+ 3 - 0
src/Avalonia.Base/AvaloniaPropertyRegistry.cs

@@ -47,6 +47,9 @@ namespace Avalonia
         {
             Dictionary<int, AvaloniaProperty> inner;
 
+            // Ensure the type's static ctor has been run.
+            RuntimeHelpers.RunClassConstructor(ownerType.TypeHandle);
+
             if (_attached.TryGetValue(ownerType, out inner))
             {
                 return inner.Values;