You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue occurs on every version of Avalonia after 11.1.0-beta1.
When changing MarkdownScollViewer.Markdown from "`Test`" to "Test" the following error is thrown:
System.InvalidCastException: Unable to cast object of type 'Avalonia.Media.Color' to type 'Avalonia.Media.IBrush'.
Exception Details
System.InvalidCastException
HResult=0x80004002
Message=Unable to cast object of type 'Avalonia.Media.Color' to type 'Avalonia.Media.IBrush'.
Source=Avalonia.Base
StackTrace:
at Avalonia.PropertyStore.EffectiveValue`1.GetValue(IValueEntry entry) in /_/src/Avalonia.Base/PropertyStore/EffectiveValue`1.cs:line 200
at Avalonia.PropertyStore.EffectiveValue`1.SetAndRaise(ValueStore owner, IValueEntry value, BindingPriority priority) in /_/src/Avalonia.Base/PropertyStore/EffectiveValue`1.cs:line 60
at Avalonia.PropertyStore.ValueStore.ReevaluateEffectiveValue(AvaloniaProperty property, EffectiveValue current, IValueEntry changedValueEntry, Boolean ignoreLocalValue) in /_/src/Avalonia.Base/PropertyStore/ValueStore.cs:line 990
at Avalonia.PropertyStore.ValueStore.Avalonia.Data.Core.IBindingExpressionSink.OnChanged(UntypedBindingExpressionBase instance, Boolean hasValueChanged, Boolean hasErrorChanged, Object value, BindingError error) in /_/src/Avalonia.Base/PropertyStore/ValueStore.cs:line 787
at Avalonia.Data.Core.UntypedBindingExpressionBase.PublishValue(Object value, BindingError error) in /_/src/Avalonia.Base/Data/Core/UntypedBindingExpressionBase.cs:line 437
at Avalonia.Data.Core.UntypedObservableBindingExpression.System.IObserver<System.Object>.OnNext(Object value) in /_/src/Avalonia.Base/Data/Core/UntypedObservableBindingExpression.cs:line 44
at Avalonia.Reactive.Observable.<>c__DisplayClass4_1`1.<Where>b__1(TSource input) in /_/src/Avalonia.Base/Reactive/Observable.cs:line 76
at Avalonia.Reactive.Observable.<>c__DisplayClass2_1`2.<Select>b__1(TSource input) in /_/src/Avalonia.Base/Reactive/Observable.cs:line 43
at Avalonia.Reactive.Operators.Sink`1.ForwardOnNext(TTarget value) in /_/src/Avalonia.Base/Reactive/Operators/Sink.cs:line 39
at Avalonia.Reactive.Operators.CombineLatest`2._.OnNext(Int32 index, TSource value) in /_/src/Avalonia.Base/Reactive/Operators/CombineLatest.cs:line 306
at Avalonia.Reactive.Operators.CombineLatest`2._.SourceObserver.OnNext(TSource value) in /_/src/Avalonia.Base/Reactive/Operators/CombineLatest.cs:line 355
at Avalonia.Reactive.LightweightObservableBase`1.PublishNext(T value) in /_/src/Avalonia.Base/Reactive/LightweightObservableBase.cs:line 149
at Avalonia.Data.Core.UntypedBindingExpressionBase.ObservableSink.PublishNext(Object value) in /_/src/Avalonia.Base/Data/Core/UntypedBindingExpressionBase.cs:line 605
at Avalonia.Data.Core.UntypedBindingExpressionBase.ObservableSink.Avalonia.Data.Core.IBindingExpressionSink.OnChanged(UntypedBindingExpressionBase instance, Boolean hasValueChanged, Boolean hasErrorChanged, Object value, BindingError error) in /_/src/Avalonia.Base/Data/Core/UntypedBindingExpressionBase.cs:line 583
at Avalonia.Data.Core.UntypedBindingExpressionBase.PublishValue(Object value, BindingError error) in /_/src/Avalonia.Base/Data/Core/UntypedBindingExpressionBase.cs:line 437
at Avalonia.Markup.Xaml.MarkupExtensions.DynamicResourceExpression.PublishValue() in /_/src/Markup/Avalonia.Markup.Xaml/Data/DynamicResourceExpression.cs:line 105
at Avalonia.Markup.Xaml.MarkupExtensions.DynamicResourceExpression.ActualThemeVariantChanged(Object sender, EventArgs e) in /_/src/Markup/Avalonia.Markup.Xaml/Data/DynamicResourceExpression.cs:line 93
at Avalonia.StyledElement.OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) in /_/src/Avalonia.Base/StyledElement.cs:line 642
at ColorTextBlock.Avalonia.CInline.OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) in F:\Software\Sandbox\Avalonia\RecreateMarkdownRenderErrors\Libraries\Markdown.Avalonia\ColorTextBlock.Avalonia\CInline.cs:line 196
at ColorTextBlock.Avalonia.CSpan.OnPropertyChanged(AvaloniaPropertyChangedEventArgs change) in F:\Software\Sandbox\Avalonia\RecreateMarkdownRenderErrors\Libraries\Markdown.Avalonia\ColorTextBlock.Avalonia\CSpan.cs:line 177
at Avalonia.AvaloniaObject.OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs change) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 703
at Avalonia.Animation.Animatable.OnPropertyChangedCore(AvaloniaPropertyChangedEventArgs change) in /_/src/Avalonia.Base/Animation/Animatable.cs:line 191
at Avalonia.AvaloniaObject.RaisePropertyChanged[T](AvaloniaProperty`1 property, Optional`1 oldValue, BindingValue`1 newValue, BindingPriority priority, Boolean isEffectiveValue) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 754
at Avalonia.PropertyStore.EffectiveValue`1.RaiseInheritedValueChanged(AvaloniaObject owner, AvaloniaProperty property, EffectiveValue oldValue, EffectiveValue newValue) in /_/src/Avalonia.Base/PropertyStore/EffectiveValue`1.cs:line 124
at Avalonia.PropertyStore.ValueStore.InheritedValueChanged(AvaloniaProperty property, EffectiveValue oldValue, EffectiveValue newValue) in /_/src/Avalonia.Base/PropertyStore/ValueStore.cs:line 922
at Avalonia.PropertyStore.ValueStore.InheritedValueChanged(AvaloniaProperty property, EffectiveValue oldValue, EffectiveValue newValue) in /_/src/Avalonia.Base/PropertyStore/ValueStore.cs:line 933
at Avalonia.PropertyStore.ValueStore.InheritedValueChanged(AvaloniaProperty property, EffectiveValue oldValue, EffectiveValue newValue) in /_/src/Avalonia.Base/PropertyStore/ValueStore.cs:line 933
at Avalonia.PropertyStore.ValueStore.SetInheritanceParent(AvaloniaObject newParent) in /_/src/Avalonia.Base/PropertyStore/ValueStore.cs:line 451
at Avalonia.AvaloniaObject.set_InheritanceParent(AvaloniaObject value) in /_/src/Avalonia.Base/AvaloniaObject.cs:line 82
at Avalonia.StyledElement.Avalonia.Controls.ISetLogicalParent.SetParent(ILogical parent) in /_/src/Avalonia.Base/StyledElement.cs:line 479
at Avalonia.StyledElement.ClearLogicalParent(IList children) in /_/src/Avalonia.Base/StyledElement.cs:line 982
at Avalonia.StyledElement.LogicalChildrenCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in /_/src/Avalonia.Base/StyledElement.cs:line 544
at Avalonia.Visual.LogicalChildrenCollectionChanged(Object sender, NotifyCollectionChangedEventArgs e) in /_/src/Avalonia.Base/Visual.cs:line 482
at Avalonia.Collections.AvaloniaList`1.NotifyRemove(T item, Int32 index) in /_/src/Avalonia.Base/Collections/AvaloniaList.cs:line 765
at Avalonia.Collections.AvaloniaList`1.Remove(T item) in /_/src/Avalonia.Base/Collections/AvaloniaList.cs:line 519
at Markdown.Avalonia.MarkdownScrollViewer.Wrapper.set_Document(DocumentElement value) in F:\Software\Sandbox\Avalonia\RecreateMarkdownRenderErrors\Libraries\Markdown.Avalonia\Markdown.Avalonia.Tight\MarkdownScrollViewer.cs:line 649
at Markdown.Avalonia.MarkdownScrollViewer.UpdateMarkdown() in F:\Software\Sandbox\Avalonia\RecreateMarkdownRenderErrors\Libraries\Markdown.Avalonia\Markdown.Avalonia.Tight\MarkdownScrollViewer.cs:line 325
at Markdown.Avalonia.MarkdownScrollViewer.set_Markdown(String value) in F:\Software\Sandbox\Avalonia\RecreateMarkdownRenderErrors\Libraries\Markdown.Avalonia\Markdown.Avalonia.Tight\MarkdownScrollViewer.cs:line 468
at RecreateMarkdownRenderErrors.Views.MainView.Button_Click(Object sender, RoutedEventArgs e) in F:\Software\Sandbox\Avalonia\RecreateMarkdownRenderErrors\RecreateMarkdownRenderErrors\Views\MainView.axaml.cs:line 14
at Avalonia.Interactivity.Interactive.<AddHandler>g__InvokeAdapter|4_0[TEventArgs](Delegate baseHandler, Object sender, RoutedEventArgs args) in /_/src/Avalonia.Base/Interactivity/Interactive.cs:line 64
at Avalonia.Interactivity.Interactive.<>c__4`1.<AddHandler>b__4_1(Delegate baseHandler, Object sender, RoutedEventArgs args) in /_/src/Avalonia.Base/Interactivity/Interactive.cs:line 70
at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e) in /_/src/Avalonia.Base/Interactivity/EventRoute.cs:line 167
at Avalonia.Interactivity.EventRoute.RaiseEvent(Interactive source, RoutedEventArgs e) in /_/src/Avalonia.Base/Interactivity/EventRoute.cs:line 101
at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e) in /_/src/Avalonia.Base/Interactivity/Interactive.cs:line 125
at Avalonia.Controls.Button.OnClick() in /_/src/Avalonia.Controls/Button.cs:line 347
at Avalonia.Controls.Button.OnPointerReleased(PointerReleasedEventArgs e) in /_/src/Avalonia.Controls/Button.cs:line 430
at Avalonia.Input.InputElement.<>c.<.cctor>b__32_9(InputElement x, PointerReleasedEventArgs e) in /_/src/Avalonia.Base/Input/InputElement.cs:line 225
at Avalonia.Reactive.LightweightObservableBase`1.PublishNext(T value) in /_/src/Avalonia.Base/Reactive/LightweightObservableBase.cs:line 149
at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e) in /_/src/Avalonia.Base/Interactivity/EventRoute.cs:line 141
at Avalonia.Interactivity.EventRoute.RaiseEvent(Interactive source, RoutedEventArgs e) in /_/src/Avalonia.Base/Interactivity/EventRoute.cs:line 101
at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e) in /_/src/Avalonia.Base/Interactivity/Interactive.cs:line 125
at Avalonia.Input.MouseDevice.MouseUp(IMouseDevice device, UInt64 timestamp, IInputRoot root, Point p, PointerPointProperties props, KeyModifiers inputModifiers, IInputElement hitTest) in /_/src/Avalonia.Base/Input/MouseDevice.cs:line 202
at Avalonia.Input.MouseDevice.ProcessRawEvent(RawPointerEventArgs e) in /_/src/Avalonia.Base/Input/MouseDevice.cs:line 90
at Avalonia.Input.MouseDevice.ProcessRawEvent(RawInputEventArgs e) in /_/src/Avalonia.Base/Input/MouseDevice.cs:line 37
at Avalonia.Input.InputManager.ProcessInput(RawInputEventArgs e) in /_/src/Avalonia.Base/Input/InputManager.cs:line 35
at Avalonia.Controls.TopLevel.<>c.<HandleInput>b__142_0(Object state) in /_/src/Avalonia.Controls/TopLevel.cs:line 846
at Avalonia.Threading.Dispatcher.Send(SendOrPostCallback action, Object arg, Nullable`1 priority) in /_/src/Avalonia.Base/Threading/Dispatcher.Invoke.cs:line 647
at Avalonia.Controls.TopLevel.HandleInput(RawInputEventArgs e) in /_/src/Avalonia.Controls/TopLevel.cs:line 835
at Avalonia.Win32.WindowImpl.AppWndProc(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) in /_/src/Windows/Avalonia.Win32/WindowImpl.AppWndProc.cs:line 818
at Avalonia.Win32.WindowImpl.WndProcMessageHandler(IntPtr hWnd, UInt32 msg, IntPtr wParam, IntPtr lParam) in /_/src/Windows/Avalonia.Win32/WindowImpl.cs:line 968
at Avalonia.Win32.Interop.UnmanagedMethods.DispatchMessage(MSG& lpmsg)
at Avalonia.Win32.Win32DispatcherImpl.RunLoop(CancellationToken cancellationToken) in /_/src/Windows/Avalonia.Win32/Win32DispatcherImpl.cs:line 111
at Avalonia.Threading.DispatcherFrame.Run(IControlledDispatcherImpl impl) in /_/src/Avalonia.Base/Threading/DispatcherFrame.cs:line 121
at Avalonia.Threading.Dispatcher.PushFrame(DispatcherFrame frame) in /_/src/Avalonia.Base/Threading/Dispatcher.MainLoop.cs:line 53
at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken) in /_/src/Avalonia.Base/Threading/Dispatcher.MainLoop.cs:line 80
at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 130
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, Action`1 lifetimeBuilder) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 263
at RecreateMarkdownRenderErrors.Program.Main(String[] args) in F:\Software\Sandbox\Avalonia\RecreateMarkdownRenderErrors\RecreateMarkdownRenderErrors\Program.cs:line 13
I recently ran into the same issue, it appears to be caused by the foreground binding in .CodeBlock and CCode, DivideColor (and in turn DivideConverter) does not product a brush.
This issue occurs on every version of Avalonia after
11.1.0-beta1
.When changing
MarkdownScollViewer.Markdown
from "`Test`" to "Test" the following error is thrown:Exception Details
A minimal sample to re-create this issue can be found here -> https://github.com/ArchLeaders/RecreateMarkdownRenderErrors
Please let me know if you need any other information.
The text was updated successfully, but these errors were encountered: