kikipoulet/SukiUI

[Bug] JetBrains Rider cannot preview SukiWindow

Closed this issue · 7 comments

Check the following items

  • I have looked up relevant Issue

Description of the issue

rt, when I look at the preview window after building, a white window is displayed first, and then the following error appears:

"C:\Program Files\dotnet\dotnet.exe" exec --runtimeconfig D:\Code\CSharp\Test\Test\bin\Debug\net8.0\Test.runtimeconfig.json --depsfile D:\Code\CSharp\Test\Test\bin\Debug\net8.0\Test.deps.json D:\NuGet\packages\avalonia\11.2.0-beta1\buildTransitive\..\tools\netstandard2.0\designer\Avalonia.Designer.HostApp.dll --transport tcp-bson://127.0.0.1:3972/ --method avalonia-remote D:\Code\CSharp\Test\Test\bin\Debug\net8.0\Test.dll
Initializing application in design mode
Obtaining AppBuilder instance from Test.Program
Sending StartDesignerSessionMessage
Fatal error. System.Runtime.InteropServices.SEHException (0x80004005): External component has thrown an exception.
Repeat 2 times:
--------------------------------
   at SkiaSharp.SkiaApi.sk_canvas_draw_rect(IntPtr, SkiaSharp.SKRect*, IntPtr)
--------------------------------
   at SkiaSharp.SKCanvas.DrawRect(SkiaSharp.SKRect, SkiaSharp.SKPaint)
   at SukiUI.Utilities.Effects.EffectBackgroundDraw.Render(SkiaSharp.SKCanvas, SkiaSharp.SKRect)
   at SukiUI.Utilities.Effects.EffectDrawBase.Render(Avalonia.Media.ImmediateDrawingContext)
   at Avalonia.Rendering.Composition.Drawing.Nodes.RenderDataCustomNode.Invoke(Avalonia.Rendering.Composition.Drawing.Nodes.RenderDataNodeRenderContext ByRef)
   at Avalonia.Rendering.Composition.Drawing.ServerCompositionRenderData.Render(Avalonia.Platform.IDrawingContextImpl)
   at Avalonia.Rendering.Composition.Server.ServerCompositionDrawListVisual.RenderCore(Avalonia.Rendering.Composition.Server.ServerVisualRenderContext, Avalonia.Platform.LtrbRect)
   at Avalonia.Rendering.Composition.Server.ServerCompositionVisual.Render(Avalonia.Rendering.Composition.Server.ServerVisualRenderContext, System.Nullable`1<Avalonia.Platform.LtrbRect>)
   at Avalonia.Rendering.Composition.Server.ServerCompositionContainerVisual.RenderCore(Avalonia.Rendering.Composition.Server.ServerVisualRenderContext, Avalonia.Platform.LtrbRect)
   at Avalonia.Rendering.Composition.Server.ServerCompositionDrawListVisual.RenderCore(Avalonia.Rendering.Composition.Server.ServerVisualRenderContext, Avalonia.Platform.LtrbRect)
   at Avalonia.Rendering.Composition.Server.ServerCompositionVisual.Render(Avalonia.Rendering.Composition.Server.ServerVisualRenderContext, System.Nullable`1<Avalonia.Platform.LtrbRect>)
   at Avalonia.Rendering.Composition.Server.ServerCompositionContainerVisual.RenderCore(Avalonia.Rendering.Composition.Server.ServerVisualRenderContext, Avalonia.Platform.LtrbRect)
   at Avalonia.Rendering.Composition.Server.ServerCompositionDrawListVisual.RenderCore(Avalonia.Rendering.Composition.Server.ServerVisualRenderContext, Avalonia.Platform.LtrbRect)
   at Avalonia.Rendering.Composition.Server.ServerCompositionVisual.Render(Avalonia.Rendering.Composition.Server.ServerVisualRenderContext, System.Nullable`1<Avalonia.Platform.LtrbRect>)
   at Avalonia.Rendering.Composition.Server.ServerCompositionContainerVisual.RenderCore(Avalonia.Rendering.Composition.Server.ServerVisualRenderContext, Avalonia.Platform.LtrbRect)
   at Avalonia.Rendering.Composition.Server.ServerCompositionDrawListVisual.RenderCore(Avalonia.Rendering.Composition.Server.ServerVisualRenderContext, Avalonia.Platform.LtrbRect)
   at Avalonia.Controls.CompositionBorderVisual+ServerBorderVisual.RenderCore(Avalonia.Rendering.Composition.Server.ServerVisualRenderContext, Avalonia.Platform.LtrbRect)
   at Avalonia.Rendering.Composition.Server.ServerCompositionVisual.Render(Avalonia.Rendering.Composition.Server.ServerVisualRenderContext, System.Nullable`1<Avalonia.Platform.LtrbRect>)
   at Avalonia.Rendering.Composition.Server.ServerCompositionContainerVisual.RenderCore(Avalonia.Rendering.Composition.Server.ServerVisualRenderContext, Avalonia.Platform.LtrbRect)
   at Avalonia.Rendering.Composition.Server.ServerCompositionDrawListVisual.RenderCore(Avalonia.Rendering.Composition.Server.ServerVisualRenderContext, Avalonia.Platform.LtrbRect)
   at Avalonia.Rendering.Composition.Server.ServerCompositionVisual.Render(Avalonia.Rendering.Composition.Server.ServerVisualRenderContext, System.Nullable`1<Avalonia.Platform.LtrbRect>)
   at Avalonia.Rendering.Composition.Server.ServerCompositionTarget.RenderRootToContextWithClip(Avalonia.Platform.IDrawingContextImpl, Avalonia.Rendering.Composition.Server.ServerCompositionVisual)
   at Avalonia.Rendering.Composition.Server.ServerCompositionTarget.Render()
   at Avalonia.Rendering.Composition.Server.ServerCompositor.RenderCore(Boolean)
   at Avalonia.Rendering.Composition.Server.ServerCompositor.RenderReentrancySafe(Boolean)
   at Avalonia.Rendering.Composition.Server.ServerCompositor.Render(Boolean)
   at Avalonia.Media.MediaContext.SyncCommit(Avalonia.Rendering.Composition.Compositor, Boolean, Boolean)
   at Avalonia.Media.MediaContext.ImmediateRenderRequested(Avalonia.Rendering.Composition.CompositionTarget, Boolean)
   at Avalonia.Rendering.Composition.CompositingRenderer.Paint(Avalonia.Rect, Boolean)
   at Avalonia.Rendering.Composition.CompositingRenderer.Paint(Avalonia.Rect)
   at Avalonia.Controls.TopLevel.HandlePaint(Avalonia.Rect)
   at Avalonia.Controls.Remote.Server.RemoteServerTopLevelImpl.RenderAndSendFrameIfNeeded()
   at Avalonia.DesignerSupport.Remote.PreviewerWindowImpl.Resize(Avalonia.Size, Avalonia.Controls.WindowResizeReason)
   at Avalonia.Controls.Window.ArrangeSetBounds(Avalonia.Size)
   at Avalonia.Controls.WindowBase.ArrangeCore(Avalonia.Rect)
   at Avalonia.Layout.Layoutable.Arrange(Avalonia.Rect)
   at Avalonia.Layout.LayoutManager.Arrange(Avalonia.Layout.Layoutable)
   at Avalonia.Layout.LayoutManager.Arrange(Avalonia.Layout.Layoutable)
   at Avalonia.Layout.LayoutManager.Arrange(Avalonia.Layout.Layoutable)
   at Avalonia.Layout.LayoutManager.Arrange(Avalonia.Layout.Layoutable)
   at Avalonia.Layout.LayoutManager.Arrange(Avalonia.Layout.Layoutable)
   at Avalonia.Layout.LayoutManager.Arrange(Avalonia.Layout.Layoutable)
   at Avalonia.Layout.LayoutManager.Arrange(Avalonia.Layout.Layoutable)
   at Avalonia.Layout.LayoutManager.Arrange(Avalonia.Layout.Layoutable)
   at Avalonia.Layout.LayoutManager.ExecuteArrangePass()
   at Avalonia.Layout.LayoutManager.InnerLayoutPass()
   at Avalonia.Layout.LayoutManager.ExecuteLayoutPass()
   at Avalonia.Layout.LayoutManager.ExecuteQueuedLayoutPass()
   at Avalonia.Media.MediaContext.FireInvokeOnRenderCallbacks()
   at Avalonia.Media.MediaContext.RenderCore()
   at Avalonia.Media.MediaContext.Render()
   at Avalonia.Threading.DispatcherOperation.InvokeCore()
   at Avalonia.Threading.DispatcherOperation.Execute()
   at Avalonia.Threading.Dispatcher.ExecuteJob(Avalonia.Threading.DispatcherOperation)
   at Avalonia.Threading.Dispatcher.ExecuteJobsCore(Boolean)
   at Avalonia.Threading.Dispatcher.Signaled()
   at Avalonia.Controls.Platform.ManagedDispatcherImpl.RunLoop(System.Threading.CancellationToken)
   at Avalonia.Threading.DispatcherFrame.Run(Avalonia.Threading.IControlledDispatcherImpl)
   at Avalonia.Threading.Dispatcher.PushFrame(Avalonia.Threading.DispatcherFrame)
   at Avalonia.Threading.Dispatcher.MainLoop(System.Threading.CancellationToken)
   at Avalonia.DesignerSupport.Remote.RemoteDesignerEntryPoint.Main(System.String[])
   at Avalonia.Designer.HostApp.Program.Main(System.String[])
Process terminated with exit code -1,073,741,795

Package Version

6.0.0-beta8

Environment

Windows 11 22631

Expected Behavior

SukiWindow can be previewed using Rider IDE

Reproduction

Use Rider IDE, follow the documentation to install SukiUI, and see the preview of MainWindow

Additional Information

No response

This is a limitation of Rider's (already quite flawed) XAML previewer. It never worked particularly well for WPF, subsequently it works even less competently for Avalonia. In this case it's because we use some Skia APIs for rendering and the previewer doesn't seem to support them.

It's not something we're in a position to fix unfortunately, my only advice would be to avoid using the previewers for any SukiWindow.

Just thought I'd quickly follow up, I'd like to know if this happens in VS too - if anyone who has VS set up locally already could just open a SukiWindow in the previewer and let me know I'd be grateful. Rider's AXAML previewer is actually part of a 3rd party plugin so if that's the source of the issue I'd like to chase that up rather than trying to implement workarounds on our end.

I fail on the same code pathway in VS using SukiUI.Demo

image

I just downloaded Visual Studio 2022 Community to try it out and it also doesn't work for SukiWindow
Avalonia=11.2.0-beta1
SukiUI=6.0.0-beta8
image

Excellent. I'll get a minimal repro together and push this up to Avalonia. If this isn't something they can or want to fix then we have some scope to implement workarounds if they're necessary (though I'd rather not) or in the worst case document this issue clearly.

Looks like this is by design and in fact platforms such as web do actually require software rendering fallbacks.

I'll take a look at this tomorrow, hopefully I can put together a gracefull fallback that will allow the previewer to work and open up the opportunity to support web possibly in the future as well as apparently Linux/MacOS VM's which tend to fall back to software rendering.

doesn't work for <sukiUi:SukiSideMenu> <sukiUi:SukiSideMenu.HeaderContent> </sukiUi:SukiSideMenu.HeaderContent> </sukiUi:SukiSideMenu>