[BUG] CCDocGen generates invalid documentation when using ContractArgumentValidator attibute

Unanswered [BUG] CCDocGen generates invalid documentation when using ContractArgumentValidator attibute

  • 14 April 2012 0:12
     
      Memiliki Kode

    When I use ContractArgumentValidator attribute, CCDocGen generates invalid documentation: it using argument name from method which marked with ContractArgumentValidator, no from method which using contract.

    Example:

    public class Sample {

    // <requires exception="T:System.ArgumentNullException">argument != null</requires>
    // <exception cref="T:System.ArgumentNullException">argument == null</exception>
    public void Method(string str)

    { SampleHelper.NotNull(str, "str"); } } public static class SampleHelper { public static void NotNull<T>(T argument, string name) where T : class { if (argument == null) { throw new ArgumentNullException(name); } } }


    In example, CCDocGen generated documentation with argument, not obj.

Semua Balasan

  • 16 April 2012 1:48
    Pemilik
     
     

    Yes, I can see where that is a problem. But currently we don't inline the contracts into the calling method, so the contracts are going to appear as they from the validator method. There is the same problem with inherited contracts: the message they display has to do with the parameters on the method that defines the contracts. If the inheriting method has different parameter names, then the message may be misleading.

    I've added this to the list of CCDoc features to work on.


    Mike Barnett