Skip to content

Commit 8baadb6

Browse files
committed
Fixes MixedRealityExtensionServiceAttribute to work on the .NET scripting backend
Types.GetCustomAttributes() doesn't exist on .NET UWP, so we have to use some indirection to get attributes instead.
1 parent 8758b9b commit 8baadb6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Assets/MixedRealityToolkit/Attributes/MixedRealityExtensionServiceAttribute.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,13 @@ public MixedRealityExtensionServiceAttribute(
7676
/// </summary>
7777
public static MixedRealityExtensionServiceAttribute Find(Type type)
7878
{
79+
#if WINDOWS_UWP && !ENABLE_IL2CPP
80+
// Type.GetCustomAttributes() doesn't exist on UWP .NET, so we have to indirectly use
81+
// the TypeInfo instead.
82+
return type.GetTypeInfo().GetCustomAttributes(typeof(MixedRealityExtensionServiceAttribute), true).FirstOrDefault() as MixedRealityExtensionServiceAttribute;
83+
#else
7984
return type.GetCustomAttributes(typeof(MixedRealityExtensionServiceAttribute), true).FirstOrDefault() as MixedRealityExtensionServiceAttribute;
85+
#endif
8086
}
8187
}
8288
}

0 commit comments

Comments
 (0)