Looking for wisdom from folks who have done more with source generators and analyzers than I have.
I'm prototyping enhancements to one of the standard ReactiveUI/DynamicData operators, and it seems like an obvious candidate for source-generation. Except I'm not sure how to "hook into" source generation, so to speak....
public static IObservable<TSource> WhenExpressionChanged<TSource, TResult>( this TSource source, Expression<Func<TSource, TResult>> expression);
public static IObservable<TSource> WhenExpressionChanged<TSource, TResult>( this TSource source, Expression<Func<TSource, TResult>> expression);
using var subscription = foo .WhenExpressionChanged(foo => foo.Bar.Baz) .Subscribe(...);
using var subscription = foo .WhenExpressionChanged(foo => foo.Bar.Baz) .Subscribe(...);
Currently, the expression gets parsed and a data structure is built to allow invoking the expression dynamically, checking for implementers of
INotifyPropertyChanged
INotifyPropertyChanged
, doing null checks, etc. There's lots of reflection and lost of boxing stuff to
object
object
, so a ripe candidate for both dynamic IL generation, and for source generation.