Fix loading extra assemblies by only filtering for ByRef types on default members
This commit is contained in:
@@ -233,8 +233,10 @@ namespace Newtonsoft.Json.Serialization
|
||||
|
||||
MemberSerialization memberSerialization = JsonTypeReflector.GetObjectMemberSerialization(objectType, ignoreSerializableAttribute);
|
||||
|
||||
// Exclude index properties
|
||||
// Do not filter ByRef types here because accessing FieldType/PropertyType can trigger additonal assembly loads
|
||||
IEnumerable<MemberInfo> allMembers = ReflectionUtils.GetFieldsAndProperties(objectType, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static)
|
||||
.Where(FilterMembers);
|
||||
.Where(m => m is PropertyInfo p ? !ReflectionUtils.IsIndexedProperty(p) : true);
|
||||
|
||||
List<MemberInfo> serializableMembers = new List<MemberInfo>();
|
||||
|
||||
@@ -245,6 +247,7 @@ namespace Newtonsoft.Json.Serialization
|
||||
#endif
|
||||
|
||||
#pragma warning disable 618
|
||||
// Exclude index properties and ByRef types
|
||||
List<MemberInfo> defaultMembers = ReflectionUtils.GetFieldsAndProperties(objectType, DefaultMembersSearchFlags)
|
||||
.Where(FilterMembers).ToList();
|
||||
#pragma warning restore 618
|
||||
|
||||
Reference in New Issue
Block a user