Open ivar-rummelhoff opened 3 years ago
Does this resolve your issue?
https://github.com/reactiveui/ReactiveUI/issues/2037#issuecomment-493662223
I am not 100% sure what you suggest, but setting
RxApp.SuppressViewCommandBindingMessage = true;
does not appear to have any effect on these warnings in ReactiveUI.Winforms 13.2.2.
I also have this problem. How can I solve it。 I try to add this line "RxApp.SuppressViewCommandBindingMessage = true;" but it's nothing has changed
This setting still doesnt work.
I did set the supress to true, but I am still getting:
2021-11-04 08:46:47.2027|WARN|ReactiveUI.POCOObservableForProperty|The class KardexTerminal_PDA_WPF.MainWindow property ViewModelViewHost_SerialInput is a POCO type and won't send change notifications, WhenAny will only return a single value!
2021-11-04 08:46:47.2249|WARN|ReactiveUI.POCOObservableForProperty|The class KardexTerminal_PDA_WPF.MainWindow property ViewModelViewHost_ReorderLogs is a POCO type and won't send change notifications, WhenAny will only return a single value!
2021-11-04 08:46:47.2416|WARN|ReactiveUI.POCOObservableForProperty|The class Wms.Wpf.Services.ShutdownService property ShutdownCommand is a POCO type and won't send change notifications, WhenAny will only return a single value!
This problem still exists for WPF. And it dirties up the logs significantly. If you are using Serilog, I recommend Serilog.Expressions, makes it really easy to filter them out at that level.
This problem still exists for WPF. And it dirties up the logs significantly. If you are using Serilog, I recommend Serilog.Expressions, makes it really easy to filter them out at that level.
This worked for me since I couldn't get messages to stop by setting RxApp.SuppressViewCommandBindingMessage = true
Since how to do this didn't immediately click for me, for anyone else in the same boat, these are the steps that worked for me:
Splat.Serilog
and Serilog.Expressions
Log.Logger = new LoggerConfiguration()
.Filter.ByExcluding(x=> x.Exception?.Message.StartsWith("POCOObservableForProperty: The class") == true)
.CreateLogger();
Locator.CurrentMutable.UseSerilogFullLogger(Log.Logger)
I ran into this in WPF and this warning message is very confusing because all of the bindings work correctly despite the warning suggesting otherwise. And the documentation suggests binding in a way that produces this exact warning (see docs here: https://www.reactiveui.net/docs/handbook/data-binding/windows-presentation-foundation).
I eliminated the warnings by overriding the property resolver, see also this question on stackoverflow: https://stackoverflow.com/questions/30352447/using-reactiveuis-bindto-to-update-a-xaml-property-generates-a-warning
Using the following code eliminates the warnings and all of the bindings continue to work:
public class CustomPropertyResolver : ICreatesObservableForProperty
{
public int GetAffinityForObject(Type type, string propertyName, bool beforeChanged = false) => 1;
public IObservable<IObservedChange<object, object>> GetNotificationForProperty(object sender, System.Linq.Expressions.Expression expression, string propertyName, bool beforeChanged = false, bool suppressWarnings = false)
{
return Observable.Return(new ObservedChange<object, object>(sender, expression, default), RxApp.MainThreadScheduler)
.Concat(Observable.Never<IObservedChange<object, object>>());
}
}
Then in main/app startup before creating the bindings:
Locator.CurrentMutable.Register(() => new CustomPropertyResolver(), typeof(ICreatesObservableForProperty));
The warning message comes from this implementation here (which is what I based the code above on): https://github.com/reactiveui/ReactiveUI/blob/main/src/ReactiveUI/ObservableForProperty/POCOObservableForProperty.cs
The bug seems to be the bindings always falling through to that POCOObservableForProperty
class.
Stack OverflowI'm trying to update a property of an element in the XAML of a view: this.WhenAnyValue(x => x.ViewModel.IsEnabled).BindTo(this, x => x.MyButton.IsEnabled); This works as expected, however, it
GitHub
An advanced, composable, functional reactive model-view-viewmodel framework for all .NET platforms that is inspired by functional reactive programming. ReactiveUI allows you to abstract mutable st...
I started getting these warnings after upgrading a project to ReactiveUI.WinForms v13.1.1 from an old version. This also happens when upgrading ReactiveUI.Winforms.Samples.Bindings in https://github.com/Asesjix/ReactiveUI.Winforms.Samples (linked to from https://www.reactiveui.net/docs/resources/samples):
These are the statements that result in the warnings above, written to the console when debugging:
Unless there is a better way to set up such bindings now, I believe these warnings should be silenced.
Environment