Skip to content

Commit ce11aaa

Browse files
authored
Fix returning properties from NpgsqlConnectionStringBuilder.GetProperties (#6290)
Fixes #6289
1 parent c3cf9f9 commit ce11aaa

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/Npgsql/NpgsqlConnectionStringBuilder.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,9 +1673,22 @@ protected override void GetProperties(Hashtable propertyDescriptors)
16731673
foreach (var value in propertyDescriptors.Values)
16741674
{
16751675
var d = (PropertyDescriptor)value;
1676+
var isConnectionStringProperty = false;
1677+
var isObsolete = false;
16761678
foreach (var attribute in d.Attributes)
1677-
if (attribute is NpgsqlConnectionStringPropertyAttribute or ObsoleteAttribute)
1678-
toRemove.Add(d);
1679+
{
1680+
if (attribute is NpgsqlConnectionStringPropertyAttribute)
1681+
{
1682+
isConnectionStringProperty = true;
1683+
}
1684+
else if (attribute is ObsoleteAttribute)
1685+
{
1686+
isObsolete = true;
1687+
}
1688+
}
1689+
1690+
if (!isConnectionStringProperty || isObsolete)
1691+
toRemove.Add(d);
16791692
}
16801693

16811694
foreach (var o in toRemove)

0 commit comments

Comments
 (0)