Describe the bug
The NullReferenceException occurs during Window creation
> Avalonia.FreeDesktop.DBusPlatformSettings.TryGetThemeVariantAsync()
Avalonia.FreeDesktop.DBusPlatformSettings.TryGetInitialValuesAsync()
Avalonia.FreeDesktop.DBusPlatformSettings.OnRequestDefaultThemeVariant()
Avalonia.X11.X11Window.SetFrameThemeVariant(themeVariant)
Avalonia.Controls.TopLevel..ctor.AnonymousMethod__43_1(variant)
Avalonia.Controls.TopLevel.CreatePlatformImplBinding.__UpdatePlatformImpl|0()
Avalonia.Controls.TopLevel.CreatePlatformImplBinding<Avalonia.Styling.ThemeVariant>(property, onValue)
Avalonia.Controls.TopLevel.TopLevel(impl, dependencyResolver)
Avalonia.Controls.WindowBase.WindowBase(impl, dependencyResolver)
Avalonia.Controls.WindowBase.WindowBase(impl)
Avalonia.Controls.Window.Window(impl)
Avalonia.Controls.Window.Window()
|
private async Task<PlatformThemeVariant?> TryGetThemeVariantAsync() |
|
{ |
|
try |
|
{ |
|
var version = await _settings!.GetVersionAsync(); |
It happens if the DBusPlatformSettings._settings field is not initialized due to the absence of DBusHelper.DefaultConnection:
|
public DBusPlatformSettings() |
|
{ |
|
if (DBusHelper.DefaultConnection is not { } conn) |
|
return; |
|
|
|
_settings = new Settings(conn, "org.freedesktop.portal.Desktop", "/org/freedesktop/portal/desktop"); |
To Reproduce
Tests in internal CI fail during migration to v12.1.0. Not sure how to reproduce this locally.
Expected behavior
No response
Avalonia version
12.1.0
OS
Linux
Additional context
Probably introduced in #16340
Describe the bug
The NullReferenceException occurs during Window creation
Avalonia/src/Avalonia.FreeDesktop/DBusPlatformSettings.cs
Lines 45 to 49 in efaa926
It happens if the DBusPlatformSettings._settings field is not initialized due to the absence of DBusHelper.DefaultConnection:
Avalonia/src/Avalonia.FreeDesktop/DBusPlatformSettings.cs
Lines 19 to 24 in efaa926
To Reproduce
Tests in internal CI fail during migration to v12.1.0. Not sure how to reproduce this locally.
Expected behavior
No response
Avalonia version
12.1.0
OS
Linux
Additional context
Probably introduced in #16340