From 7b4995523bc1d984f903f9a7b4ba0e1ba17f4dc6 Mon Sep 17 00:00:00 2001 From: James Newton-King Date: Wed, 5 Nov 2014 16:33:53 -0800 Subject: [PATCH] -Fixed (hopefully) MetadataTypeAttribute not being found on some platforms --- Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs b/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs index 2ef1ac20..fa10863d 100644 --- a/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs +++ b/Src/Newtonsoft.Json/Serialization/JsonTypeReflector.cs @@ -240,8 +240,9 @@ namespace Newtonsoft.Json.Serialization { Type attributeType = attribute.GetType(); - if (string.Equals(attributeType.Name, "MetadataTypeAttribute", StringComparison.Ordinal) - && attributeType.Assembly().FullName.StartsWith("System.ComponentModel.DataAnnotations", StringComparison.Ordinal)) + // only test on attribute type name + // attribute assembly could change because of type forwarding, etc + if (string.Equals(attributeType.FullName, "System.ComponentModel.DataAnnotations.MetadataTypeAttribute", StringComparison.Ordinal)) { const string metadataClassTypeName = "MetadataClassType";