You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
A control defined in an F# class library cannot be animated because a FieldAccessException is raised.
System.FieldAccessException
HResult=0x80131507
Message=Attempt by method 'AvaloniaApplication1.MainWindow.!XamlIlPopulate(System.IServiceProvider, AvaloniaApplication1.MainWindow)' to access field 'ControlLibraryFS.StringFormatFloatTextBlock.ValueProperty' failed.
Source=AvaloniaApplication1
StackTrace:
at AvaloniaApplication1.MainWindow.!XamlIlPopulate(IServiceProvider , MainWindow ) in C:\temp\AvaloniaReflectionProb\AvaloniaApplication1\AvaloniaApplication1\MainWindow.axaml:line 15
at AvaloniaApplication1.MainWindow.!XamlIlPopulateTrampoline(MainWindow )
at AvaloniaApplication1.MainWindow.InitializeComponent() in C:\temp\AvaloniaReflectionProb\AvaloniaApplication1\AvaloniaApplication1\MainWindow.axaml.cs:line 19
at AvaloniaApplication1.MainWindow..ctor() in C:\temp\AvaloniaReflectionProb\AvaloniaApplication1\AvaloniaApplication1\MainWindow.axaml.cs:line 11
at AvaloniaApplication1.App.OnFrameworkInitializationCompleted() in C:\temp\AvaloniaReflectionProb\AvaloniaApplication1\AvaloniaApplication1\App.axaml.cs:line 18
at Avalonia.Controls.AppBuilderBase`1.Setup() in /_/src/Avalonia.Controls/AppBuilderBase.cs:line 313
at Avalonia.Controls.AppBuilderBase`1.SetupWithLifetime(IApplicationLifetime lifetime) in /_/src/Avalonia.Controls/AppBuilderBase.cs:line 180
at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime[T](T builder, String[] args, ShutdownMode shutdownMode) in /_/src/Avalonia.Controls/ApplicationLifetimes/ClassicDesktopStyleApplicationLifetime.cs:line 208
at AvaloniaApplication1.Program.Main(String[] args) in C:\temp\AvaloniaReflectionProb\AvaloniaApplication1\AvaloniaApplication1\Program.cs:line 14
The control works correctly without animation.
A similar control defined in a C# assembly can be animated.
Also if the F# control is defined in the same assembly as the Avalonia App, then the animation works (obviously this requires an F# Avalonia App project).
Running the app with the xaml as-is will attempt to animate the C# and F# controls. Commenting-out the animation style for the control in the cf namespace shows that the F# control works ok otherwise, and the C# version can animate.
Expected behavior
The F# control to behave the same way as the C# control under the animation.
Desktop (please complete the following information):
OS: Windows 10
Version 0.10.12
Additional context
Decompiling the F# assembly to C# in ILSpy shows that the main difference is that the property definitions are:
Describe the bug
A control defined in an F# class library cannot be animated because a
FieldAccessException
is raised.The control works correctly without animation.
A similar control defined in a C# assembly can be animated.
Also if the F# control is defined in the same assembly as the Avalonia App, then the animation works (obviously this requires an F# Avalonia App project).
To Reproduce
There is a repo with a C# app and the C# and F# versions of the control here
Running the app with the xaml as-is will attempt to animate the C# and F# controls. Commenting-out the animation style for the control in the
cf
namespace shows that the F# control works ok otherwise, and the C# version can animate.Expected behavior
The F# control to behave the same way as the C# control under the animation.
Desktop (please complete the following information):
Additional context
Decompiling the F# assembly to C# in ILSpy shows that the main difference is that the property definitions are:
in C#, but in F# they are:
Presumably this is handled OK by the setter used for
but not for
The text was updated successfully, but these errors were encountered: