/// <SecurityNote> /// Review - checks member visibility to calculate if access to it requires MemberAccessPermission for deserialization. /// since this information is used to determine whether to give the generated code access /// permissions to private members, any changes to the logic should be reviewed. /// </SecurityNote> internal bool RequiresMemberAccessForSet() { MemberInfo memberInfo = MemberInfo; FieldInfo field = memberInfo as FieldInfo; if (field != null) { return(DataContract.FieldRequiresMemberAccess(field)); } else { PropertyInfo property = (PropertyInfo)memberInfo; MethodInfo setMethod = property.SetMethod; if (setMethod != null) { return(DataContract.MethodRequiresMemberAccess(setMethod) || !DataContract.IsTypeVisible(property.PropertyType)); } } return(false); }
private bool RequiresMemberAccessForCreate(SecurityException securityException) { if (!DataContract.IsTypeVisible(base.UnderlyingType)) { if (securityException != null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityException(System.Runtime.Serialization.SR.GetString("PartialTrustIXmlSerializableTypeNotPublic", new object[] { DataContract.GetClrTypeFullName(base.UnderlyingType) }), securityException)); } return(true); } if (!DataContract.ConstructorRequiresMemberAccess(this.GetConstructor())) { return(false); } if (securityException != null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new SecurityException(System.Runtime.Serialization.SR.GetString("PartialTrustIXmlSerialzableNoPublicConstructor", new object[] { DataContract.GetClrTypeFullName(base.UnderlyingType) }), securityException)); } return(true); }
internal bool RequiresMemberAccessForSet() { System.Reflection.MemberInfo memberInfo = this.MemberInfo; FieldInfo field = memberInfo as FieldInfo; if (field != null) { return(DataContract.FieldRequiresMemberAccess(field)); } PropertyInfo info3 = (PropertyInfo)memberInfo; MethodInfo setMethod = info3.GetSetMethod(true); if (setMethod == null) { return(false); } if (!DataContract.MethodRequiresMemberAccess(setMethod)) { return(!DataContract.IsTypeVisible(info3.PropertyType)); } return(true); }
/// <SecurityNote> /// Review - checks member visibility to calculate if access to it requires MemberAccessPermission for deserialization. /// since this information is used to determine whether to give the generated code access /// permissions to private members, any changes to the logic should be reviewed. /// </SecurityNote> internal bool RequiresMemberAccessForSet(string[] serializationAssemblyPatterns) { MemberInfo memberInfo = MemberInfo; FieldInfo field = memberInfo as FieldInfo; if (field != null) { return(DataContract.FieldRequiresMemberAccess(field, serializationAssemblyPatterns)); } else { PropertyInfo property = (PropertyInfo)memberInfo; MethodInfo setMethod = property.SetMethod; if (setMethod != null) { return(DataContract.MethodRequiresMemberAccess(setMethod, serializationAssemblyPatterns) || !DataContract.IsTypeVisible(property.PropertyType, serializationAssemblyPatterns)); } } return(false); }