Signature (parameter 1) of EventHandler "OnFilterTextChanged" doesn't match the event type
Control:
public delegate void SelectedTextChangedEventHandler(object sender, TextChangedEventArgs args);
public event SelectedTextChangedEventHandler TextChanged;
XAML:
<controls:EntryEx TextChanged="OnFilterTextChanged"/>
Code:
private void OnFilterTextChanged(object sender, EventArgs args) // Error
private void OnFilterTextChanged(object sender, TextChangedEventArgs args) // OK
@mknotzer Are you talking about a third-party project of some sort? Forms doesn't contain a control called "EntryEx".
EntryEx is one of my controls. Nothing special, however since 3.3.0 I get a compiler error which doesn't make sense as TextChangedEventArgs are subclassed from EventArgs.
could you please:
Thanks a lot
as a workaround, you can define your event this way, and avoid declaring a delegate
public event EventHandler<TextChangedEventArgs> TextChanged;
XamlC seems like it only wants the event handler with EventArgs, although TextChangedEventArgs is derived from EventArgs.
Not sure, I think the issue is XamlC choosing the TextChanged event from Entry, not the TextChanged event from the derived class EntryEx (maybe an issue with reflection?)
What's interesting is when disabling XamlC it works (meaning the app works fine, there's no error thrown at run time, but I don't know if the event is really thrown how mknotzer implemented it):
[assembly: XamlCompilation(XamlCompilationOptions.Skip)]
@mknotzer Can you confirm it's working for you if you change to XamlCompilationOptions.Skip in App.xaml.cs?
@mknotzer Please attach a reproduction case so that @StephaneDelcroix should debug it
The error only occurs with
[assembly: XamlCompilation(XamlCompilationOptions.Compile)]
No error message with
[assembly: XamlCompilation(XamlCompilationOptions.Skip)]
workaround is working
public event EventHandler<TextChangedEventArgs> TextChanged
Hello,
I started experiencing this issue after updating Xamarin.Forms to version 3.6.0.293080. Came up with a workaround by switching "TappedEventArgs" to just "EventArgs" in my code behind. Any update on the status of this issue?
@DieselSoup @FreedomDesi this issue is closed. if you have a similar one with 3.6.0, please open a new issue, AND ATTACH A SMALL REPRO PROJECT. ping me when it's done, and I'll look at it
Thanks a lot.
see #5887 for reopened issue
Hello,
I started experiencing this issue after updating Xamarin.Forms to version 3.6.0.293080. Came up with a workaround by switching "TappedEventArgs" to just "EventArgs" in my code behind. Any update on the status of this issue?
If you have to changed TappedEventArgs to EventArgs then no issue will happening in code behind.In latest Xamarin forms you must change the all events like "SelectedItemChangedEventArgs" to "EventArgs" and all Button click events must have (object sender, EventArgs e) parameter.
Most helpful comment
Hello,
I started experiencing this issue after updating Xamarin.Forms to version 3.6.0.293080. Came up with a workaround by switching "TappedEventArgs" to just "EventArgs" in my code behind. Any update on the status of this issue?