Skip to content

[BUG] WKWebView URL not loaded when called from MainThreadScheduler #2947

Open
@vincentSerrano

Description

@vincentSerrano

Describe the bug

Hello !

I've got a desktop app (Windows and MacOS) using ReactiveUI
The scenario I'm trying to implement:
Display a modal Window (which display a WebBrowser / WKWebView) when my business logic fails.

  • Everything work as expected with WebBrowser on Windows.
  • But on MacOS, I've got an issue: My WKWebView doesn't seems to load URL: My Window is displayed, but it stays black.

Does anyone can see what's going wrong with my implementation ?

Thanks in advance !

Implementation details:

public static void ReproduceIssue()
        {
            Observable.FromAsync(DoBusinessLogic).
                ObserveOn(RxApp.MainThreadScheduler).
                Subscribe(
                    _ => { },
                    OnBusinessLogicFailed,
                    () => { });
        }
...
private static void OnBusinessLogicFailed(Exception e)
        {
            var nSWindowController = CreateWindow();
            _ = NSApplication.SharedApplication.RunModalForWindow(nSWindowController.Window);
            nSWindowController.Close();
        }

Steps To Reproduce

Repo: https://github.com/vincentSerrano/RuiWebKitViewIssue

Expected behaviour

I expect the WebKitView to display the URL content.
Screenshots

RuiIssueRepro

Environment

  • OS: macOS
  • Version 11.5.2 (20G95)
  • Device: MacBookPro16,1
  • ReactiveUI Version: 16.2.6

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions