mingyaulee / Blazor.BrowserExtension

Build browser extensions easily with Blazor.
https://mingyaulee.github.io/Blazor.BrowserExtension/
MIT License
371 stars 41 forks source link

[Request] BackgroundWorker main method supported translations. #151

Open Telavian opened 3 months ago

Telavian commented 3 months ago

If I have a Console.WriteLine or Logger.LogInformation in the BackgroundWorker.Main method then the build will always fail.

For instance, this will work

    [BackgroundWorkerMain]
    public override void Main()
    {
        //Logger.LogInformation("Initializing extension");
        WebExtensions.Runtime.OnInstalled.AddListener(OnInstalled);              
    } 

This will fail

    [BackgroundWorkerMain]
    public override void Main()
    {
        Logger.LogInformation("Initializing extension");
        WebExtensions.Runtime.OnInstalled.AddListener(OnInstalled);              
    } 
mingyaulee commented 3 months ago

Yes at the moment logging is not translated to JS yet. The initial support for translating C# to JS only allows calling to extension APIs and declaring constant variables.

I am renaming this issue so that we can continue to use it as a tracker for all the requests for new translation supports like this.

mingyaulee commented 2 months ago

Logging methods translation is now supported in v1.5.1