@@ -654,6 +654,8 @@ public static ModalInfo BuildModalInfo(Type modalType, InteractionService intera
654654
655655 private static void BuildTextInputComponent ( TextInputComponentBuilder builder , PropertyInfo propertyInfo , object defaultValue )
656656 {
657+ EnsurePubliclySettable ( propertyInfo ) ;
658+
657659 var attributes = propertyInfo . GetCustomAttributes ( ) ;
658660
659661 builder . Label = propertyInfo . Name ;
@@ -690,6 +692,8 @@ private static void BuildTextInputComponent(TextInputComponentBuilder builder, P
690692
691693 private static void BuildSelectMenuComponent ( SelectMenuComponentBuilder builder , PropertyInfo propertyInfo , object defaultValue )
692694 {
695+ EnsurePubliclySettable ( propertyInfo ) ;
696+
693697 var attributes = propertyInfo . GetCustomAttributes ( ) ;
694698
695699 builder . Label = propertyInfo . Name ;
@@ -742,6 +746,8 @@ private static void BuildSnowflakeSelectComponent<TInfo, TBuilder>(SnowflakeSele
742746 where TInfo : SnowflakeSelectComponentInfo
743747 where TBuilder : SnowflakeSelectComponentBuilder < TInfo , TBuilder >
744748 {
749+ EnsurePubliclySettable ( propertyInfo ) ;
750+
745751 var attributes = propertyInfo . GetCustomAttributes ( ) ;
746752
747753 builder . Label = propertyInfo . Name ;
@@ -767,6 +773,9 @@ private static void BuildSnowflakeSelectComponent<TInfo, TBuilder>(SnowflakeSele
767773 builder . Label = inputLabel . Label ;
768774 builder . Description = inputLabel . Description ;
769775 break ;
776+ case ChannelTypesAttribute channelTypes when builder is ChannelSelectComponentBuilder channelSelectBuilder :
777+ channelSelectBuilder . WithChannelTypes ( channelTypes . ChannelTypes ) ;
778+ break ;
770779 default :
771780 builder . WithAttributes ( attribute ) ;
772781 break ;
@@ -776,6 +785,8 @@ private static void BuildSnowflakeSelectComponent<TInfo, TBuilder>(SnowflakeSele
776785
777786 private static void BuildFileUploadComponent ( FileUploadComponentBuilder builder , PropertyInfo propertyInfo , object defaultValue )
778787 {
788+ EnsurePubliclySettable ( propertyInfo ) ;
789+
779790 var attributes = propertyInfo . GetCustomAttributes ( ) ;
780791
781792 builder . Label = propertyInfo . Name ;
@@ -882,9 +893,18 @@ private static bool IsValidModalCommandDefinition(MethodInfo methodInfo)
882893
883894 private static bool IsValidModalComponentDefinition ( PropertyInfo propertyInfo )
884895 {
885- return propertyInfo . SetMethod ? . IsPublic == true &&
886- propertyInfo . SetMethod ? . IsStatic == false &&
887- propertyInfo . IsDefined ( typeof ( ModalComponentAttribute ) ) ;
896+ return propertyInfo . IsDefined ( typeof ( ModalComponentAttribute ) ) ;
897+ }
898+
899+ private static bool IsPubliclySettable ( PropertyInfo propertyInfo )
900+ {
901+ return propertyInfo . SetMethod is { IsPublic : true , IsStatic : false } ;
902+ }
903+
904+ private static void EnsurePubliclySettable ( PropertyInfo propertyInfo )
905+ {
906+ if ( ! IsPubliclySettable ( propertyInfo ) )
907+ throw new InvalidOperationException ( $ "The property { propertyInfo . Name } must be publicly settable.") ;
888908 }
889909
890910 private static ConstructorInfo GetComplexParameterConstructor ( TypeInfo typeInfo , ComplexParameterAttribute complexParameter )
0 commit comments