It used to be possible to change the name of a generic type parameter
by simply assigning to the Name property (just like it works for
methods, types, etc. too).

In the newest version, however, I get an InvalidOperationException. It
seems that the GenericParameter class is now used both for the generic
parameter definition as well as a reference to it in constructed
generic instance types. It makes sense that the latter cannot be
renamed, but the former certainly should be.

I suspect that fixing this might be simple: change

public override string Name {
    [...]
    set { throw new InvalidOperationException (); }
}

to something like...

public override string Name {
    [...]
    set {
        if (owner is TypeDefinition || owner is MethodDefinition)
            base.Name = value;
        else
            throw new InvalidOperationException ();
    }
}

Will that work or am I missing something?

-- 
--
mono-cecil

Reply via email to