wpf
wpf copied to clipboard
Non existing event subscriptions should raise a build error
If you subscribe to any event in XAML (like KeyDown) but the method doesn't exist in your C# code, you can still successfully build your project. But if you run it and the XAML is executed your application crashes.
And because of the fact that it crashes the application (unlike a non existing binding) it should be analyzed and throw an error during the build.
I think the main issues it perform the runtime bind the event.
I'm sorry but what do you mean?
The xaml can not check more thing in the build time.
Why not? Other XAML frameworks do, and this would make future X:Bind support (compiled bindings) easier
@franchyd Yes, you are right. If we can bring the xaml to build time, such as SourceGenerator, that we can handle this issues. And bring the SourceGenerator to xaml is what I look to.
Well technically developers do not need to rely on the built-in InitializeComponents and could handle the XAML themselves. Not saying that many (or any) do, but it could be potentially breaking change.