Open Metadorius opened 4 months ago
Thanks,
Third party libraries are a bit hard for us to test against even with trials.
Is PaintEx a generic type?
Third party libraries are a bit hard for us to test against even with trials.
Let me help you then.
This is what gets generated:
public global::System.IObservable<global::DevExpress.Utils.XtraPaintEventArgs> PaintEx=>global::System.Reactive.Linq.Observable.Create<global::DevExpress.Utils.XtraPaintEventArgs>(obs=>
{
void Handler( object sender, global::DevExpress.Utils.XtraPaintEventArgs e) =>obs.OnNext(e);
_data.PaintEx+=Handler;
return global::System.Reactive.Disposables.Disposable.Create(() => _data.PaintEx-=Handler);
});
The analysis-reported error:
I digged into decompile and figured out that the base XtraControl
that is used by all DevExpress controls has PaintEx
method which gets picked up by the source generator:
public event XtraPaintEventHandler PaintEx
{
add => this.Events.AddHandler(XtraControl.paintEx, (Delegate) value);
remove => this.Events.RemoveHandler(XtraControl.paintEx, (Delegate) value);
}
The TextEdit
and other controls define another event that hides the parent's event with another signature:
public event TextEditPaintExEventHandler PaintEx
{
add => this.Events.AddHandler(TextEdit.paintEx, (Delegate) value);
remove => this.Events.RemoveHandler(TextEdit.paintEx, (Delegate) value);
}
So it seems to me that the source generator just incorrectly uses the hidden event instead of the new one.
Any news? Or perhaps there is some existing workaround for the time being to somehow disable some part of the codegen just to make it compile, apart from manually doing ye olde FromEventPattern?
Description
When using the source generator on newest DevExpress WinForms controls (using .NET Framework 4.8) the result can't be compiled because of some wrongly generated code. It seems that
PaintEx
signature differs from what the source generator assumes, so the result can't be compiled.How to repro
Result
The following error pops up on compilation: