You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Getting null reference exception at startup in Window constructor on Windows Server Core 2016. Based on call stack it could not initialialize TaskBarList, probably because Server Core does not have a task bar.
Same application runs using AvaloniaUI version 11.0.10.
To Reproduce
Create a new avalonia app
Run it in a Windows Server Core 2016 OS (probably any Server Core OS, but tested only with 2016)
Expected behavior
App not crashing at startup and main window shows
Avalonia version
11.1.0-beta2
OS
Windows
Additional context
Call stack:
System.NullReferenceException: Object reference not set to an instance of an object.
at Avalonia.Win32.Interop.TaskBarList.Init()
at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func'1 valueFactory)
at System.Threading.LazyInitializer.EnsureInitialized[T](T& target, Boolean& initialized, Object& syncLock, Func'1 valueFactory)
at Avalonia.Win32.Interop.TaskBarList.LazyInit()
at Avalonia.Win32.Interop.TaskBarList.SetOverlayIcon(IntPtr hwnd, IntPtr hIcon, String description)
at Avalonia.Win32.WindowImpl.RefreshIcon()
at Avalonia.Win32.WindowImpl.SetIcon(IWindowIconImpl icon)
at Avalonia.Controls.Window.<.ctor>b__31_2(WindowIcon icon)
at Avalonia.Controls.TopLevel.<>c__DisplayClass72_0'1.g__UpdatePlatformImpl|0()
at Avalonia.Controls.TopLevel.CreatePlatformImplBinding[TValue](StyledProperty'1 property, Action'1 onValue)
at Avalonia.Controls.Window..ctor(IWindowImpl impl)
at Avalonia.Controls.Window..ctor()
at Project1.MainWindow..ctor() in D:\Development\Repos\Project1\Project1\MainWindow.axaml.cs:line 7
at Project1.App.OnFrameworkInitializationCompleted() in D:\Development\Repos\Project1\Project1\App.axaml.cs:line 18
at Avalonia.AppBuilder.SetupUnsafe()
at Avalonia.AppBuilder.Setup()
at Avalonia.AppBuilder.SetupWithLifetime(IApplicationLifetime lifetime)
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, Action'1 lifetimeBuilder)
at Project1.Program.Main(String[] args) in D:\Development\Repos\Project1\Project1\Program.cs:line 21
The text was updated successfully, but these errors were encountered:
Well Windows Core does not have a taskbar (or a traditional Windows desktop). So it's not surprising it can't query the task bar info. I imagine it should just return a 0 ptr if it can't query the taskbar, as the code seems to already handle that.
Describe the bug
Getting null reference exception at startup in Window constructor on Windows Server Core 2016. Based on call stack it could not initialialize TaskBarList, probably because Server Core does not have a task bar.
Same application runs using AvaloniaUI version 11.0.10.
To Reproduce
Expected behavior
App not crashing at startup and main window shows
Avalonia version
11.1.0-beta2
OS
Windows
Additional context
Call stack:
System.NullReferenceException: Object reference not set to an instance of an object.
at Avalonia.Win32.Interop.TaskBarList.Init()
at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Boolean& initialized, Object& syncLock, Func'1 valueFactory)
at System.Threading.LazyInitializer.EnsureInitialized[T](T& target, Boolean& initialized, Object& syncLock, Func'1 valueFactory)
at Avalonia.Win32.Interop.TaskBarList.LazyInit()
at Avalonia.Win32.Interop.TaskBarList.SetOverlayIcon(IntPtr hwnd, IntPtr hIcon, String description)
at Avalonia.Win32.WindowImpl.RefreshIcon()
at Avalonia.Win32.WindowImpl.SetIcon(IWindowIconImpl icon)
at Avalonia.Controls.Window.<.ctor>b__31_2(WindowIcon icon)
at Avalonia.Controls.TopLevel.<>c__DisplayClass72_0'1.g__UpdatePlatformImpl|0()
at Avalonia.Controls.TopLevel.CreatePlatformImplBinding[TValue](StyledProperty'1 property, Action'1 onValue)
at Avalonia.Controls.Window..ctor(IWindowImpl impl)
at Avalonia.Controls.Window..ctor()
at Project1.MainWindow..ctor() in D:\Development\Repos\Project1\Project1\MainWindow.axaml.cs:line 7
at Project1.App.OnFrameworkInitializationCompleted() in D:\Development\Repos\Project1\Project1\App.axaml.cs:line 18
at Avalonia.AppBuilder.SetupUnsafe()
at Avalonia.AppBuilder.Setup()
at Avalonia.AppBuilder.SetupWithLifetime(IApplicationLifetime lifetime)
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, Action'1 lifetimeBuilder)
at Project1.Program.Main(String[] args) in D:\Development\Repos\Project1\Project1\Program.cs:line 21
The text was updated successfully, but these errors were encountered: