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.

Custom Converter stop working at nightly versions

See original GitHub issue

Description:

I have a IValueConverter which works just fine at Avalonia 11 preview.4 but it stops working somewhere in between 11.0.999-cibuild0026023-beta and 11.0.999-cibuild0026698-beta and still not working at latest nightly. It feels like a regression or some non-obvious change in styling / binding / APIs, requiring me to somehow update my code in a non-obvious way.

Steps to reproduce:

I can’t share the converter code on public, thus can provide only abstracted steps to follow:

  1. Add MyConverter : IValueConverter to the project.
  2. Declare it as StaticResource in Application.Resources, i.e. <ns:MyConverter x:Key="MyConverter"/>.
  3. Add this converter to Opacity property of any Visual with class myClass, i.e.:
<Style Selector=":is(Visual).myClass">
	<Setter Property="Transitions">
		<Transitions>
			<DoubleTransition Property="Opacity" Duration="0:0:1"/>
		</Transitions>
	</Setter>
	    
	<Setter Property="Opacity">
		<Binding Converter="{StaticResource MyConverter}"/>
	</Setter>
</Style>
  1. Put this Style Selector into the Application.Styles (I did this using <StyleInclude Source="/Styles/MyStyles.axaml" />).
  2. Add class myClass to any Visual and change its Opacity using Binding: <Image Classes="spinner myClass" Opacity="{Binding IsBusy}"/>

MyConverter should convert bool to double in order to test the behavior, and bool IsBusy should be set to true first and change to false after a few seconds.

See it doesn’t change Opacity in nightly builds since 11.0.999-cibuild0026698-beta and at least till the 11.0.999-cibuild0028309-beta (currently latest available), while it working fine and change the Opacity in 11 preview.4 and 11.0.999-cibuild0026023-beta nightly.

Expected behavior Opacity changes using declared Transition according to the converted IsBusy -> 1 value.

Environment:

  • OS: Windows 11 22H2

Issue Analytics

  • State:open
  • Created 8 months ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rabbitismcommented, Jan 8, 2023

For the context, I found that bool to double implicit conversion is done here: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Base/Utilities/TypeUtilities.cs#L202

Can you also help to review my geometry converter PR? I think there is implicit conversion in compile phase but I’m not sure.

1reaction
maxkatz6commented, Jan 8, 2023

For the context, I found that bool to double implicit conversion is done here: https://github.com/AvaloniaUI/Avalonia/blob/master/src/Avalonia.Base/Utilities/TypeUtilities.cs#L202

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom converter for deserialization not firing or not hitting ...
Since I have a different format for dates I am using a converter. So for Web API/Task.Run do we need to do anything...
Read more >
TRT Converter not working in 2.7.0 version of official image
TRT Converter not working in 2.7.0 version of official image #53529 ... Have I written custom code (as opposed to using a stock...
Read more >
SFP to Ethernet Converter Stopped Working
I have been using TP-Link MC220L Media Converters with ERPro's for the last couple of years. Last night I could not get it...
Read more >
Custom Converters :: Debezium Documentation
The converter ignores columns that do not match the specified criteria. Custom converters are Java classes that implement the Debezium service provider ...
Read more >
How to write custom converters for JSON serialization - .NET
This article shows how to create custom converters for the JSON serialization classes that are provided in the System.Text.Json namespace.
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