"Compositing" renderer

Goals

separate UWP-like composition visual tree with UI/render thread separation
an efficient transport for sending diffs from UI thread to render thread and reading back the last transformation matrices
integration with Avalonia visuals

As a result, it allows creation of render thread-only animations and less GC pressure.
No, breaking changes in this PR yet, but old deferred and immediate renderers could be removed in 11.0 update.

You can test this PR using the following package version. 0.10.999-cibuild0020294-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0020296-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

Excited to try this out, awesome work!

You can test this PR using the following package version. 0.10.999-cibuild0020323-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

Really excited about this, it already looks like it uses 100MB less RAM (checked with dotMemory), amazing work!

You can test this PR using the following package version. 0.10.999-cibuild0020344-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

I'm gonna be the bad guy here: can we make sure to comment things better? High quality comments really help other developers and they are invaluable if done by the original code author. A lot of core features don't seem to get documented. Things like interfaces really should be commented with no exceptions in my opinion.
Anyway, I help where I can but it would take too much time I think to fully understand and comment this type of code.

@robloo it's currently WIP, so things are in flux and changing. Documentation will be added before merging when it's done.

You can test this PR using the following package version. 0.10.999-cibuild0020355-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0020503-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0020643-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0020666-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0020687-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0020969-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0020979-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0020992-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0021012-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0021134-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

I just tested this PR, and found 2 issues in ControlCatalog.NetCore on Windows 11:

The CC.NetCore window won't appear if I set on UseCompositor = true
The issue 1 can be workarounded by setting UseWgl = true as well, but setting both UseWgl and UseCompositor to true will lead to DPI scaling issue.

I think it's ready for review.

@kekekeks not sure if this is suppose to work with WinUI composition yet.
But two important things I noticed with latest version, using FluentAvaloniaUI control catalog -
All controls appears twice while scrolling -

Memory usage increased by a lot -

Could you share your version of FluentAvaloniaUI compatible with our master branch? The code from the repository doesn't compile.

Could you share your version of FluentAvaloniaUI compatible with our master branch? The code from the repository doesn't compile.

Sure, here it is - https://github.com/adirh3/FluentAvalonia/tree/comp_renderer_test
It's using also different AvaloniaEdit package due to changes in master, it should restore based on that, if not add it to your nuget.config

Could you provide me with the nuget feed you are using for AvaloniaEdit? I've tried removing it and using 0.10.999-cibuild0021317-beta build and I can't see the issues you are describing.

I pushed the package under packages/AvaloniaEdit.0.10.13997-ava-comp.nupkg, did it not restore?
I don't think the AvaloniaEdit changes too much, did you it check on Windows?

Don't works (ControlCatalog):

Acrylic
TransitioningContentControl
ToolTip

Carousel page seems to be borked even with the current master (do slice transition once, switch to crossfade, now some of the images would retain their old render transform).
Fixed acryllic.

Fixed ToolTip page

You can test this PR using the following package version. 0.10.999-cibuild0021325-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0021329-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

On the latest package, the scrolling artifacts issue is fixed, but memory is still around 800mb using Compositor and 300mb when not using it.
I am checking on a 4K display if it somehow matters with 250% DPI.
I also, cloned the branch and checked with Control Catalog, same issue -

Trying to reproduce it again, I got another different crash, this time native:
ControlCatalog.NetCore(11277,0x107e9c600) malloc: *** error for object 0x6000007047a0: pointer being freed was not allocated
ControlCatalog.NetCore(11277,0x107e9c600) malloc: *** set a breakpoint in malloc_error_break to debug
ControlCatalog.NetCore(11277,0x7000043ca000) malloc: *** error for object 0x6000007047a0: pointer being freed was not allocated
ControlCatalog.NetCore(11277,0x7000043ca000) malloc: *** set a breakpoint in malloc_error_break to debug

Another exception that crashes the app:
Unhandled exception. System.InvalidOperationException: Cannot clear while enumerating
   at Avalonia.Rendering.DirtyVisuals.Clear() in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/DirtyVisuals.cs:line 70
   at Avalonia.Rendering.DeferredRenderer.UpdateScene() in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/DeferredRenderer.cs:line 672
   at Avalonia.Rendering.DeferredRenderer.Paint(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/DeferredRenderer.cs:line 222
   at Avalonia.Controls.TopLevel.HandlePaint(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/TopLevel.cs:line 368
   at Avalonia.Native.WindowBaseImpl.WindowBaseEvents.Avalonia.Native.Interop.IAvnWindowBaseEvents.Paint() in /Users/danipen/Projects/Avalonia/src/Avalonia.Native/WindowImplBase.cs:line 202
   at Avalonia.Native.Interop.Impl.__MicroComIAvnWindowBaseEventsVTable.Paint(Void* this) in /Users/danipen/Projects/Avalonia/src/Avalonia.Native/Interop.Generated.cs:line 3783
--- End of stack trace from previous location ---
   at Avalonia.Native.PlatformThreadingInterface.RunLoop(CancellationToken cancellationToken) in /Users/danipen/Projects/Avalonia/src/Avalonia.Native/PlatformThreadingInterface.cs:line 90
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Threading/Dispatcher.cs:line 61
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 120
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 209
   at ControlCatalog.NetCore.Program.Main(String[] args) in /Users/danipen/Projects/Avalonia/samples/ControlCatalog.NetCore/Program.cs:line 101

And another one:
Unhandled exception. System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Cannot add a reference to a nonreferenced item'.
   at Avalonia.Utilities.RefCountable.RefCounter.AddRef() in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Utilities/Ref.cs:line 101
   at Avalonia.Utilities.RefCountable.Ref`1.Clone() in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Utilities/Ref.cs:line 183
   at Avalonia.Rendering.SceneGraph.VisualNode.Clone(IVisualNode parent) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/VisualNode.cs:line 262
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 165
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.Clone(VisualNode source, IVisualNode parent, Dictionary`2 index) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 180
   at Avalonia.Rendering.SceneGraph.Scene.CloneScene() in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/SceneGraph/Scene.cs:line 91
   at Avalonia.Rendering.DeferredRenderer.UpdateScene() in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/DeferredRenderer.cs:line 640
   at Avalonia.Rendering.DeferredRenderer.Paint(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/DeferredRenderer.cs:line 222
   at Avalonia.Controls.TopLevel.HandlePaint(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/TopLevel.cs:line 368
   at Avalonia.Native.WindowBaseImpl.WindowBaseEvents.Avalonia.Native.Interop.IAvnWindowBaseEvents.Paint() in /Users/danipen/Projects/Avalonia/src/Avalonia.Native/WindowImplBase.cs:line 202
   at Avalonia.Native.Interop.Impl.__MicroComIAvnWindowBaseEventsVTable.Paint(Void* this) in /Users/danipen/Projects/Avalonia/src/Avalonia.Native/Interop.Generated.cs:line 3783
--- End of stack trace from previous location ---
   at Avalonia.Native.PlatformThreadingInterface.RunLoop(CancellationToken cancellationToken) in /Users/danipen/Projects/Avalonia/src/Avalonia.Native/PlatformThreadingInterface.cs:line 90
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Threading/Dispatcher.cs:line 61
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 120
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 209
   at ControlCatalog.NetCore.Program.Main(String[] args) in /Users/danipen/Projects/Avalonia/samples/ControlCatalog.NetCore/Program.cs:line 101

A different one. Hope it helps to debug a little bit the implementation:
Unhandled exception. System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
   at System.Collections.Generic.Dictionary`2.FindValue(TKey key)
   at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
   at Avalonia.Rendering.DirtyVisuals.Add(IVisual visual) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/DirtyVisuals.cs:line 42
   at Avalonia.Rendering.DeferredRenderer.AddDirty(IVisual visual) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Rendering/DeferredRenderer.cs:line 121
   at Avalonia.Visual.InvalidateVisual() in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Visual.cs:line 329
   at Avalonia.Visual.<AffectsRender>g__Invalidate|89_0[T](AvaloniaPropertyChangedEventArgs e) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Visual.cs:line 375
   at Avalonia.Visual.<>c__89`1.<AffectsRender>b__89_4(AvaloniaPropertyChangedEventArgs e) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Visual.cs:line 414
   at System.Reactive.Subjects.Subject`1.OnNext(T value) in /_/Rx.NET/Source/src/System.Reactive/Subjects/Subject.cs:line 145
   at Avalonia.AvaloniaProperty`1.NotifyChanged(AvaloniaPropertyChangedEventArgs`1 e) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/AvaloniaProperty`1.cs:line 80
   at Avalonia.AvaloniaObject.RaisePropertyChanged[T](AvaloniaPropertyChangedEventArgs`1 change) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/AvaloniaObject.cs:line 779
   at Avalonia.AvaloniaObject.RaisePropertyChanged[T](AvaloniaProperty`1 property, Optional`1 oldValue, BindingValue`1 newValue, BindingPriority priority) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/AvaloniaObject.cs:line 691
   at Avalonia.AvaloniaObject.SetAndRaise[T](AvaloniaProperty`1 property, T& field, T value) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/AvaloniaObject.cs:line 721
   at Avalonia.Visual.set_Bounds(Rect value) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Visual.cs:line 163
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 715
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Layout.Layoutable.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 737
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Controls.Primitives.Track.ArrangeOverride(Size arrangeSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/Primitives/Track.cs:line 237
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Controls.Grid.ArrangeOverride(Size arrangeSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/Grid.cs:line 557
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Layout.LayoutHelper.ArrangeChildInternal(ILayoutable child, Size availableSize, Thickness padding) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/LayoutHelper.cs:line 74
   at Avalonia.Layout.LayoutHelper.ArrangeChild(ILayoutable child, Size availableSize, Thickness padding, Thickness borderThickness) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/LayoutHelper.cs:line 61
   at Avalonia.Controls.Border.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/Border.cs:line 245
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Controls.Grid.ArrangeOverride(Size arrangeSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/Grid.cs:line 524
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Layout.Layoutable.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 737
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Controls.Grid.ArrangeOverride(Size arrangeSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/Grid.cs:line 557
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Layout.Layoutable.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 737
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Layout.LayoutHelper.ArrangeChildInternal(ILayoutable child, Size availableSize, Thickness padding) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/LayoutHelper.cs:line 74
   at Avalonia.Layout.LayoutHelper.ArrangeChild(ILayoutable child, Size availableSize, Thickness padding, Thickness borderThickness) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/LayoutHelper.cs:line 61
   at Avalonia.Controls.Border.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/Border.cs:line 245
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Controls.DockPanel.ArrangeOverride(Size arrangeSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/DockPanel.cs:line 205
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Controls.Presenters.ContentPresenter.ArrangeOverrideImpl(Size finalSize, Vector offset) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/Presenters/ContentPresenter.cs:line 671
   at Avalonia.Controls.Presenters.ContentPresenter.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/Presenters/ContentPresenter.cs:line 600
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Layout.Layoutable.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 737
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Controls.Grid.ArrangeOverride(Size arrangeSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/Grid.cs:line 557
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Layout.Layoutable.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 737
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Layout.Layoutable.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 737
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Layout.Layoutable.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 737
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Controls.Grid.ArrangeOverride(Size arrangeSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/Grid.cs:line 524
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Controls.Presenters.ContentPresenter.ArrangeOverrideImpl(Size finalSize, Vector offset) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/Presenters/ContentPresenter.cs:line 671
   at Avalonia.Controls.Presenters.ContentPresenter.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/Presenters/ContentPresenter.cs:line 600
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Layout.Layoutable.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 737
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Layout.Layoutable.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 737
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Layout.Layoutable.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 737
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Controls.Presenters.ContentPresenter.ArrangeOverrideImpl(Size finalSize, Vector offset) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/Presenters/ContentPresenter.cs:line 671
   at Avalonia.Controls.Presenters.ContentPresenter.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/Presenters/ContentPresenter.cs:line 600
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Layout.LayoutHelper.ArrangeChildInternal(ILayoutable child, Size availableSize, Thickness padding) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/LayoutHelper.cs:line 74
   at Avalonia.Layout.LayoutHelper.ArrangeChild(ILayoutable child, Size availableSize, Thickness padding) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/LayoutHelper.cs:line 69
   at Avalonia.Controls.Decorator.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/Decorator.cs:line 60
   at Avalonia.Controls.Primitives.VisualLayerManager.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/Primitives/VisualLayerManager.cs:line 140
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Layout.Layoutable.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 737
   at Avalonia.Layout.Layoutable.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 685
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Layout.Layoutable.ArrangeOverride(Size finalSize) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 737
   at Avalonia.Controls.WindowBase.ArrangeCore(Rect finalRect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/WindowBase.cs:line 258
   at Avalonia.Layout.Layoutable.Arrange(Rect rect) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/Layoutable.cs:line 408
   at Avalonia.Layout.LayoutManager.Arrange(ILayoutable control) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/LayoutManager.cs:line 318
   at Avalonia.Layout.LayoutManager.ExecuteArrangePass() in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/LayoutManager.cs:line 274
   at Avalonia.Layout.LayoutManager.InnerLayoutPass() in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/LayoutManager.cs:line 244
   at Avalonia.Layout.LayoutManager.ExecuteLayoutPass() in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Layout/LayoutManager.cs:line 145
   at Avalonia.Controls.WindowBase.HandleResized(Size clientSize, PlatformResizeReason reason) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/WindowBase.cs:line 222
   at Avalonia.Controls.Window.HandleResized(Size clientSize, PlatformResizeReason reason) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/Window.cs:line 1017
   at Avalonia.Native.WindowBaseImpl.WindowBaseEvents.Avalonia.Native.Interop.IAvnWindowBaseEvents.Resized(AvnSize* size, AvnPlatformResizeReason reason) in /Users/danipen/Projects/Avalonia/src/Avalonia.Native/WindowImplBase.cs:line 211
   at Avalonia.Native.Interop.Impl.__MicroComIAvnWindowBaseEventsVTable.Resized(Void* this, AvnSize* size, AvnPlatformResizeReason reason) in /Users/danipen/Projects/Avalonia/src/Avalonia.Native/Interop.Generated.cs:line 3877
--- End of stack trace from previous location ---
   at Avalonia.Native.PlatformThreadingInterface.RunLoop(CancellationToken cancellationToken) in /Users/danipen/Projects/Avalonia/src/Avalonia.Native/PlatformThreadingInterface.cs:line 90
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in /Users/danipen/Projects/Avalonia/src/Avalonia.Base/Threading/Dispatcher.cs:line 61
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 120
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /Users/danipen/Projects/Avalonia/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 209
   at ControlCatalog.NetCore.Program.Main(String[] args) in /Users/danipen/Projects/Avalonia/samples/ControlCatalog.NetCore/Program.cs:line 101

Sometimes I can see a "red" flash while resizing the window:
https://user-images.githubusercontent.com/501613/175349013-eff1c2f9-470d-4be4-886d-23cbf5139606.mp4
If you take a look at the video at second 0:05, you'll see a red flash:

I tested in the Windows platform and most of these issues reported above are only reproduced on macOS.
I noticed that the composition "implicit" animations run on the Windows platform but don't run in macOS. @kekekeks should I enable something to get those animations to get enabled on macOS?

Tried to reproduce memory issue what @adirh3 reported. All was tested in Release mode, on same this branch. 144fps, QHD, Win11, 150% scaling.
Interestingly, that managed memory usage is the same, but unmanaged memory is definitely higher with compositor enabled.
UseCompositor = false
VS: ~179mb
Process Explorer: ~177mb
dotMemory: ~170mb (including 138mb of unmanaged memory)

High GC time.

Screenshots
VS:

Process Explorer:

dotMemory:

UseCompositor = true
VS: ~216mb
Process Explorer: ~214mb
dotMemory: ~213mb (including 177mb of unmanaged memory)

Low GC time.

Screenshots
VS:

Process Explorer:

dotMemory:

Bonus, new compositing animation on this branch, actively resizing inner grid-splitter. Not much difference from progress bar in terms of total RAM:

@maxkatz6 @kekekeks Just checked, just changing to 250% the memory jumps to 800MB, on 150% it's 280MB and on 100% its 210MB.
Checked on two Windows 11 machines.

@adirh3 yeah, seems so:
composition = true
QHD 150% -> 170mb unmanaged
FullHD 100% -> 140mb unmanaged
composition = false
QHD 150% -> 145mb unmanaged
FullHD 100% -> 135mb unmanaged
Simply moving window between screens

@danipen If you don't see implicit animations that means that you are running with the old renderer. I don't think I've enabled it by default in AvaloniaNativePlatformOptions

You can test this PR using the following package version. 0.10.999-cibuild0021343-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0021345-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

@kekekeks, the composition renderer in macOS doesn't throw the exceptions I reported above. It seems that this only happens when using the DeferredRenderer. I think it's worth taking a look.
I gave a try to the composition renderer. Looking good. I found some issues:

Popups/Flyouts don't render good. A red square is temporarily rendered:
https://user-images.githubusercontent.com/501613/175483379-3841c0f5-56ae-43c4-b175-bfc5edc111f2.mov

ProgressBar animation doesn't run smoothly (it runs smoothly if you move the mouse continuously).
https://user-images.githubusercontent.com/501613/175483526-38767b32-bd46-41ef-8fad-c3c0da24c8e3.mov

The window flashes red the first time it's displayed.
https://user-images.githubusercontent.com/501613/175483491-0bccc9d1-43b9-461a-a4bd-aa320880012c.mov

You can test this PR using the following package version. 0.10.999-cibuild0021365-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0021379-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0021388-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

Does this still use SkiaSharp? Or were there new custom bindings to Skia implemented? I was testing to see if the issue where memory temporarily spikes when resizing a window is fixed (since last I remember that cause was pinned to SkiaSharp), which no it's not, but also discovered something else.
Manually resizing a window is more GPU intensive (memory wise) with the new compositor. Just monitored via HWiNFO "GPU Memory Allocated"
Resizing a 1280x720 window manually to full screen 1920x1020 (1920x1080 display minus taskbar):
Without composition: GPU memory increases 100mb during resize
Without composition: GPU memory increases 180-200mb during resize.
The memory is also never freed at least from what I can tell. I don't know much about the backend with OpenGL/Angle/Skia, but even the 100mb increase doesn't make sense let alone the 200mb increase (since, if my math is right, a 1920x1080 texture should be <10mb in memory). This is also only when manually resizing.
Hitting the maximize button weirdly does not allocate as badly (~60MB)
For comparison, something like the Calculator app (UWP based) stays within 30mb of allocated VRAM regardless of what you do to the window. Probably not a fair comparison, but still...
Not sure if this is relevant or helpful, but thought I'd pass this along anyway.

Does this still use SkiaSharp? Or were there new custom bindings to Skia implemented

No, this is a replacement for old Deferred and Immediate renderers. Not the rendering backend.
I.e. it's about tracking dirty rects and invalidation.

since last I remember that cause was pinned to SkiaSharp

On configuration and out-of-dated skia version. SkiaSharp does its job fine.
To be fair, we use SkiaSharp on every platform now, but this resizing-memory issue is so bad only on Windows and only with GPU rendering enabled. It might as well be problem in Angle, but I am not expert in this lower-level code, so won't blame anything.
We need our own Skia wrapper to have more control over configuration and skia version. Though it's not a goal of this PR.

The memory is also never freed at least from what I can tell.

That's weird, it was perfectly freed on my and @kekekeks tests.

since, if my math is right, a 1920x1080 texture should be <10mb in memory

So, as this new renderer wasn't made to fix resizing issue, it's rather offtopic here.
Technically, this math is right, it shouldn't consume that much memory. But I assume it creates a new bitmap every tick when window is resizing, @kekekeks or @danwalmsley can correct me here. When on maximizing it creates a new bitmap once (I can only assume this), and everything else just fancy default windows animation.

For comparison, something like the Calculator app (UWP based)

UWP apps do not render anything by themselves, instead DWM does it. Same goes to WinForms apps. You won't see how much DWM uses memory to render acrylic and all of these nice effects, since it's not part of Calculator process.
But I am not sure if it's the same for WinUI 3 apps.

Updated PR description to make it clear

In my project, there are lots of times an exception, here is the stack:
Exception has occurred: CLR/System.ObjectDisposedException
An unhandled exception of type 'System.ObjectDisposedException' occurred in Avalonia.Base.dll: 'Cannot access a disposed object.'
   at Avalonia.Utilities.RefCountable.RefCounter.AddRef() in /_/src/Avalonia.Base/Utilities/Ref.cs:line 101
   at Avalonia.Utilities.RefCountable.Ref`1.Clone() in /_/src/Avalonia.Base/Utilities/Ref.cs:line 184
   at Avalonia.Rendering.Composition.CompositionDrawingContext.DrawBitmap(IRef`1 source, Double opacity, Rect sourceRect, Rect destRect, BitmapInterpolationMode bitmapInterpolationMode) in /_/src/Avalonia.Base/Rendering/Composition/Drawing/CompositionDrawingContext.cs:line 69
   at Avalonia.Media.Imaging.Bitmap.Avalonia.Media.IImage.Draw(DrawingContext context, Rect sourceRect, Rect destRect, BitmapInterpolationMode bitmapInterpolationMode) in /_/src/Avalonia.Base/Media/Imaging/Bitmap.cs:line 167
   at Avalonia.Controls.Image.Render(DrawingContext context) in /_/src/Avalonia.Controls/Image.cs:line 96
   at Avalonia.Rendering.Composition.CompositingRenderer.Update() in /_/src/Avalonia.Base/Rendering/Composition/CompositingRenderer.cs:line 228
   at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority) in /_/src/Avalonia.Base/Threading/JobRunner.cs:line 38
   at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) in /_/src/Windows/Avalonia.Win32/Win32Platform.cs:line 279
   at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
   at Avalonia.Win32.Win32Platform.RunLoop(CancellationToken cancellationToken) in /_/src/Windows/Avalonia.Win32/Win32Platform.cs:line 219
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in /_/src/Avalonia.Base/Threading/Dispatcher.cs:line 62
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 121
   at PicChooser.Program.Main(String[] args)

Fixed Image tab in catalog, can't repro the ObjectDisposedException. I don't think it's renderer-related since it can only happen if Ref<T> owned by  Bitmap got disposed which can't happen from the renderer code.

You can test this PR using the following package version. 0.10.999-cibuild0021432-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

I don't think it's renderer-related since it can only happen if Ref owned by Bitmap got disposed which can't happen from the renderer code.

it's happens just in Compositor mode, i try to reduce more specific case.

I don't think it's renderer-related since it can only happen if Ref owned by Bitmap got disposed which can't happen from the renderer code.

it's happens just in Compositor mode, i try to reproduce more specific case.
EDIT: What I have found so far, try to switch between the tabs quickly:
TextBox
TabStrip
TabControl
SplitView
They are one after the other.

I think this issue also repos without compositing renderer.

not releated to #7922, without Compositor its not happens.
I remember I reproduced your problem, it was less common, my problem much more common.

@danielmayost thanks for the repro, should be fixed now

tested, It seems to have been fixed.

You can test this PR using the following package version. 0.10.999-cibuild0021467-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

sometimes i the this exception at startup:
An unhandled exception of type 'System.InvalidOperationException' occurred in System.Private.CoreLib.dll: 'Collection was modified; enumeration operation may not execute.'
   at System.ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion()
   at Avalonia.Rendering.Composition.Compositor.RequestCommitAsync()
   at Avalonia.Rendering.Composition.Compositor.ImplicitBatchCommit()
   at Avalonia.Threading.JobRunner.RunJobs(Nullable`1 priority)
   at Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam)
   at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
   at Avalonia.Win32.Win32Platform.RunLoop(CancellationToken cancellationToken)
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args)
   at PicChooser.Program.Main(String[] args)

You can test this PR using the following package version. 0.10.999-cibuild0021479-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

Something is not updated here (works as expected without Compositor):

You can test this PR using the following package version. 0.10.999-cibuild0021499-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

@kekekeks Even after the VerifyAccess commit it still throws the exception sometimes.

@danielmayost from my understanding VerifyAccess was added to throw early before scheduling operation on the dispatcher. Is there a new stacktrace?

@danielmayost from my understanding VerifyAccess was added to throw early before scheduling operation on the dispatcher. Is there a new stacktrace?

no, same. It's weird, I also understood that way.

I did not reproduce this issue in ControlCatalog but it happens sometimes in my project, I will try to find a way to reproduce it.

You can test this PR using the following package version. 0.10.999-cibuild0021859-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0021869-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0021885-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0021892-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0021929-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0021968-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0022108-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]

You can test this PR using the following package version. 0.10.999-cibuild0022133-beta. (feed url: https://nuget.avaloniaui.net/repository/avalonia-all/index.json) [PRBUILDID]


Add proper parsing for all options types

Is your feature request related to a problem? Please describe.
Options generation from .json file was added in https://github.com/f3d-app/f3d/pull/1471, but parsing/formating is pretty naive.
Check every single type (some have not been added yet, see https://github.com/f3d-app/f3d/issues/1570) and add proper parsing/formatting

[x] bool
[x] int
[x] double
[x] ratio
[x] vector
[x] string
[ ] direction (not available yet)
[ ] color (not available yet)
[ ] path (not available yet)
[ ] rgba_colormap (not available yet)

To add proper parsing/formating it is simply needed to:

Implement proper parsing in options_tools::parse for this type
Check that formating is correct in options_tools::format and improve it if needed
Add testing in TestSDKOptions.cxx

starting with #1616

before we move forward with the more advanced types it would be useful to move the parse and format functions out of the .h.in file somewhere they can be picked up for coverage.

before we move forward with the more advanced types it would be useful to move the parse and format functions out of the .h.in file somewhere they can be picked up for coverage.

I agree, create an issue so we do not forget ? or take care of it ?


Unable to create dynamodb table

I'm new to moto. I was able to use moto with S3 without hassle. That was seamless. But I can't figure out this.
Steps to reproduce
pip install moto. The latest via pip is 1.3.14
from moto import mock_dynamodb

@mock_dynamodb
def test_get_latest_price():
    table_name = 'fake-price-table'

    # create a fake table to write to
    client = boto3.client('dynamodb', region_name='ap-southeast-2')
    response = client.create_table(
        TableName=table_name,
        AttributeDefinitions=[
            {
                'AttributeName': 'regionid',
                'AttributeType': 'S'
            },
            {
                'AttributeName': 'time_made',
                'AttributeType': 'N'
            },
        ],
        KeySchema=[
            {
                'AttributeName': 'regionid',
                'KeyType': 'HASH'
            },
            {
                'AttributeName': 'time_made',
                'KeyType': 'RANGE'
            },
        ],
        BillingMode='PAY_PER_REQUEST'
    )

Expected Result
Code executes successfully
Actual result
Traceback (most recent call last):
  File "dynamo.py", line 114, in <module>
    test_get_latest_price()
  File "/home/ec2-user/.local/lib/python3.6/site-packages/moto/core/models.py", line 88, in wrapper
    result = func(*args, **kwargs)
  File "dynamo.py", line 66, in test_get_latest_price
    BillingMode='PAY_PER_REQUEST'
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/client.py", line 316, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/client.py", line 622, in _make_api_call
    operation_model, request_dict, request_context)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/client.py", line 641, in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/endpoint.py", line 102, in make_request
    return self._send_request(request_dict, operation_model)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/endpoint.py", line 137, in _send_request
    success_response, exception):
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/endpoint.py", line 256, in _needs_retry
    caught_exception=caught_exception, request_dict=request_dict)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/hooks.py", line 356, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/retryhandler.py", line 183, in __call__
    if self._checker(attempts, response, caught_exception):
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/retryhandler.py", line 251, in __call__
    caught_exception)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/retryhandler.py", line 269, in _should_retry
    return self._checker(attempt_number, response, caught_exception)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/retryhandler.py", line 317, in __call__
    caught_exception)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/retryhandler.py", line 223, in __call__
    attempt_number, caught_exception)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
    raise caught_exception
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/endpoint.py", line 197, in _do_get_response
    responses = self._event_emitter.emit(event_name, request=request)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/hooks.py", line 356, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/botocore/hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/moto/core/models.py", line 272, in __call__
    request, request.url, request.headers
  File "/home/ec2-user/.local/lib/python3.6/site-packages/moto/core/responses.py", line 197, in dispatch
    return cls()._dispatch(*args, **kwargs)
  File "/home/ec2-user/.local/lib/python3.6/site-packages/moto/core/responses.py", line 295, in _dispatch
    return self.call_action()
  File "/home/ec2-user/.local/lib/python3.6/site-packages/moto/dynamodb/responses.py", line 30, in call_action
    response = getattr(self, endpoint)()
  File "/home/ec2-user/.local/lib/python3.6/site-packages/moto/dynamodb/responses.py", line 64, in create_table
    hash_key = key_schema["HashKeyElement"]
TypeError: list indices must be integers or slices, not str

Notes

When I remove the mock_dynamodb decorator and do a real API call, it works
Issue #3066 sounds related, but actually that's about secondary indexes, which I'm not using here

Hi @mlda065, the @mock_dynamodb refers to an old version of the DynamoDB API.
Can you try the same code with mock_dynamodb2? Your test looks fine, so I imagine that should work

Oh, thanks.
I was wondering what 1 vs 2 was.
I'll give that a try.
In the meantime, may I suggest modifying the documentation to explain the difference?
I assumed that dynamodb2 was for boto3.client('dynamodb2') or something.

Good call @mdavis-xyz - I've updated the README to explain the difference between the two.
is it working now?

Yes, that's clearer now.


Any thoughts on localization?

Hi,
I am new to racket (some scheme and lisp background).
Whats the best way to localize the demos?
See https://github.com/djinn/khhota as a initial effort
Regards,
Abhishek

I don’t know anything about localization.
I suppose I would go into the lexer.rkt and translate the English-language tokens to the new language. In the case of reserved-terms, the lexer could convert the reserved term in the new language to its English equivalent before emitting a token (which would contain the original English). Thus the lexer would act as a translation layer, in effect.
By keeping the localization in one file, it would be easier to create a system where you could support multiple localizations.
But I’m just guessing. Beyond that, it would be experimentation and refinement.


__RequestVerificationToken not generated when selecting API template

Hi,
When creating a new "ASP.NET Core Web Application" and using the "API" template, if you then wants to add Razor Pages, then you get a 400 badrequest error every time you want to post a form, due to __RequestVerificationToken
input doesn't gets generated in the html.
I haven't been able to find any differences compared to creating an "ASP.NET Core Web Application" and selecting the "Razor pages" template.
I have compared all the default nugets and sdk packages and there are no differences.
I have also tried to copy the startup from the project using the "Razor pages" template to the one using "Api" but still no success.
I have attached the project where it doesn't work.
I used Visual Studio Pro 15.8.3 when creating it.
RazorPages400Error.zip

Found the issue.
was missing @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers on the page/layout


Unclear language in restrictions on input when embedding array

In the sdk (Azure.AI.OpenAI's EmbeddingOptions), it mentioned max input for single string when embedding is 2048 yet the language found in docs:
The maximum length of input text for our latest embedding models is 8192 tokens. You should verify that your inputs don't exceed this limit before making a request.
If sending an array of inputs in a single embedding request the max array size is 2048.
Makes me think it is the length of the array and not a token count limit.
Edit: anyone coming here, after running some embeddings, it is: single string input cannot be more than 8192 tokens (see relevant tokenizer for model in question to add that validation) and the array of strings passed cannot have more than 2048 entries.

Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

ID: 1dccf321-372b-de22-4b72-d2a6b9e462f4
Version Independent ID: 198e3d91-fc2c-6bf1-814b-3ea13b46f691
Content: How to generate embeddings with Azure OpenAI Service - Azure OpenAI
Content Source: articles/ai-services/openai/how-to/embeddings.md
Service: azure-ai-openai
GitHub Login: @mrbullwinkle
Microsoft Alias: mbullwin

@btcpbordeaux
Thanks for your feedback! We will investigate and update as appropriate.

Hi @btcpbordeaux
To clarify, the maximum length of input text for the latest Azure OpenAI embedding models is 8192 tokens. This applies to both single string inputs and arrays of inputs. If you are using the SDK, the max_input_length parameter in the EmbeddingOptions class refers to the maximum length of a single input string, not the maximum number of inputs in an array.
However, it is important to note that the maximum input length may vary depending on the specific embedding model being used. It is always a good practice to check the documentation for the specific model to verify the maximum input length.
Thank you for sharing your findings after running some embeddings. I will make sure to pass this information along to the appropriate team to have the documentation and SDK updated accordingly.

@mrbullwinkle
Please review it.

@btcpbordeaux
We are going to close this thread, if there are any further questions regarding the documentation, please tag me in your reply and we will be happy to continue the conversation.
#Please-close


fix api update for xpinyin

fix #1  api update for xpinyin

Thanks!

Released with version v0.1.2.


rendering glitch

I got this rendering glitch and I don't know what to do pls help

Turn off "Use VBOs" in Video Settings


Target Framework - update to .net 7 ?? - stay current with Azure sandboxes.

I pulled down this code to work with the latest Azure sandbox which contained the .net 7.0 framework. The code is currently searching for the 6.0 framework. It looks like several of the existing PRs have been moving this code forward through different versions of the framework. Ideally, this example and others in the learning path's should have the frameworks that correspond to the frameworks loaded by default into the default sandboxes referenced in the learning paths.

Facing the same during recent Learning course - raised such relate PR: https://github.com/MicrosoftDocs/mslearn-communicate-with-storage-queues/pull/5


Fix date format to be mm/dd/yyyy

It was causing the wrong publication date.
Reported via LiveFyre by a customer on https://docs.microsoft.com/en-us/dotnet/articles/csharp/tour-of-csharp/structs

LGTM :shipit:


CLI: kontena * ls -q to play nicely with xargs

Hot on the heels of #2327
$ kontena stack ls -q | xargs kontena stack rm --force
ERROR: too many arguments
$ kontena kontena stack ls -q | xargs -L 1 kontena stack rm --force
--> works

(just realized that vault worked by accident since there was only 1 key)

rc1? #2395 fixed a problem with the -q (there's trailing space after each entry).

Actually to make it work with xargs without -n1/-L1 would require making all commands accept a list of items, such as kontena stack rm stack1 stack2 and kontena stack show stack1 stack2.
This COULD be done "globally" by modifying the option parser so that if the command accepts 1 parameter and $stdin.tty? == false and there are multiple parameters coming in instead of 1, it would loop through the command with each one of them.

this would also be nice to have with tty ;-)
Now I have to call it 5 times if I want to stop/start/deploy/rm whatever of 5 services/containers/...
Like
kontena service stop serviceA serviceB serviceC


Maestral GUI windows not opening on Mac

Describe the bug
The Maestral menu icon options for opening GUI windows (Show Recent Changes, Show Sync Issues, Preferences, etc.) do nothing. If I start Maestral from within the terminal, I receive the following error whenever I make the attempt:
Error in handler: rubicon.objc.api.ObjCInstance NSApplication has no attribute activate
Traceback (most recent call last):
  File "app_packages/toga/handlers.py", line 80, in _handler
  File "app/maestral_cocoa/app.py", line 322, in on_settings_clicked
  File "app/maestral_cocoa/settings.py", line 282, in show
  File "app_packages/toga/window.py", line 325, in show
  File "app/maestral_cocoa/private/implementation/cocoa/factory.py", line 710, in show
  File "app_packages/rubicon/objc/api.py", line 1110, in __getattr__
AttributeError: rubicon.objc.api.ObjCInstance NSApplication has no attribute activate

To Reproduce

Launch Terminal, type /Applications/Maestral.app/Contents/MacOS/Maestral
Try to activate a Maestral menu option that opens a GUI window

Expected behaviour
The requested information should display.
System:

Maestral version: 1.9.1
Python version: 3.11.5
OS: macOS 13.6.3 Ventura (22G436)
Desktop environment: n/a
PyQt version (for Linux GUI): n/a

Additional context
I have not received any update notifications since 1.8.0 - I downloaded and installed the latest version manually. That seemed to trigger a full file resync as well.

Thanks for the report! It appears that I've accidentally used an API that is only available starting with macOS 14.

I've just released a fix with v1.9.2. Before downloading from GitHub, could you try if "Check for updates" works for you this time?

Yes, it's working again. Thank you for the rapid response!


Streaming radio audio url never calls the callback of request

An audio url from a radio station hit my application, which is using request to check the incoming urls. The application just hangs on the specific url http://streaming.radionomy.com/RadioGansta
I tried the following with this url and nothing was printed.
const request = require('request');

request('http://streaming.radionomy.com/RadioGansta', (error, response, body) => {
	console.log('Error: ', error);
	console.log('Response: ', response);
	console.log('Body: ', body);
});

I run the following with the debug flag enabled and I got the following
REQUEST { followRedirect: false,
  timeout: 15000,
  gzip: true,
  headers: { 'user-agent': 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)' },
  uri: 'http://streaming.radionomy.com/RadioGansta',
  callback: [Function] }
REQUEST make request http://streaming.radionomy.com/RadioGansta
REQUEST onRequestResponse http://streaming.radionomy.com/RadioGansta 200 { 'content-type': 'audio/mpeg',
  date: 'Sun, 07 May 2017 09:31:21 GMT',
  'icy-br': '128, 128',
  'ice-audio-info': 'bitrate=128;samplerate=44100;channels=2',
  'icy-description': 'RadioGansta la radio des artistes indépendants et surtout RadioGansta  c est votre radio. Le meilleur de la musique urban rap rnb reggae ragga  ',
  'icy-genre': 'rap',
  'icy-name': 'RadioGansta',
  'icy-pub': '1',
  'icy-url': 'http://www.radiogansta.fr',
  server: 'Icecast 2.3.3-kh8',
  'cache-control': 'no-cache, no-store',
  pragma: 'no-cache',
  'access-control-allow-origin': '*',
  'access-control-allow-headers': 'Origin, Accept, X-Requested-With, Content-Type',
  'access-control-allow-methods': 'GET, OPTIONS, HEAD',
  connection: 'close',
  expires: 'Mon, 26 Jul 1997 05:00:00 GMT' }
REQUEST reading response's body
REQUEST finish init function http://streaming.radionomy.com/RadioGansta

It feels to me like a bug, as I would expect at least to get a call to my callback function and then handle the response or even to throw an exception.
Am I dealing with this in the wrong way?

I switched to stream in order to detect the type of response and on audio or video I abort the request. However, shouldn't I have got a timeout, as it's set?

This isn't a bug.  You're retrieving a radio stream, which has indefinite length.  Since you're passing a callback when you make the request, the module is going to buffer the data until you run out of memory.
You should handle .on('response', ...) instead, as indicated in the guide on streaming.  https://github.com/request/request#streaming


Newspaper language detection not working with CNN news

 Issue by Tsadoq
Thu Feb 27 09:57:03 2020
Originally opened as https://github.com/codelucas/newspaper/issues/784

So, does anybody know why, when I try to fetch an article from CNN website (eg. https://edition.cnn.com/2020/02/26/india/india-delhi-violence-ashok-nagar-intl/index.html ) I get no meta_lang?
I used
from newspaper import Article, article
a = Article("https://edition.cnn.com/2020/02/26/india/india-delhi-violence-ashok-nagar-intl/index.html")
a.download()
a.parse()

and i see:

works in v.0.9.1


Implement a search endpoint using solr

[x] Add solr docker image to the docker-compose
[ ] Do a 2 SOLR tutorials like https://www.youtube.com/watch?v=v4GNOnvdgtY (didnt check this)
[ ] Use sssom CLI to turn mapping sets to JSON
[x] Write some code to load JSON into SOLR core
[ ] Create endpoint to search any field
[ ] Create endpoint to search a range for confidence field

Here is some ancient code I wrote:
https://github.com/VirtualFlyBrain/vfb-pipeline-dumps/blob/master/scripts/obographs-solr.py

Use sssom CLI to turn mapping sets to JSON

This also needs a script to flat the data. The decision would be to add all mapping_set information to each of its mappings, but there are the same attributes' names in both levels. Discussing with Nico, he said that the policy (not official) is to prioritise the field at the mapping level. And only take the mapping_set field if it's not available in the mapping. However, this is still in discussion on a case by case.
The list of terms present in mapping set and mapping: TBD


Git: clicking untracked file now opens diff editor?

Steps to Reproduce:

add a new file
click it from the changes view

=> :bug: it opens a diff editor instead of just the file?

This seems to be a regression.

This is purposeful, since you can now stage ranges in untracked files! https://github.com/microsoft/vscode/pull/78562

Not sure, I always have a keybinding for doing this and I would guess it could just work via that from the editor.

I prefer the old behaviour of just opening the new file.  Is there an option to set this behaviour?


lethality term

new child of preweaning lethality [MP:0010770]
complete lethality between fetal growth and the end of the neonatal period
def:  death of individual organisms of a given genotype in a population anytime during fetal growth and development stages through the end of the perinatal period
(Mus: E18.5 through postnatal day 1)
Reported by: llw2
Original Ticket: obo/mammalian-phenotype-requests/2057

timing suggested is the same as perinatal lethality - use this term instead


Taxon constraint: post-transcriptional gene silencing by RNA

Please provide as much information as you can:

GO term ID label:

https://www.ebi.ac.uk/QuickGO/term/GO:0035194
post-transcriptional gene silencing by RNA

Request to add a taxon constraint:

Please add taxon constraints:
Never in S . pombe
Never in S. cerevisiae.
(we can't add never in fission yeast, (I.e all Schizosaccharomyces, because the pathway is present in S . japonicus
Separable roles for RNAi in regulation of transposable elements and viability in the fission yeast Schizosaccharomyces japonicus.
Chapman E, Taglini F, Bayne EH.
PMID: 35226668

Duplicate of #22771 - this is done.


[LOTP] Bash (wut ?!)

Bash, but with a twist
Bash in itself is used for executing stuff, so this is somehow a "normal" usage, but with a twist
Configuration files
.bashrc
.initrc

Env variable
BASH_ENV
PROMPT_COMMAND (only interactive, doesn't work)

Documentation
https://www.gnu.org/software/bash/manual/bash.html#Bash-Variables
Github example
name: On issue with debug
on:
  issue_comment:
    types: [created, edited]

jobs:
  command_dispatch:
    name: Debug
    runs-on: ubuntu-latest
    permissions:
      # keep this limited to read permissions for the content only!
      contents: write
    steps:
      - name: Debug
        run: |
          echo "Injectable wrokflow"

      - name: Debug 2
        run: |
          echo "----------------"
          echo "Nothing: safe workflow"
          echo "----------------"

In this example we can inject a bashrc, as bash is the default shell on runner.
Some runner use the following default command for shell
/usr/bin/bash --noprofile --norc -e -o pipefail "/tmp/computed/step.sh"
This example will not run any bashrc or initrc because of the --noprofile and -norc.
However, this will execute the file defined in BASH_ENV, so file file write + env injection, the second step can be injected, without anything visible that step that indicate an injection.
Additional notes
This is the default on github action, so yeah a lot of potential target

Something like this? So it seems like any form of injection where we can pass newlines into the environment file -> RCE on default run steps.
on:
  pull_request:

jobs:
  test:
    runs-on: ubuntu-latest
    steps:

    - uses: actions/checkout@v4
    - name: Foobar
      run: |
        echo "FOOBAR=$PR_BODY" >> $GITHUB_ENV
      env:
          PR_BODY: ${{ github.event.pull_request.body }}
    - run: |
        echo "Hello"

Exactly.
https://slides.com/tr4l/2024#/5/6
Le ven. 30 août 2024, 01:26, Adnan Khan @.***> a écrit :

Something like this? So it seems like any form of injection where we can
pass newlines into the environment file -> RCE on default run steps.
on:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses<EMAIL_ADDRESS>- name: Foobar
  run: |
    echo "FOOBAR=$PR_BODY" >> $GITHUB_ENV
  env:
      PR_BODY: ${{ github.event.pull_request.body }}
- run: |
    echo "Hello"

—
Reply to this email directly, view it on GitHub
https://github.com/boostsecurityio/lotp/issues/29#issuecomment-2319417295,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/ACXXIZS2GJ3E2NJZ7BOV2F3ZT6UZVAVCNFSM6AAAAABGKXVDMWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJZGQYTOMRZGU
.
You are receiving this because you authored the thread.Message ID:
@.***>

Ref to this article too https://www.sstic.org/media/SSTIC2024/SSTIC-actes/action_man_vs_octocat_github_action_exploitation/SSTIC2024-Article-action_man_vs_octocat_github_action_exploitation-vincent.pdf

An actual vuln GHSA https://github.com/espressif/arduino-esp32/security/advisories/GHSA-h52q-xhg2-6jw8

More ideas from the TDF CTF
https://github.com/boost-rnd/tdf-ctf-cicd?tab=readme-ov-file#chall-3


Different signatures on getRepository() method

Hi,
We have an issue with the consistency of the phpstan analysis on our project across installations.
We have the following service called DoctrineActiveRepository :
<?php

declare(strict_types=1);

use Doctrine\Persistence\ManagerRegistry;
use Active\ActiveTranslation;

class DoctrineActiveRepository
{
    public function __construct(
        private ManagerRegistry $registry,
    ) {
    }

  public function batch(int $id) {
       $myTranslation = $this->registry->getRepository(ActiveTranslation::class)->find($id);
  }
}

On the first environment, I get the following error:
Call to an undefined method Doctrine\Persistence\ObjectRepository<Active\ActiveTranslation>::page().
but on the second environment I get
Call to an undefined method Doctrine\ORM\EntityRepository<Active\ActiveTranslation>::page()
Both environments share the exact same versions of the packages:
phpstan/phpstan: 1.4.6
phpstan/phpstan-doctrine: 1.2.11
doctrine/orm: 2.9.6
doctrine/persistence: 2.3.0

I have tried reinstalling both environments with a fresh set of packages but haven't succeeded so far. I don't understand why both phpstan installations would not capture the same signature for the getRepository function

Hi, what do you mean by "environments"? Is it the same project on different computers?

Yes same project but different computers

Not sure why is it happening. Doctrine\Persistence\ObjectRepository is in the ManagerRegistry stub: https://github.com/phpstan/phpstan-doctrine/blob/master/stubs/Persistence/ManagerRegistry.stub
Doctrine\ORM\EntityRepository is returned by this extension https://github.com/phpstan/phpstan-doctrine/blob/master/src/Type/Doctrine/GetRepositoryDynamicReturnTypeExtension.php which has some complex logic in it.
My guess is that some exception is thrown and this catch is executed on one of the computers: https://github.com/phpstan/phpstan-doctrine/blob/9a1711a659829590f2ceb928674565258e176cbc/src/Type/Doctrine/GetRepositoryDynamicReturnTypeExtension.php#L111-L115
Feel free to debug that. Also try enabling bleedingEdge https://phpstan.org/blog/what-is-bleeding-edge, it might show some extra errors.

Thanks for your answer ! Any advice on how to debug the PHPStan process? I tried activating bleeding edge but nothing changed. I would like to setup a clean debug environment for the extension but I'm not sure where to start...

Just put some var_dump()s in the extension in vendor/phpstan/phpstan-doctrine to see where it ends up.

I managed to find out why it was giving out different results. Some of the environments were running Composer 2.1.X and some were using Composer 2.2.X.
As the documentation of phpstan-extension-installer mentions, starting from Composer 2.2.0, composer prompts for an approval before installing extensions and we had:
"phpstan/extension-installer": false,

in our composer.json.
After changing this value to true and executing a fresh composer install the issue was gone.


Middle-mouse button scrolling in the Source pane

In the HTML panes, you can hold down the middle mouse button (or scroll wheel) and move the mouse to scroll. It would be nice to have this in the Source pane, too.
This is (somewhat) implemented in MFC, and there is a modified version of this already in use for the Skein window. That could be improved by having a better icon image for when this mode activates - currently it's just a crudely drawn circle with arrows, with no anti-aliasing.

Commit f986798a2696155a6a488ea5fa9fc14a2fd35791 tidies up the icon logic for the skein window. Now the middle mouse scrolling icon (the "anchor pan" icon) is antialiased.


Rename Ready::TIMER to DEADLINE

Currently it still refers to the Timer struct, but that was removed. Now Poller only has add and remove deadline methods, this name should reflect that.

Also search through all documentation for Timer usage.

I'm really sure about this. Ready::DEADLINE doesn't sound that nice and Ready::TIMER is a bit more generic. I'm leaving this open for now.

Deciding against this.


Add  as contributor

I edited the Contributors.yaml file to add my details in preparation for my main contribution.

Hi @Ezichi-Fav. Welcome to the GTN! Being on the contributor list is not a pre-requisite to contributing to the GTN.
So we do not add people to the contributor list until their first contribution to avoid inaccurately increasing our statistics. We will leave this pull request open until you make your first contribution and merge it then :)
If you are looking for ideas of how to contribute here, please take a look at this issue with contribution ideas, or have a chat with us on Gitter/Matrix :)

Updated all comments on High Throughput Molecular Dynamics and Analysis (Computational Chemistry)

Updated all comments on High Throughput Molecular Dynamics and Analysis (Computational Chemistry)

duplicate of https://github.com/galaxyproject/training-material/pull/2979


Offer API to expose source maps of parsed JSON documents

In some cases, I could see a use for having source maps for parsed JSON documents. For example, the character positions of parse JSON elements.
What do you think about this?
An example use-case could be for using JSON data used in tests and providing the exact location of a failure in a test.

Example: https://github.com/uri-templates/uritemplate-test/blob/fdd5d611a849b922c2ff40fc3997fd265dd14c02/spec-examples-by-section.json#L213

Sounds like a feature I'd welcome! I could try to hack it together.

are you looking for just an index in the byte stream or would you prefer line/column information?
how would you structure the API?

@kylef Okay, here's a working implementation on a branch, I'll wait for your feedback before I merge it.
Call this:
let json: ParsedJsonToken = try Jay().annotatedTypesafeJsonFromData(data)

and it returns
public struct ParsedJsonToken {
    public let value: ParsedJsonValue
    public let range: JsonRange
}

This looks awesome, I'd say go with index since line number can always be found out afterwards and it's more accurate (if the JSON document wasn't pretty printed and in a single line).
You can also change all of the errors thrown from Jay to contain source annotations too so people can easily find where a problem lies in their JSON document.
I will try find some time tomorrow evening to try and use this. I'd also like to update my JSONSchema library to use Jay and try these source annotations. Would be helpful to indicate where validation warnings are raised from within the schema.

Great, give it a try and let me know what you want changed. Happy to see
Jay stress tested in different use cases.
On Fri, Mar 18, 2016 at 2:22 AM Kyle Fuller<EMAIL_ADDRESS>wrote:

This looks awesome, I'd say go with index since line number can always be
found out afterwards and it's more accurate (if the JSON document wasn't
pretty printed and in a single line).
You can also change all of the errors thrown from Jay to contain source
annotations too so people can easily find where a problem lies in their
JSON document.
I will try find some time tomorrow evening to try and use this. I'd also
like to update my JSONSchema https://github.com/kylef/JSONSchema.swift
library to use Jay and try these source annotations. Would be helpful to
indicate where validation warnings are raised from within the schema.
—
You are receiving this because you commented.
Reply to this email directly or view it on GitHub
https://github.com/czechboy0/Jay/issues/12#issuecomment-198167067


Update file location on the README (documentation)

On the documentation where it says with the configuration from local/wp-cli.yml, it's actually with the configuration from local/public/wp-cli.yml (the file location needs to be updated/fixed).

That's a great find! Indeed, the file path has now changed:
https://github.com/xwp/vip-go-site/blob/fe7def340011c9c84d32f5fa102481ddd384dc20/local/public/wp-cli.yml

@kasparsd what I was reporting is a small typo on the README file, nothing related to the code.

Please see the screenshot above taken from the README file: the file location should be local/public/wp-cli.yml and not local/wp-cli.yml, just that.
Thank you!

Fixed in #121.


[CI] Allow manual dmg build on dev branches

What does this PR do?
This PR allows manual dmg build trigger on dev branches.

Motivation
People sometimes need to test their modifications on MacOS.

Additional Notes

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

/merge


Execution failed for task ':launcher:processReleaseResources'

Bug description
The execution fails after 30 minutes of execution during building Gradle project
How to reproduce

My job
on:
  pull_request:
    types: [opened, synchronize]
jobs:
  build:
    name: Build .apk for testing
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
          lfs: true
      - uses: actions/cache@v2
        with:
          path: Library
          key: Library-Android
      - uses: game-ci/unity-builder@v2
        env:
          UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
          UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
          UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
        with:
          targetPlatform: Android
          androidKeystoreName: HeraldoAgnese.keystore
          androidKeystoreBase64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
          androidKeystorePass: ${{ secrets.ANDROID_KEYSTORE_PASS }}
          androidKeyaliasName: ${{ secrets.ANDROID_KEYALIAS_NAME }}
          androidKeyaliasPass: ${{ secrets.ANDROID_KEYALIAS_PASS }}
          androidTargetSdkVersion: AndroidApiLevelAuto
      - uses: actions/upload-artifact@v2
        with:
          name: Build-Android
          path: build/Android

Result log (after gradle build step):
Welcome to Gradle 6.1.1!

Here are the highlights of this release:
 - Reusable dependency cache
 - Configurable compilation order between Groovy/Kotlin/Java/Scala
 - New sample projects in Gradle's documentation

For more details see https://docs.gradle.org/6.1.1/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :launcher
WARNING: The option setting 'android.enableR8=true' is deprecated.
It will be removed in version 5.0 of the Android Gradle plugin.
You will no longer be able to disable R8
WARNING: [Processor] Library '/root/.gradle/caches/modules-2/files-2.1/com.google.android.exoplayer/exoplayer-ui/2.15.1/5af30e03819b04a3c9dc08befd6beca8f2f60f57/exoplayer-ui-2.15.1.aar' contains references to both AndroidX and old support library. This seems like the library is partially migrated. Jetifier will try to rewrite the library anyway.
 Example of androidX reference: 'androidx/core/app/NotificationCompat$Builder'
 Example of support library reference: 'android/support/v4/media/session/MediaSessionCompat$Token'

> Task :launcher:preBuild UP-TO-DATE
> Task :launcher:extractProguardFiles
> Task :launcher:preReleaseBuild
> Task :unityLibrary:preBuild UP-TO-DATE
> Task :unityLibrary:preReleaseBuild UP-TO-DATE
> Task :unityLibrary:compileReleaseAidl NO-SOURCE
> Task :unityLibrary:packageReleaseRenderscript NO-SOURCE
> Task :launcher:generateReleaseBuildConfig
> Task :launcher:compileReleaseAidl NO-SOURCE
> Task :launcher:compileReleaseRenderscript NO-SOURCE
> Task :launcher:javaPreCompileRelease
> Task :launcher:generateReleaseResValues
> Task :launcher:generateReleaseResources
> Task :unityLibrary:compileReleaseRenderscript NO-SOURCE
> Task :unityLibrary:generateReleaseResValues
> Task :unityLibrary:generateReleaseResources
> Task :launcher:createReleaseCompatibleScreenManifests
> Task :launcher:extractDeepLinksRelease
> Task :unityLibrary:packageReleaseResources
> Task :unityLibrary:extractDeepLinksRelease
> Task :unityLibrary:processReleaseManifest
> Task :unityLibrary:compileReleaseLibraryResources
> Task :unityLibrary:parseReleaseLocalResources
> Task :launcher:processReleaseManifest
> Task :launcher:mergeReleaseResources
> Task :unityLibrary:generateReleaseRFile
> Task :launcher:processReleaseResources FAILED
16 actionable tasks: 16 executed
]
exit code: 1
  at UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x00033] in <e8d8d8782ef8400fa679b5177100ea99>:0
  at UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x0002d] in <e8d8d8782ef8400fa679b5177100ea99>:0
  at UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) [0x0000a] in <e8d8d8782ef8400fa679b5177100ea99>:0
  at UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) [0x0001f] in <e8d8d8782ef8400fa679b5177100ea99>:0
  at UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) [0x0002f] in <e8d8d8782ef8400fa679b5177100ea99>:0
Rethrow as GradleInvokationException: Gradle build failed
  at UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) [0x00050] in <e8d8d8782ef8400fa679b5177100ea99>:0
  at UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) [0x000d1] in <e8d8d8782ef8400fa679b5177100ea99>:0
  at UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) [0x00078] in <e8d8d8782ef8400fa679b5177100ea99>:0
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
  at UnityEditor.Android.PostProcessor.CancelPostProcess.AbortBuild (System.String title, System.String message, System.Exception ex) [0x00020] in <e8d8d8782ef8400fa679b5177100ea99>:0
  at UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) [0x0011a] in <e8d8d8782ef8400fa679b5177100ea99>:0
  at UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) [0x003dc] in <e8d8d8782ef8400fa679b5177100ea99>:0
  at UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) [0x00001] in <e8d8d8782ef8400fa679b5177100ea99>:0
  at UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) [0x000dc] in /home/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:337
UnityEditor.BuildPipeline:BuildPlayerInternalNoCheck(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions, String[], Boolean)
UnityEditor.BuildPipeline:BuildPlayerInternal(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions, String[]) (at /home/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:422)
UnityEditor.BuildPipeline:BuildPlayer(String[], String, String, BuildTargetGroup, BuildTarget, BuildOptions, String[]) (at /home/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:321)
UnityEditor.BuildPipeline:BuildPlayer(BuildPlayerOptions) (at /home/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline.bindings.cs:295)
UnityBuilderAction.Builder:BuildProject() (at Assets/Editor/Editor/UnityBuilderAction/Builder.cs:71)

(Filename: /home/bokken/build/output/unity/unity/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs Line: 337)

Unloading 33 Unused Serialized files (Serialized files now loaded: 0)
System memory in use before: 99.7 MB.
System memory in use after: 99.4 MB.

Unloading 33 unused Assets to reduce memory usage. Loaded Objects now: 2280.
Total: 799.886300 ms (FindLiveObjects: 0.624800 ms CreateObjectMapping: 0.122400 ms MarkObjects: 798.561500 ms  DeleteObjects: 0.[5563](https://github.com/aldoaldo1/super-viral-19/actions/runs/5112402743/jobs/9190393549?pr=136#step:4:5564)00 ms)

Unloading 0 Unused Serialized files (Serialized files now loaded: 0)
Loaded scene 'Temp/__Backupscenes/0.backup'
	Deserialize:            1.841 ms
	Integration:            147.693 ms
	Integration of assets:  0.003 ms
	Thread Wait Time:       0.018 ms
	Total Operation Time:   149.555 ms
System memory in use before: 98.5 MB.
System memory in use after: 98.6 MB.

Unloading 0 unused Assets to reduce memory usage. Loaded Objects now: 2264.
Total: 708.488000 ms (FindLiveObjects: 0.373300 ms CreateObjectMapping: 0.130100 ms MarkObjects: 707.962900 ms  DeleteObjects: 0.018500 ms)

###########################
#      Build results      #
###########################

Duration: 00:29:33.0470301
Warnings: 36
Errors: 4
Size: 196565242 bytes

Build failed!

Changing to "/github/workspace/_activate-license~" directory.
/github/workspace/_activate-license~ /github/workspace
/github/workspace

###########################
#         Failure         #
###########################

Please note that the exit code is not very descriptive.
Most likely it will not help you solve the issue.

To find the reason for failure: please search for errors in the log above.

Error: The process '/usr/bin/docker' failed with exit code 101

Expected behavior
The build success
Additional details

Unity version in ProjectVersion.txt 2020.3.40f1

We got the same error on Android build today.


Format of Azure Blob Storage DSN

What is the format of the Azure blob storage DSN?
Perhaps it's the blob service URL?  https://xxxxx.blob.core.windows.net/
Or the resource ID? /subscriptions/a4181df7xxxxxx-a86/resourceGroups/rg-xxxxx/providers/Microsoft.Storage/storageAccounts/xxxxx/blobServices/default
How is the access key provided?
Any help appreciated.

https://learn.microsoft.com/en-us/azure/storage/common/storage-configure-connection-string


Add Python 3.12 to CI testing matrix.

Python 3.12 came out a few hours ago, so in this PR:

We make linting use 3.12 instead of 3.11, since that's the max version we support. (We also lint on 3.8, the min version we support.)
We add 3.12 to the test matrices for all other CI runs.

This is going to fail for a bit until the GitHub Action we use to install Python starts supporting 3.12. It should be safe to restart the CI job, and merge it once it starts passing.

Blocked on numpy supporting Python 3.12.

aiohttp has a beta release (3.9.0b2) that supports 3.12 now, the full release should be out soon

Hello @baskaryan,
Would you mind providing reasons to close this PR without any feedback?
Thanks!

Updated effort to introduce 3.12 into CI here: https://github.com/langchain-ai/langchain/pull/15035


v22.6.11 fix API Doc description

Current coverage is 100% (diff: 100%)

Merging #634 into master will not change coverage

@@           master   #634   diff @@
====================================
  Files          29     29
  Lines         439    439
  Methods       111    111
  Messages        0      0
  Branches        0      0
====================================
  Hits          439    439
  Misses          0      0
  Partials        0      0

Powered by Codecov. Last update 9d59250...815df47


API adition

Feature request to add an API point for Updates count available and APP count. I`m currently doing a Heimdall Dashboard APP for Argus and as there is no api endpoint for Update counter and APP counter i would need to convert the /metrics to json and program from there.

Hi,
I don't personally use Heimdall, but I have heard it mentioned a lot and it's nice to see an interest in adding Argus to it.
I could add something like /api/v1/counts that gives
{
  "service_count": 5,
  "updates_available": 3,
  "updates_skipped": 1
}

Would that work for you?
(Haven't got round to adding Auth yet so will just be a simple GET request until I get to that)

So what i was thinking was something like what i did with when i did the Enhanced version of gotify:

But changing the values for the ones you put on the json you mentioned
{
  "service_count": 5,
  "updates_available": 3,
  "updates_skipped": 1
}

and having only one endpoint to get those information make everything easier, only one request and that`s it.


Add Bower support

Current coverage is 100% (diff: 100%)

Merging #1 into master will not change coverage

@@           master    #1   diff @@
===================================
  Files           1     1
  Lines         131   131
  Methods         0     0
  Messages        0     0
  Branches        0     0
===================================
  Hits          131   131
  Misses          0     0
  Partials        0     0

Powered by Codecov. Last update f421244...78d1ef3

Note that
browserify src/infestines.js -t babelify --no-bundle-external -d -s I -o dist/infestines.js"

effectively creates a kind of development/debug build of the library with references to process.env.NODE_ENV (in assert)  and also includes an inline source map.
Should we eliminate the process.env.NODE_ENV reference?  Like this:
-browserify src/infestines.js -t babelify --no-bundle-external -d -s I -o dist/infestines.js"
+NODE_ENV=dev browserify src/infestines.js -t babelify --no-bundle-external -d -s I -g envify -o dist/infestines.js"

Would it also make sense to create a minimized production build?  Like this:
+NODE_ENV=production browserify src/infestines.js -t babelify --no-bundle-external -d -s I -g envify -g uglifyify -o dist/infestines.min.js"


chore(deps): upgrade runtime dependencies

Upgrades project dependencies. See details in workflow run.

Automatically created by projen via the "upgrade-runtime-dependencies-2.x" workflow

⚪ Backport skipped
The pull request was not backported as there were no branches to backport to. If this is a mistake, please apply the desired version labels or run the backport tool manually.
Manual backport
To create the backport manually run:
backport --pr 2068

Questions ?
Please refer to the Backport tool documentation


Using Koin for android tests

Searching for a solution to mock one of my repositories used as a Koin Module for instrumented tests, I finally found a way to mock it.
If you want to mock one of the Koin Modules for your instrumented test, you need to call the loadKoinModules method passing it a list of Koin Modules you want to override.
The problem here is that if the Koin Module you want override is already injected inside the components you want to test, then the loadKoinModules won't have any effect on these components. So you have to make sure the Koin Module is not injected in your components before mocking it.
A workaround I found is to override the ActivityTestRule you defined in your test class and to mock your Koin Module during the beforeActivityLaunchedof the ActivityTestRule.
This way, the Koin module will be mocked before activity is launched. As the module was injected once the Activity was created in my side, this solved the problem.
Here is my Test class including this solution:
@RunWith(AndroidJUnit4::class)
class LoginTest {

    val mockedUserRepository = Mockito.mock(UserDataSource::class.java)

    @Rule
    @JvmField
    val rule = object: ActivityTestRule<LoginActivity>(LoginActivity::class.java) {
        override fun beforeActivityLaunched() {
            super.beforeActivityLaunched()

            // This will replace the UserDataSource module previously defined
            // in the Application class creation before the activity is launched
            // Otherwise ... components won't be reloaded
            val mockedUserModule = applicationContext {
                bean { mockedUserRepository as UserDataSource }
            }
            loadKoinModules(listOf(mockedUserModule))
        }
    }

   @Test
   fun loginWithUnactivatedAccount() {
        // Here the new module is loaded with all application components
        // and you can interact with the mockedUserRepository
        ...
   }
}

It would be great to have such example inside the documentation :)

Hi all,
I confirm that testing activity is a pain when we need to inject mock instances.
I think that an @MockBean annotation as in spring would be of great help.
In spring this annotation replaces the corresponding bean by the annotated mock.
This simplify greatly the test writing.
Patrice

Hi @patrice-conil,
could be interesting to tell to Koin that we want mocks for given types 👍

In the snippet above, we can replace the snippet:
val mockedUserRepository = Mockito.mock(UserDataSource::class.java)

    @Rule
    @JvmField
    val rule = object: ActivityTestRule<LoginActivity>(LoginActivity::class.java) {
        override fun beforeActivityLaunched() {
            super.beforeActivityLaunched()

            // This will replace the UserDataSource module previously defined
            // in the Application class creation before the activity is launched
            // Otherwise ... components won't be reloaded
            val mockedUserModule = applicationContext {
                bean { mockedUserRepository as UserDataSource }
            }
            loadKoinModules(listOf(mockedUserModule))
        }
    }

with:
 val rule = object: ActivityTestRule<LoginActivity>(LoginActivity::class.java) {
        override fun beforeActivityLaunched() {
            super.beforeActivityLaunched()

            // This will replace the UserDataSource module previously defined
            // in the Application class creation before the activity is launched
           createMock<UserDataSource>()
        }
    }

I've just added createMock() function in koin-test

Check https://github.com/Ekito/koin/issues/151

Can not see the createMock() function in koin test

Sorry, it's has been renamed declareMock (createMock was conflicting with other API).