Obfuscating an Avalonia app: compiled bindings, the ViewLocator convention, and what the XAML compiler already made rename-safe
DEV Community
Obfuscating an Avalonia app: compiled bindings, the ViewLocator convention, and what the XAML compiler already made rename-safe
Avalonia is not WPF with a different logo, and the difference matters the moment you obfuscate it. Avalonia compiles your .axaml to IL at build time, so a compiled binding is a typed property accessor that references the getter by metadata token — it survives a full rename untouched — while a reflection binding is a string the runtime resolves by name and silently comes back empty. The thing that breaks first is neither: it is the ViewLocator in the default MVVM template, which finds a view by taking the view model''s type name, replacing "ViewModel" with "View" and calling Type.GetType — a convention that a rename turns into a "Not Found" TextBlock or an InvalidCastException. This post reads what the XAML compiler actually emits for a compiled binding, shows why INotifyPropertyChanged still matches after renaming, walks the two Avalonia-generated types the runtime locates with Assembly.GetType by their literal names, and gives the Nebula configuration and the DataTemplate-based view mapping that let you flatten the whole app without touching the parts Avalonia resolves by name.
0 comments
No comments yet.