GithubHelp home page GithubHelp logo

Support AoT/Trimming about dock HOT 4 CLOSED

dmirmilshteyn avatar dmirmilshteyn commented on June 7, 2024
Support AoT/Trimming

from dock.

Comments (4)

wieslawsoltes avatar wieslawsoltes commented on June 7, 2024

Here is my attempt to create AOT friendly json serializer https://github.com/wieslawsoltes/Dock/tree/master/src/Dock.Model.Avalonia/Json

from dock.

wieslawsoltes avatar wieslawsoltes commented on June 7, 2024

The Avalonia portions (controls) should be already AOT friendly (did not test recently). The models need to support Json AOT serializer. The MVVM https://github.com/wieslawsoltes/Dock/tree/master/src/Dock.Model.Mvvm should be easy to add support, much harder is Avalonia Model https://github.com/wieslawsoltes/Dock/tree/master/src/Dock.Model.Avalonia

from dock.

dmirmilshteyn avatar dmirmilshteyn commented on June 7, 2024

Interesting, when I try to do aot compilation on any app that includes this control (including the sample notepad app), I end up with compilation errors. I guess initially I thought it might be related to the lack of compiled bindings, but going through the error again, it looks like this might actually be a compiler error (!?). Have you seen this before?

There still are trim warnings though, which are essentially the following (lots more than just these):

C:\Code\Dock\src\Dock.Avalonia\Controls/DocumentContentControl.axaml(12): Trim analysis warning IL2026: CompiledAvaloniaXaml.!AvaloniaResources.XamlClosure_17.XamlClosure_18.Build(IServiceProvider): Using member 'Avalonia.Markup.Xaml.MarkupExtensions.ReflectionBindingExtension.ReflectionBindingExtension()' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. BindingExpression and ReflectionBinding heavily use reflection. Consider using CompiledBindings instead. [C:\Code\Dock\samples\Notepad\Notepad.csproj]
C:\Code\Dock\src\Dock.Avalonia\Controls/DocumentContentControl.axaml(13): Trim analysis warning IL2026: CompiledAvaloniaXaml.!AvaloniaResources.XamlClosure_17.XamlClosure_18.Build(IServiceProvider): Using member 'Avalonia.Markup.Xaml.MarkupExtensions.ReflectionBindingExtension.ReflectionBindingExtension()' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. BindingExpression and ReflectionBinding heavily use reflection. Consider using CompiledBindings instead. [C:\Code\Dock\samples\Notepad\Notepad.csproj]
C:\Code\Dock\src\Dock.Avalonia\Controls/DockDockControl.axaml(18): Trim analysis warning IL2026: CompiledAvaloniaXaml.!AvaloniaResources.XamlClosure_12.XamlClosure_13.Build(IServiceProvider): Using member 'Avalonia.Markup.Xaml.MarkupExtensions.ReflectionBindingExtension.ReflectionBindingExtension(String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. BindingExpression and ReflectionBinding heavily use reflection. Consider using CompiledBindings instead. [C:\Code\Dock\samples\Notepad\Notepad.csproj]
C:\Code\Dock\src\Dock.Avalonia\Controls/DockDockControl.axaml(22): Trim analysis warning IL2026: CompiledAvaloniaXaml.!AvaloniaResources.XamlClosure_12.XamlClosure_13.Build(IServiceProvider): Using member 'Avalonia.Markup.Xaml.MarkupExtensions.ReflectionBindingExtension.ReflectionBindingExtension(String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. BindingExpression and ReflectionBinding heavily use reflection. Consider using CompiledBindings instead. [C:\Code\Dock\samples\Notepad\Notepad.csproj]

The potential compiler error:

  <unknown>:0: error: assembler label '' can not be undefined
  <unknown>:0: error: assembler label '' can not be undefined
  <unknown>:0: error: assembler label '' can not be undefined
  <unknown>:0: error: assembler label '' can not be undefined
  <unknown>:0: error: assembler label '' can not be undefined
  <unknown>:0: error: assembler label '' can not be undefined
  <unknown>:0: error: assembler label '' can not be undefined
  <unknown>:0: error: assembler label '' can not be undefined
  <unknown>:0: error: assembler label '' can not be undefined
  <unknown>:0: error: assembler label '' can not be undefined
  <unknown>:0: error: assembler label '' can not be undefined
  <unknown>:0: error: assembler label '' can not be undefined
  <unknown>:0: error: assembler label '' can not be undefined
  <unknown>:0: error: assembler label '' can not be undefined
EXEC : error : Arithmetic operation resulted in an overflow. [C:\Code\Dock\samples\Notepad\Notepad.csproj]
  System.OverflowException: Arithmetic operation resulted in an overflow.
     at Internal.Runtime.CompilerHelpers.ThrowHelpers.ThrowOverflowException() + 0x24
     at ILCompiler.DependencyAnalysis.InterfaceDispatchMapNode.EmitDispatchMap(ObjectDataBuilder&, NodeFactory) + 0x2a2e
     at ILCompiler.DependencyAnalysis.InterfaceDispatchMapNode.GetData(NodeFactory, Boolean) + 0x111
     at ILCompiler.DependencyAnalysis.ObjectWriter.EmitObject(String, IReadOnlyCollection`1, NodeFactory, ObjectWritingOptions, IObjectDumper, Logger) + 0x50f
     at ILCompiler.RyuJitCompilation.CompileInternal(String, ObjectDumper) + 0xad
     at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String, ObjectDumper) + 0x2d
     at ILCompiler.Program.Run() + 0x2778
     at ILCompiler.ILCompilerRootCommand.<>c__DisplayClass221_0.<.ctor>b__0(ParseResult result) + 0x315

This happens when attempting to publish with PublishAot set to true in the project, not during a regular compile.

from dock.

wieslawsoltes avatar wieslawsoltes commented on June 7, 2024

Its runtime bug not Dock issue

from dock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.