Anonymous delegates

Anonymous delegates

I posted a question about this in the 1.5.x forums, but thought it might be better to talk about this in the context of 2.0.2. Any thoughts on if you could accomodate anonymous delegates a bit better?

Thanks.


RE: Anonymous delegates

dmiser,

The NCover team is always looking for ways to improve NCover, and we are willing to consider any feature request for implementation. Improving anonymous delegate presentation is on the list, but right now we are still figuring out how best to improve that presentation, because the ICorProfiler returns exactly what we're showing now with no additional information. By their nature anonymous delegates don't have names, so there isn't anything pithy we can replace the gobdlygook with. So far we've thought of naming them "Anonymous Delegate 1", "Anonymous Delegate 2", etc or just showing the function signature.

Any ideas on presentation? What would you like to see?

Stephen Ward


RE: Anonymous delegates

adding the original post for reference

Hi Grant,

if I execute the following sample method:

public static void Foo() { IDictionary<int, int> dict = new Dictionary<int, int>(); dict.Add(1, 1); dict.Add(2, 2);

List itemsToRemove = new List(); itemsToRemove.Add(1);

itemsToRemove.ForEach(delegate(int id) { dict.Remove(id); }); }

then I see in the tree view of NCoverExplorer two "strange" entries. One is named just "<>" and has a child "b__0". Looking at the line number this is exactly my anonymous delegate.

For me this is a little bit strange, since seeing this in the tree view does not give any hint what it shall be. Possibly NCover gets exactly this information from the ICorProfiler API.

In general shall be anonymous method display as own methods or are they just part of any other method?

I would expect to display this kind of method in a different manner. E.g. use a different icon and/or a special subtree to show that this methods are special.

Ciao, Thomas