Skip to content

Publish AOT site initialization issues #126

Description

@hovrawl

Hey mate,

I have attempted to publish my application as AOT and while I understand this library may not be optimized for it I wanted to bring to attention my error when trying to utilise your client.
I have noticed the issue #38 which denotes a site redirect; this is the error message I was redirected to from your error message which I understand may not be entirely accurate anymore given we are in AOT publish mode.

A snippet of the code I used:

const string ApiEndpoint = "https://anothereden.wiki/api.php";
const string UserAgent = "AnotherToolbox/1.0 (Hovrawl)";

  var client = new WikiClient()
        {
            ClientUserAgent = UserAgent,
            Logger = _logger,
        };
        
        // You can create multiple WikiSite instances on the same WikiClient to share the state.
        var site = new WikiSite(client, ApiEndpoint)
        {
            Logger = _logger
        };
        
        // Wait for initialization to complete.
        // Throws error if any.
        await site.Initialization;

And this is the event trace:

Application: AnotherToolBox.exe
CoreCLR Version: 10.0.3
Description: The process was terminated due to an unhandled exception.
Exception Info: WikiClientLibrary.UnexpectedDataException: Stream content starts with '<'. This usually indicates the server response is HTML rather than JSON. See https://github.com/CXuesong/WikiClientLibrary/wiki/Troubleshooting for more information.
   at WikiClientLibrary.Infrastructures.MediaWikiHelper.<ParseJsonAsync>d__9.MoveNext() + 0x803
--- End of stack trace from previous location ---
   at WikiClientLibrary.Client.MediaWikiJsonResponseParser.<ParseResponseAsync>d__3.MoveNext() + 0x21c
--- End of stack trace from previous location ---
   at WikiClientLibrary.Client.MediaWikiJsonResponseParser.<ParseResponseAsync>d__3.MoveNext() + 0x3a4
--- End of stack trace from previous location ---
   at WikiClientLibrary.Client.WikiResponseMessageParser`1.<WikiClientLibrary-Client-IWikiResponseMessageParser<T>-ParseResponseAsync>d__1.MoveNext() + 0x5c
--- End of stack trace from previous location ---
   at WikiClientLibrary.Client.WikiClient.<SendAsync>d__35`1.MoveNext() + 0x119c
--- End of stack trace from previous location ---
   at WikiClientLibrary.Client.WikiClient.<SendAsync>d__35`1.MoveNext() + 0x150a
--- End of stack trace from previous location ---
   at WikiClientLibrary.Client.WikiClient.<InvokeAsync>d__32`1.MoveNext() + 0xac
--- End of stack trace from previous location ---
   at WikiClientLibrary.Sites.WikiSite.<InvokeMediaWikiApiAsync>d__48`1.MoveNext() + 0x586
--- End of stack trace from previous location ---
   at WikiClientLibrary.Sites.WikiSite.<RefreshSiteInfoAsync>d__19.MoveNext() + 0xc1
--- End of stack trace from previous location ---
   at WikiClientLibrary.Sites.WikiSite.<>c__DisplayClass18_0.<<-ctor>g__InitializeAsync|1>d.MoveNext() + 0xaf
--- End of stack trace from previous location ---
   at AnotherToolBox.Services.WikiService.<Setup>d__11.MoveNext() + 0x53
--- End of stack trace from previous location ---
   at AnotherToolBox.ViewModels.MainWindowViewModel.<InitializeWiki>d__4.MoveNext() + 0x50
--- End of stack trace from previous location ---
   at AnotherToolBox.Views.MainWindow.<OnOpened>d__3.MoveNext() + 0x10b
--- End of stack trace from previous location ---
   at System.Threading.Tasks.Task.<>c.<ThrowAsync>b__124_0(Object state) + 0x1a
   at Avalonia.Threading.SendOrPostCallbackDispatcherOperation.InvokeCore() + 0x19a
   at Avalonia.Threading.DispatcherOperation.Execute() + 0x4a
   at Avalonia.Threading.Dispatcher.ExecuteJob(DispatcherOperation) + 0x78
   at Avalonia.Threading.Dispatcher.ExecuteJobsCore(Boolean) + 0x387
   at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) + 0x58
   at AnotherToolBox!<BaseAddress>+0xc3fe5a

If it is not something you are interested in supporting as its AOT that is fine, just wanting to help the discussion and use cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions