Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

binding error in scrollviewer #11148

Closed
aldelaro5 opened this issue Apr 27, 2023 · 5 comments · Fixed by #11456
Closed

binding error in scrollviewer #11148

aldelaro5 opened this issue Apr 27, 2023 · 5 comments · Fixed by #11456
Labels

Comments

@aldelaro5
Copy link
Contributor

Describe the bug
Since preview7, I am seeing a binding error for each scrollviewer present. I am not even attempting to bind anything, its presence is enough to cause this error to be logged.

To Reproduce
In the Sandbox project, change the Window to be this:

<Window xmlns="https://github.com/avaloniaui"
        xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
        x:Class="Sandbox.MainWindow">
  <ScrollViewer/>
</Window>

And (still don't know why this is needed), add these to the end of OnFrameworkInitializationCompleted:

Trace.Listeners.Add(new TextWriterTraceListener(Console.Out));
Trace.AutoFlush = true;

Now start the app, you should see an error like:

[Binding]Error in binding to 'Avalonia.Input.GestureRecognizers.ScrollGestureRecognizer'.'IsScrollInertiaEnabled': 'Null value in expression '{empty}' at '$self.TemplatedParent'.'(ScrollGestureRecognizer #44307222)

Expected behavior
To not see this binding error.

Desktop (please complete the following information):

@aldelaro5 aldelaro5 added the bug label Apr 27, 2023
@maxkatz6 maxkatz6 changed the title Preview7: binding error in scrollviewer binding error in scrollviewer Apr 27, 2023
@amwx
Copy link
Contributor

amwx commented Apr 27, 2023

Based on the discussion in #5762, there isn't really anything that can be done as these are thrown from AvaloniaObjects that don't have a concept of being "attached". But these errors are showing up more often now, so could logging binding errors just be turned off by default? The push for CompiledBinding would mostly mitigate this, StaticResource throws an exception, and I don't think I've ever seen a DynamicResource error (that would've made some things easier); and with the number of logged errors showing up now it makes it difficult to find a "true" error if one pops up

@aldelaro5
Copy link
Contributor Author

I don't think it's a good idea: I still get very useful binding errors and I am using compiled bindings all the way (even compatible with trimming).

My problem is more that I am seeing errors in places that I don't know if avalonia has issues or not. There's #10846 that I opened which this one I doubt means nothing because there's def some problems related to tabs I been getting notably #9438 being by far the worst one I am experiencing (had to do a workaround actually).

So if there is noise, then it's not as simple as turn it off completely.

@llfab
Copy link

llfab commented May 4, 2023

I agree, such errors are useful. If they become more and more noisy they are not helping. If the only solution was to turn them off, then you could even remove them from the code completely (which I would not want)

@llfab
Copy link

llfab commented May 4, 2023

Logging seems to be implemented in a quite generic fashion, hence, the objects throwing a warning do not have the context to decide whether that actually is a warning. So maybe that generic concept is not so good? Yes, it seems that putting that into less generic places would be some work.

@grokys
Copy link
Member

grokys commented May 5, 2023

I agree this is really annoying, will try to fix at some point soon - sorry, we've been prioritising serious bugs and breaking changes and although this isn't one, it needs to be addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants