8000 fix: TransitionContentControl throwing exception on control height zero by RLittlesII · Pull Request #2569 · reactiveui/ReactiveUI · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fix: TransitionContentControl throwing exception on control height zero #2569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 30, 2020

Conversation

RLittlesII
Copy link
Member

What kind of change does this PR introduce?

resolves: #2565

What is the current behavior?

GetRenderTargetBitmapFromUiElement throws an exception when ui.Element.RenderSize.Height is zero

What is the new behavior?

return a default value in the Height == 0 case

What might this PR break?

TransitionContentControl

Please check if the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Other information:

@glennawatson glennawatson added the release Gets released. label Oct 30, 2020
@codecov
Copy link
codecov bot commented Oct 30, 2020

Codecov Report

Merging #2569 into main will decrease coverage by 0.02%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2569      +/-   ##
==========================================
- Coverage   63.66%   63.63%   -0.03%     
==========================================
  Files         129      129              
  Lines        4612     4614       +2     
==========================================
  Hits         2936     2936              
- Misses       1676     1678       +2     
Impacted Files Coverage Δ
src/ReactiveUI.Wpf/TransitioningContentControl.cs 8.92% <0.00%> (-0.11%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1b40f74...3898015. Read the comment docs.

@vsab74
Copy link
vsab74 commented Jun 18, 2021

Hello,

I still have this issue with version ReactiveUI.WPF 13.3.2.

System.Reflection.TargetInvocationException: Une exception a été levée par la cible d'un appel. ---> System.ArgumentOutOfRangeException: La valeur du paramètre doit être supérieure à zéro.
Nom du paramètre : pixelHeight
   à System.Windows.Media.Imaging.RenderTargetBitmap..ctor(Int32 pixelWidth, Int32 pixelHeight, Double dpiX, Double dpiY, PixelFormat pixelFormat)
   à ReactiveUI.TransitioningContentControl.GetRenderTargetBitmapFromUiElement(UIElement uiElement) dans D:\a\ReactiveUI\ReactiveUI\src\ReactiveUI.Wpf\TransitioningContentControl.cs:ligne 242
   à ReactiveUI.TransitioningContentControl.QueueTransition(Object newContent) dans D:\a\ReactiveUI\ReactiveUI\src\ReactiveUI.Wpf\TransitioningContentControl.cs:ligne 293
   à ReactiveUI.TransitioningContentControl.OnContentChanged(Object oldContent, Object newContent) dans D:\a\ReactiveUI\ReactiveUI\src\ReactiveUI.Wpf\TransitioningContentControl.cs:ligne 219
   à System.Windows.Controls.ContentControl.OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
   à System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   à System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   à System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   à System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   à System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   à System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   à System.Windows.Controls.ContentControl.set_Content(Object value)
   à ReactiveUI.ViewModelViewHost.ResolveViewForViewModel(Object viewModel, String contract) dans D:\a\ReactiveUI\ReactiveUI\src\ReactiveUI\Platforms\windows-common\ViewModelViewHost.cs:ligne 216
   à ReactiveUI.ViewModelViewHost.<.ctor>b__7_5(<>f__AnonymousType0`2 x) dans D:\a\ReactiveUI\ReactiveUI\src\ReactiveUI\Platforms\windows-common\ViewModelViewHost.cs:ligne 100
   à System.Reactive.AnonymousSafeObserver`1.OnNext(T value) dans /_/Rx.NET/Source/src/System.Reactive/AnonymousSafeObserver.cs:ligne 44
   à System.Reactive.Sink`1.ForwardOnNext(TTarget value) dans /_/Rx.NET/Source/src/System.Reactive/Internal/Sink.cs:ligne 50
   à System.Reactive.Linq.ObservableImpl.CombineLatest`3._.SecondObserver.OnNext(TSecond value) dans /_/Rx.NET/Source/src/System.Reactive/Linq/Observable/CombineLatest.cs:ligne 177
   à System.Reactive.Sink`1.ForwardOnNext(TTarget value) dans /_/Rx.NET/Source/src/System.Reactive/Internal/Sink.cs:ligne 50
   à System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value) dans /_/Rx.NET/Source/src/System.Reactive/Linq/Observable/Select.cs:ligne 48
   à System.Reactive.Subjects.Subject`1.OnNext(T value) dans /_/Rx.NET/Source/src/System.Reactive/Subjects/Subject.cs:ligne 147
   à ReactiveUI.ViewModelViewHost.ViewModelChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs) dans D:\a\ReactiveUI\ReactiveUI\src\ReactiveUI\Platforms\windows-common\ViewModelViewHost.cs:ligne 188
   à System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   à System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)
   à System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)
   à System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)
   à System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)
   à System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)
   à ReactiveUI.ViewModelViewHost.set_ViewModel(Object value) dans D:\a\ReactiveUI\ReactiveUI\src\ReactiveUI\Platforms\windows-common\ViewModelViewHost.cs:ligne 141
   --- Fin de la trace de la pile d'exception interne ---
   à System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   à System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
   à System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   à System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, BindingFlags invokeAttr, Binder binder, Object[] index, CultureInfo culture)
   à System.Reflection.RuntimePropertyInfo.SetValue(Object obj, Object value, Object[] index)
   à ReactiveUI.PropertyBinderImplementation.<>c__DisplayClass11_0`3.<BindToDirect>g__SetThenGet|0(Object paramTarget, Object paramValue, Object[] paramParams) dans D:\a\ReactiveUI\ReactiveUI\src\ReactiveUI\Bindings\Property\PropertyBinderImplementation.cs:ligne 331
   à ReactiveUI.PropertyBinderImplementation.<>c__DisplayClass11_0`3.<BindToDirect>b__7(<>f__AnonymousType0`2 x) dans D:\a\ReactiveUI\ReactiveUI\src\ReactiveUI\Bindings\Property\PropertyBinderImplementation.cs:ligne 352
   à System.Reactive.Linq.ObservableImpl.Select`2.Selector._.OnNext(TSource value) dans /_/Rx.NET/Source/src/System.Reactive/Linq/Observable/Select.cs:ligne 39

I have this issue only if in the Windows settings I change the Display scale to 125%.
The debugger is telling me this uiElement.RenderSize.Height = 0.02 this is why this fix didn't work for me.

@parisq
Copy link
parisq commented Jun 22, 2021

Same issue for me

@reactiveui reactiveui locked and limited conversation to collaborators Jun 22, 2021
@glennawatson
Copy link
Contributor

Feel free to open a issue. Old pr will tend to be ignored so probably not the best place to raise issues.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
release Gets released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] (WPF) When a TransitioningContentControl's initial actual width or height is 0, it throws an exception in v12.1.1
4 participants
0