<presenters:CachedContentPresenter DataContext="{Binding Project.CurrentContainer.CurrentShape}"/>
<StackPanel>
<TextBlock Text="Hello from Path" Classes="default"></TextBlock>
<ListBox>
<ListBoxItem>Path</ListBoxItem>
</ListBox>
<TabControl Classes="default">
<TabItem Header="Path" Classes="property">
<TextBlock Text="Hello from TabItem Path" Classes="default"></TextBlock>
</TabItem>
</TabControl>
</StackPanel>
Looks like the issue may be connected to virtualization.
<StackPanel Background="Yellow">
<TextBlock Text="Hello from Path" Classes="default"></TextBlock>
<Rectangle Width="100" Height="50" Fill="Orange"/>
<ListBox Name="listBox" Background="Red" VirtualizationMode="Simple">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Vertical"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBoxItem>Path</ListBoxItem>
</ListBox>
</StackPanel>
Exception thrown: 'System.NullReferenceException' in Avalonia.Controls.dll
Core2D.Avalonia.Skia.vshost.exe Error: 0 : Odwołanie do obiektu nie zostało ustawione na wystąpienie obiektu.
w Avalonia.Controls.Presenters.ItemVirtualizer.Dispose()
w Avalonia.Controls.Presenters.ItemsPresenter.VirtualizationModeChanged(AvaloniaPropertyChangedEventArgs e)
w Avalonia.AvaloniaObjectExtensions.SubscribeAdapter[TTarget](AvaloniaPropertyChangedEventArgs e, Func`2 handler)
w Avalonia.AvaloniaObjectExtensions.<>c__DisplayClass8_0`1.<AddClassHandler>b__0(AvaloniaPropertyChangedEventArgs e)
w System.Reactive.AnonymousObserver`1.OnNextCore(T value)
w System.Reactive.ObserverBase`1.OnNext(T value)
w System.Reactive.Subjects.Subject`1.OnNext(T value)
w Avalonia.AvaloniaObject.RaisePropertyChanged(AvaloniaProperty property, Object oldValue, Object newValue, BindingPriority priority)
w Avalonia.AvaloniaObject.Avalonia.IPriorityValueOwner.Changed(PriorityValue sender, Object oldValue, Object newValue)
w Avalonia.PriorityValue.UpdateValue(Object value, Int32 priority)
w Avalonia.PriorityValue.LevelValueChanged(PriorityLevel level)
w Avalonia.PriorityLevel.ActivateFirstBinding()
w Avalonia.PriorityLevel.Changed(PriorityBindingEntry entry)
w Avalonia.PriorityBindingEntry.ValueChanged(Object value)
w System.Reactive.AnonymousSafeObserver`1.OnNext(T value)
w System.Reactive.Linq.ObservableImpl.Select`2._.OnNext(TSource value)
w System.Reactive.AutoDetachObserver`1.OnNextCore(T value)
w System.Reactive.ObserverBase`1.OnNext(T value)
w System.Reactive.SafeObserver`1.OnNext(TSource value)
w System.Reactive.Linq.ObservableImpl.TakeUntil`2._.T.OnNext(TSource value)
w System.Reactive.Subjects.Subject`1.OnNext(T value)
w Avalonia.Markup.Data.ExpressionNode.set_CurrentValue(WeakReference value)
w Avalonia.Markup.Data.ExpressionNode.set_Target(WeakReference value)
w Avalonia.Markup.Data.ExpressionObserver.<IncrementCount>b__27_0(Unit x)
w System.Reactive.AnonymousSafeObserver`1.OnNext(T value)
w System.Reactive.Linq.ObservableImpl.Select`2._.OnNext(TSource value)
w System.Reactive.Linq.ObservableImpl.Skip`1._.OnNext(TSource value)
w System.Reactive.Linq.ObservableImpl.Cast`2._.OnNext(TSource value)
w System.Reactive.AutoDetachObserver`1.OnNextCore(T value)
w System.Reactive.ObserverBase`1.OnNext(T value)
w Avalonia.AvaloniaObjectExtensions.<>c__DisplayClass0_1.<GetObservable>b__1(Object s, AvaloniaPropertyChangedEventArgs e)
w System.EventHandler`1.Invoke(Object sender, TEventArgs e)
w Avalonia.AvaloniaObject.RaisePropertyChanged(AvaloniaProperty property, Object oldValue, Object newValue, BindingPriority priority)
w Avalonia.AvaloniaObject.Avalonia.IPriorityValueOwner.Changed(PriorityValue sender, Object oldValue, Object newValue)
w Avalonia.PriorityValue.UpdateValue(Object value, Int32 priority)
w Avalonia.PriorityValue.LevelValueChanged(PriorityLevel level)
w Avalonia.PriorityLevel.set_DirectValue(Object value)
w Avalonia.AvaloniaObject.SetValue(AvaloniaProperty property, Object value, BindingPriority priority)
w Avalonia.AvaloniaObject.SetValue[T](AvaloniaProperty`1 property, T value, BindingPriority priority)
w Avalonia.Controls.Mixins.ContentControlMixin.<>c__DisplayClass1_0`1.<Attach>b__3(AvaloniaPropertyChangedEventArgs e)
w System.Reactive.AnonymousObserver`1.OnNextCore(T value)
w System.Reactive.ObserverBase`1.OnNext(T value)
w System.Reactive.Observer`1.OnNext(T value)
w System.Reactive.Subjects.Subject`1.OnNext(T value)
w Avalonia.AvaloniaObject.RaisePropertyChanged(AvaloniaProperty property, Object oldValue, Object newValue, BindingPriority priority)
w Avalonia.AvaloniaObject.ParentPropertyChanged(Object sender, AvaloniaPropertyChangedEventArgs e)
w System.EventHandler`1.Invoke(Object sender, TEventArgs e)
w Avalonia.AvaloniaObject.RaisePropertyChanged(AvaloniaProperty property, Object oldValue, Object newValue, BindingPriority priority)
w Avalonia.AvaloniaObject.Avalonia.IPriorityValueOwner.Changed(PriorityValue sender, Object oldValue, Object newValue)
w Avalonia.PriorityValue.UpdateValue(Object value, Int32 priority)
w Avalonia.PriorityValue.LevelValueChanged(PriorityLevel level)
w Avalonia.PriorityLevel.set_DirectValue(Object value)
w Avalonia.AvaloniaObject.SetValue(AvaloniaProperty property, Object value, BindingPriority priority)
w Avalonia.Controls.Control.OnDetachedFromLogicalTreeCore(LogicalTreeAttachmentEventArgs e)
w Avalonia.Controls.Control.Avalonia.LogicalTree.ILogical.NotifyDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e)
w Avalonia.Controls.Primitives.TemplatedControl.OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e)
w Avalonia.Controls.Control.OnDetachedFromLogicalTreeCore(LogicalTreeAttachmentEventArgs e)
w Avalonia.Controls.Control.OnDetachedFromLogicalTreeCore(LogicalTreeAttachmentEventArgs e)
w Avalonia.Controls.Control.OnDetachedFromLogicalTreeCore(LogicalTreeAttachmentEventArgs e)
w Avalonia.Controls.Control.Avalonia.Controls.ISetLogicalParent.SetParent(ILogical parent)
w Avalonia.Controls.Control.ClearLogicalParent(IEnumerable`1 children)
w Avalonia.Controls.Control.LogicalChildrenCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e)
w Avalonia.Collections.AvaloniaList`1.NotifyRemove(IList t, Int32 index)
w Avalonia.Collections.AvaloniaList`1.Remove(T item)
w Avalonia.Controls.Presenters.ContentPresenter.UpdateChild()
w Avalonia.Controls.Presenters.ContentPresenter.ApplyTemplate()
w Avalonia.Layout.Layoutable.MeasureCore(Size availableSize)
w Avalonia.Layout.Layoutable.Measure(Size availableSize)
w Avalonia.Layout.LayoutManager.Measure(ILayoutable control)
w Avalonia.Layout.LayoutManager.ExecuteMeasurePass()
w Avalonia.Layout.LayoutManager.ExecuteLayoutPass()
w Avalonia.Threading.JobRunner.RunJobs()
w Avalonia.Win32.Win32Platform.WndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam)
w Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
w Avalonia.Win32.Win32Platform.RunLoop(CancellationToken cancellationToken)
w Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
w Avalonia.Application.Run(ICloseable closable)
w Core2D.Avalonia.App.Start(IFileSystem fileIO, ILog log, ImmutableArray`1 writers) w C:\DOWNLOADS\GitHub-Core2D\Core2D\src\Core2D.Avalonia\App.xaml.cs:wiersz 181
<StackPanel Background="Yellow">
<TextBlock Text="Hello from Path" Classes="default"></TextBlock>
<Rectangle Width="100" Height="50" Fill="Orange"/>
<ListBox Name="listBox" Background="Red" VirtualizationMode="Simple">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<Panel Background="Green"/>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBoxItem Background="Purple">Path</ListBoxItem>
</ListBox>
</StackPanel>
Using above Xaml: the ListBox
is part of visual and logical tree, but its not rendered:
@wieslawsoltes have ben trying to look into this, but i'm unable to work out what a repro would look like in a sample project. Also i'm hoping #1032 might have fixed it. Was wondering if when you get a moment you could try it with latest Avalonia CI build and if it's still a problem, explain how to do a minimal repro?