Skip to content

[macOS] CVDisplayLink unavailable crash (on app start) #14927

@ltetak

Description

@ltetak

Describe the bug

We have a pretty significant amount of logs from the production environment with a stack trace suggesting the app failed to initialize CVDisplayLink

   at Avalonia.Native.Interop.Impl.__MicroComIAvnPlatformRenderTimerProxy.RegisterTick(IAvnActionCallback callback)
   at Avalonia.Native.AvaloniaNativeRenderTimer.add_Tick(Action`1 value)
   at Avalonia.Rendering.ThreadProxyRenderTimer.add_Tick(Action`1 value)
   at Avalonia.Rendering.RenderLoop.Add(IRenderLoopTask i)
   at Avalonia.Rendering.Composition.Server.ServerCompositor..ctor(IRenderLoop renderLoop, IPlatformGraphics platformGraphics, BatchStreamObjectPool`1 batchObjectPool, BatchStreamMemoryPool batchMemoryPool)
   at Avalonia.Rendering.Composition.Compositor..ctor(IRenderLoop loop, IPlatformGraphics gpu, Boolean useUiThreadForSynchronousCommits, ICompositorScheduler scheduler, Boolean reclaimBuffersImmediately, Dispatcher dispatcher)
   at Avalonia.Rendering.Composition.Compositor..ctor(IRenderLoop loop, IPlatformGraphics gpu, Boolean useUiThreadForSynchronousCommits)
   at Avalonia.Rendering.Composition.Compositor..ctor(IPlatformGraphics gpu, Boolean useUiThreadForSynchronousCommits)
   at Avalonia.Native.AvaloniaNativePlatform.DoInitialize(AvaloniaNativePlatformOptions options)
   at Avalonia.Native.AvaloniaNativePlatform.Initialize(IntPtr factory, AvaloniaNativePlatformOptions options)
   at Avalonia.Native.AvaloniaNativePlatform.Initialize(AvaloniaNativePlatformOptions options)
   at Avalonia.AvaloniaNativePlatformExtensions.<>c__DisplayClass0_0.<UseAvaloniaNative>b__0()
   at Avalonia.AppBuilder.SetupUnsafe()
   at Avalonia.AppBuilder.Setup()
   at Avalonia.AppBuilder.SetupWithLifetime(IApplicationLifetime lifetime)
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, ShutdownMode shutdownMode)

I would assume something happened and the CVDisplayLink callback mechanism failed to initialize.
cc: @maxkatz6

To Reproduce

I can't repro it but I would guess disconnecting monitor before starting the app would do the trick.

Expected behavior

fallback to standard timer?

Avalonia version

11.0.7

OS

macOS

Additional context

#12652

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions