WikiClientLibrary icon indicating copy to clipboard operation
WikiClientLibrary copied to clipboard

WikiPage constructor hangs

Open rwv37 opened this issue 3 years ago • 2 comments

I have the following class:

internal class WantedPage : WikiPage
{
    internal WantedPage(WikiPage wikiPage) : base(wikiPage.Site, wikiPage.Title)
    {
    }
}

It (and other classes like it) have been working fine for me for a while now, but I just found a problem where my program hangs, apparently during the call to the base constructor.

Specifically, I received (from the QueryPageGenerator for Wantedpages) a WikiPage object with the title WP:Namespace. One thing that I think might be important to note at this point: I previously added an interwiki to my site to direct "WP:xxxx" to (wikipedia)/WP:xxxx".

Anyway, I fed that WikiPage to my WantedPage classes constructor, and it seems to hang there indefinitely: If I stick this...

Log.Error($"Made wanted page {this.Title} from wiki page {wikiPage.Title}!");

... inside of the body of the constructor, the log message never happens (for WP:Namespace; it does happen for all titles I've encountered).

Now that I've figured out that this is apparently where my program is hanging, I'll be able to work around it without much trouble, but I wanted to report the bug anyway.

rwv37 avatar Feb 08 '22 22:02 rwv37

Please do not inherit from WikiPage class. This class is not intended to be derived unless you know what you are doing.

Also, this class does not take care of Special pages. Please use QueryPageGenerator.EnumItemsAsync if you want to query for WantedPages.

CXuesong avatar Feb 12 '22 07:02 CXuesong

I'm not sure that I understand your comment about special pages. Like I said: "I received (from the QueryPageGenerator for Wantedpages) a WikiPage object with the title WP:Namespace".

The problem occurred when I then passed that WikiPage object (call it "wp" for the sake of example) to (essentially) new WikiPage(wp.site, wp.title).

rwv37 avatar Feb 12 '22 18:02 rwv37