Designer throws an exception with control behavior
See original GitHub issueHello, I am using Avalonia.Xaml.Behaviors, I have created my own behavior, added it to TextBox like this
<TextBox>
<i:Interaction.Behaviors>
<beh:KeepTextBoxFocusBehavior />
</i:Interaction.Behaviors>
</TextBox>
but the designer keeps crashing, in the error list I have Exception has been thrown by the target of an invocation
. When I run that app, it works as it has, so it’s only designer’s problem.
As soon as I remove <beh:KeepTextBoxFocusBehavior />
, it reappears again.
Any ideas how to fix it? Or disable project code in designer?
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Avoid throwing exceptions as control flow - by Ray Chong
The exception is a mechanism to stop unexpected behavior in software development. When we get an unexpected behavior, we tend to throw an ......
Read more >WPF UserControl throws exception in design mode
XAML designer will call the UserControl's constructor when loading in designer. If in the constructor or UserControl.
Read more >Exception Throwing - Framework Design Guidelines
When an exception filter raises an exception, the exception is caught by the CLR, and the filter returns false. This behavior is ...
Read more >What's the logic behind the design of exceptions?
An "exception" solves that problem: the application writes without checking, and in the unlikely event there's an error then an exception is ...
Read more >9.14. Exception Handling
Throw statements always interrupt a program's normal flow of control. Programs skip statements following a throw statement and a function call that throws...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Deadpikle in your case the designer is failing because
MyTextBox
is internal and and the XAML compiler’s System.Reflection.Emit backend is unable to work with internal types currently. Not sure if we can fix this, will investigate.Still need to work out what’s happening with behaviors.
Maybe, in 0.10 it is not necessary to indicate public https://github.com/AvaloniaUI/Avalonia/pull/4985