This project is read-only.

Several issues for extension methods when the 'this' parameter is of type Object


When an extension method's first parameter (the 'this' parameter) is of type Object, several very weird problems occur :
  • The method doesn't appear in the member list of the class in which it's declared (except if it's overloaded ; more on that later)
  • It is listed as a member of ALL enums, as if it were an enum value
  • It appears in the "Extension methods" section of the member list for all non-static types (which is OK), but the link leads to a completely unrelated page (the main page of an enum type, so it's probably related to the previous issue)
    The problem is slightly different when the method has several overloads :
  • It appears in the member list of the class in which it is declared (which is OK, but it isn't the case when the method is not overloaded)
  • The links on the overloads page lead to a completely unrelated page (the main page of an enum type)
  • It appears in the "Extension methods" section of the member list for ALL types (even static classes)
    I attached a CHM file to illustrate the problem (look at the methods in the Developpez.Dotnet.CoreExtensions class). It's in French, but the actual content isn't relevant for this issue, so it shouldn't be a problem. The issue is the same for all formats (HTML, MS Help, CHM)

file attachments


tom103 wrote Jul 5, 2010 at 3:39 PM

Did anyone else encounter this issue ?

Here's some additional information that could help to find the cause :

It happens only when the type of the 'this' parameter is Object, NOT when it is a generic type parameter.

So, for instance, the problem will occur for this method :

public static void MethodA(this object obj)

But not for this one :

public static void MethodB<T>(this T obj)

EWoodruff wrote Jul 5, 2010 at 8:43 PM

Yes, I've seen it too. I haven't had a chance to see if it's something that can be fixed in the transformations yet.

ddpommes wrote Jul 13, 2010 at 10:16 AM

I have the same problem.

Additionally I would like the generic extension methods to appear as extension methods in the generated help file.
Currently all methods like
public static IEnumerable<T> DoSomething<T>(this T obj) {}
do not appear in the documentation.

wrote Jul 13, 2010 at 10:16 AM

wrote Nov 21, 2010 at 10:57 PM

wrote Nov 25, 2010 at 4:11 PM

wrote Mar 22, 2011 at 1:29 PM

tom103 wrote Jun 2, 2011 at 1:20 AM

Any news on this bug? Is there a new release planned soon? The last one is almost 1 year old...

wrote Oct 3, 2011 at 7:33 AM

kbeckett wrote Oct 3, 2011 at 7:35 AM

First-time Sandcastle user, but ran smack into this bug. Sure looks real nasty having extension methods polluting all enums!!

wrote Nov 23, 2011 at 9:45 AM

tom103 wrote Jan 18, 2012 at 4:46 PM

The fix for this issue is described here:

kbeckett wrote Jan 18, 2012 at 5:59 PM

Wow - thanks for pursuing this fix, tom103!
  • Only took 19 months to get a workaround for a nasty bug.
  • We learned that the issue tracker is basically ignored, and you have to post in the forums if you want any response.
  • Somebody stepped up with a simple fix after questioning why you would want to do such a thing (that kind of crap always annoys me - there are many of us doing this, and for good reason).
  • The fix is only a couple of lines, but is presented as a workaround requiring a custom build.
  • There is apparently no interest in just putting this simple fix into the product, so that countless others do not have to suffer like we did.
I think it's safe at this point to officially declare Sandcastle a DEAD project.
Yet another example of why open source doesn't work very well, with a handful of exceptions...
Of course, there are plenty of commercial projects that don't work very well either, but that's another story ;-)

wrote Feb 22, 2013 at 1:39 AM