1

Closed

Members property of SqlAzManApplicationGroup is not functioning

description

Andrea,
My unit tests caught the following bug in "Members" property of SqlAzManApplicationGroup. It's only in version 3.6.0.10. I noticed that you have made some changes to this property but I couldn't figure out why.
Because "this.members" variable is now initialized in the constructor, so the following if statement is always false:
if (this.members == null && this.GroupType == GroupType.Basic)
{
//// MOD: Dictionary creation moved from here fto constructor to handle LDAP Group correctly.
//// OLD: this.members = new Dictionary<IAzManSid, IAzManApplicationGroupMember>();
foreach (IAzManApplicationGroupMember m in this.GetApplicationGroupAllMembers())
{
this.members.Add(m.SID, m);
}
}
Therefor, "Members" property will always return an empty collection. Even if somehow "this.members" is set to null before coming into the function, an exception will be thrown at this.members.Add.

I can't figure out why the change was made, so I can't fix it. Also, I don't know if we had similar changes in other properties.


Richard

No files are attached

Closed Feb 2 at 3:26 AM by tangrl

comments

wrote Feb 2 at 3:26 AM

Resolved with changeset 73900.

tangrl wrote Jan 31 at 4:00 PM

I don't have ADAM installed so I can't test it. But I guess "members" is assigned a empty dictionary in the constructor just for UI purpose. So the fix should be:

In the constructor:

if(this.groupType != GroupType.Basic)
{
this.members = new Dictionary<IAzManSid, IAzManApplicationGroupMember>();
}

Then restore the "Members" property to the previous version:

public Dictionary<IAzManSid, IAzManApplicationGroupMember> Members
{
get
{
if (this.members == null)
{
this.members = new Dictionary<IAzManSid, IAzManApplicationGroupMember>();
foreach (IAzManApplicationGroupMember m in this.GetApplicationGroupAllMembers())
{
this.members.Add(m.SID, m);
}
}
return this.members;
}
}

The fix also applies to SqlAzManStoreGroup. Right now if you are using StorageCache and referencing the "Members" properties, you always get a empty dictionary.

Please let me know if my fix looks OK. I'll check in the code ASAP.

Richard

aferende wrote Jan 31 at 6:10 AM

This is the reason:
http://netsqlazman.codeplex.com/workitem/9775