question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Designer throws an exception with control behavior

See original GitHub issue

Hello, 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:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
grokyscommented, May 14, 2020

@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.

0reactions
rstm-sfcommented, Nov 12, 2020

Maybe, in 0.10 it is not necessary to indicate public https://github.com/AvaloniaUI/Avalonia/pull/4985

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found