Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoke on UI thread with Dispatcher causes PlatformNotSupportedException in StartWithClassicDesktopLifetime #16268

Open
codecat opened this issue Jul 9, 2024 · 0 comments
Labels
bug by-design The behavior reported in the issue is actually correct.

Comments

@codecat
Copy link

codecat commented Jul 9, 2024

Describe the bug

When you try to invoke something on the UI thread before the application has started, it will throw a PlatformNotSupportedException when starting the application. The action is successfully invoked.

To Reproduce

Simply call Dispatcher.UIThread.Invoke before starting the application. Here's example code:

Dispatcher.UIThread.Invoke(() => { });
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args); // PlatformNotSupportedException

Expected behavior

I would expect one of two things to happen:

  • Invoke() should throw before the app has started
  • StartWithClassicDesktopLifetime() should not throw a PlatformNotSupportedException in this case

Avalonia version

11.1.0-rc1

OS

Windows

Additional context

No response

@codecat codecat added the bug label Jul 9, 2024
@maxkatz6 maxkatz6 added the by-design The behavior reported in the issue is actually correct. label Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug by-design The behavior reported in the issue is actually correct.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants