I think I’ve found the answer. It’s because if the type attributes
contain IsNestedPublic (or any of the other IsNested*), setting
IsPublic to false doesn’t remove it. Given that setting IsPublic to
true does, I think setting it to false also should. Thus, I suggest to
change:

public static uint SetMaskedAttributes (this uint self, uint mask,
uint attributes, bool value)
{
    if (value) {
        self &= ~mask;
        return self | attributes;
    }
    return self & ~(mask & attributes);
}

to:

public static uint SetMaskedAttributes (this uint self, uint mask,
uint attributes, bool value)
{
    self &= ~mask;
    return value ? (self | attributes) : self;
}

-- 
--
mono-cecil

Reply via email to