teobugslayer / avaloniacorertdemo Goto Github PK
View Code? Open in Web Editor NEWA sample showing how to use Avalonia UI and CoreRT
License: MIT License
A sample showing how to use Avalonia UI and CoreRT
License: MIT License
hello, i had git clone the code in windows,
dotnet publish -r win-x64 -c release
error info here:
EXEC : error : Value cannot be null. (Parameter 'key') [D:\code\avacorert\src\AvaloniaCoreRTDemo.csproj]
System.ArgumentNullException: Value cannot be null. (Parameter 'key')
at System.Collections.Generic.Dictionary`2.FindValue(TKey key)
at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
at ILCompiler.AnalysisBasedMetadataManager.Policy.GeneratesMetadata(EcmaModule module, ExportedTypeHandle exportedTypeHandle)
at ILCompiler.Metadata.Transform`1.HandleTypeForwarders(EcmaModule module)
at ILCompiler.Metadata.Transform`1.InitializeScopeDefinition(ModuleDesc module, ScopeDefinition scopeDefinition)
at ILCompiler.Metadata.EntityMap`2.GetOrCreate[TConcreteEntity,TConcreteRecord](TConcreteEntity entity, Action`2 initializer)
at ILCompiler.Metadata.Transform`1.HandleNamespaceDefinition(ModuleDesc parentScope, String namespaceString)
at ILCompiler.Metadata.Transform`1.InitializeTypeDef(MetadataType entity, TypeDefinition record)
at ILCompiler.Metadata.EntityMap`2.Create[TConcreteEntity,TConcreteRecord](TConcreteEntity entity, Action`2 initializer)
at ILCompiler.Metadata.Transform`1.HandleType(TypeDesc type)
at ILCompiler.Metadata.MetadataTransform.Run[TPolicy](TPolicy policy, IEnumerable`1 modules)
at ILCompiler.GeneratingMetadataManager.ComputeMetadata[TPolicy](TPolicy policy, NodeFactory factory, Byte[]& metadataBlob, List`1& typeMappings, List`1& methodMappings, List`1& fieldMappings, List`1& stackTraceMapping)
at ILCompiler.AnalysisBasedMetadataManager.ComputeMetadata(NodeFactory factory, Byte[]& metadataBlob, List`1& typeMappings, List`1& methodMappings, List`1& fieldMappings, List`1& stackTraceMapping)
at ILCompiler.DependencyAnalysis.MetadataNode.GetData(NodeFactory factory, Boolean relocsOnly)
at ILCompiler.DependencyAnalysis.ObjectWriter.EmitObject(String objectFilePath, IEnumerable`1 nodes, NodeFactory factory, ObjectWritingOptions options, IObjectDumper dumper)
at ILCompiler.RyuJitCompilation.CompileInternal(String outputFile, ObjectDumper dumper)
at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String outputFile, ObjectDumper dumper)
at ILCompiler.Program.Run(String[] args)
at ILCompiler.Program.Main(String[] args)
C:\Users\timiil\.nuget\packages\microsoft.dotnet.ilcompiler\6.0.0-preview.4.21206.3\build\Microsoft.NETCore.Native.targets(259,5): error MSB3073: 命令“"C:\Users\timiil\.nuget\packages\runtime.win-x64.microsoft.dotnet.ilcompiler\6.0.0-preview.4.21206.3\tools\ilc" @"obj\Release\net5.0\win-x64\native\AvaloniaCoreRTDemo.ilc.rsp"”已退出,代码为 1。 [D:\code\avacorert\src\AvaloniaCoreRTDemo.csproj]
Input box does not support Chinese
Hi, I tried to compile and run this sample in macOS.
$ AvaloniaCoreRTDemo$ dotnet publish -r osx-x64 -c release
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
Restored /Users/danipen/Documents/GitHub/AvaloniaCoreRTDemo/src/AvaloniaCoreRTDemo.csproj (in 1.79 sec).
GenerateAvaloniaResourcesTask -> Root: /Users/danipen/Documents/GitHub/AvaloniaCoreRTDemo/src, 4 resources, Output:obj/Release/net5.0/osx-x64//Avalonia/resources
avares -> name:/AboutWindow.xaml, path: /Users/danipen/Documents/GitHub/AvaloniaCoreRTDemo/src/AboutWindow.xaml, size:6946, ItemSpec:AboutWindow.xaml
avares -> name:/App.xaml, path: /Users/danipen/Documents/GitHub/AvaloniaCoreRTDemo/src/App.xaml, size:405, ItemSpec:App.xaml
avares -> name:/MainWindow.xaml, path: /Users/danipen/Documents/GitHub/AvaloniaCoreRTDemo/src/MainWindow.xaml, size:1550, ItemSpec:MainWindow.xaml
avares -> name:/app.ico, path: /Users/danipen/Documents/GitHub/AvaloniaCoreRTDemo/src/app.ico, size:183198, ItemSpec:app.ico
AvaloniaCoreRTDemo -> /Users/danipen/Documents/GitHub/AvaloniaCoreRTDemo/src/bin/Release/net5.0/osx-x64/AvaloniaCoreRTDemo.dll
Generating native code
/Users/danipen/.nuget/packages/avalonia/0.10.0/lib/netcoreapp2.0/Avalonia.Base.dll : warning IL9702: Assembly 'Avalonia.Base' produced AOT analysis warnings. [/Users/danipen/Documents/GitHub/AvaloniaCoreRTDemo/src/AvaloniaCoreRTDemo.csproj]
/Users/danipen/.nuget/packages/avalonia/0.10.0/lib/netcoreapp2.0/Avalonia.OpenGL.dll : warning IL9702: Assembly 'Avalonia.OpenGL' produced AOT analysis warnings. [/Users/danipen/Documents/GitHub/AvaloniaCoreRTDemo/src/AvaloniaCoreRTDemo.csproj]
/Users/danipen/.nuget/packages/avalonia/0.10.0/lib/netcoreapp2.0/Avalonia.MicroCom.dll : warning IL9702: Assembly 'Avalonia.MicroCom' produced AOT analysis warnings. [/Users/danipen/Documents/GitHub/AvaloniaCoreRTDemo/src/AvaloniaCoreRTDemo.csproj]
/Users/danipen/.nuget/packages/runtime.osx-x64.microsoft.dotnet.ilcompiler/6.0.0-preview.5.21230.2/framework/System.Linq.Expressions.dll : warning IL9702: Assembly 'System.Linq.Expressions' produced AOT analysis warnings. [/Users/danipen/Documents/GitHub/AvaloniaCoreRTDemo/src/AvaloniaCoreRTDemo.csproj]
/Users/danipen/.nuget/packages/runtime.osx-x64.microsoft.dotnet.ilcompiler/6.0.0-preview.5.21230.2/framework/System.ComponentModel.TypeConverter.dll : warning IL9702: Assembly 'System.ComponentModel.TypeConverter' produced AOT analysis warnings. [/Users/danipen/Documents/GitHub/AvaloniaCoreRTDemo/src/AvaloniaCoreRTDemo.csproj]
/Users/danipen/.nuget/packages/runtime.osx-x64.microsoft.dotnet.ilcompiler/6.0.0-preview.5.21230.2/sdk/System.Private.CoreLib.dll : warning IL9702: Assembly 'System.Private.CoreLib' produced AOT analysis warnings. [/Users/danipen/Documents/GitHub/AvaloniaCoreRTDemo/src/AvaloniaCoreRTDemo.csproj]
/Users/danipen/.nuget/packages/tmds.dbus/0.9.0/lib/netstandard2.0/Tmds.DBus.dll : warning IL9702: Assembly 'Tmds.DBus' produced AOT analysis warnings. [/Users/danipen/Documents/GitHub/AvaloniaCoreRTDemo/src/AvaloniaCoreRTDemo.csproj]
/Users/danipen/.nuget/packages/runtime.osx-x64.microsoft.dotnet.ilcompiler/6.0.0-preview.5.21230.2/framework/System.Diagnostics.DiagnosticSource.dll : warning IL9702: Assembly 'System.Diagnostics.DiagnosticSource' produced AOT analysis warnings. [/Users/danipen/Documents/GitHub/AvaloniaCoreRTDemo/src/AvaloniaCoreRTDemo.csproj]
/Users/danipen/.nuget/packages/runtime.osx-x64.microsoft.dotnet.ilcompiler/6.0.0-preview.5.21230.2/framework/System.Formats.Asn1.dll : warning IL9702: Assembly 'System.Formats.Asn1' produced AOT analysis warnings. [/Users/danipen/Documents/GitHub/AvaloniaCoreRTDemo/src/AvaloniaCoreRTDemo.csproj]
ld: warning: could not create compact unwind for _System_Net_Http_System_Net_Http_Headers_QPackStaticTable___cctor: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _Avalonia_Themes_Default_CompiledAvaloniaXaml__EmbeddedResource__Populate_Avalonia_Themes_Default_ToggleSwitch_xaml: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _AvaloniaCoreRTDemo_AvaloniaCoreRTDemo_AboutWindow___XamlIlPopulate: stack subq instruction is too different from dwarf stack size
ld: warning: could not create compact unwind for _S_P_CoreLib_System_Number__Dragon4: stack subq instruction is too different from dwarf stack size
ld: warning: can't parse dwarf compilation unit info in obj/Release/net5.0/osx-x64/native/AvaloniaCoreRTDemo.o
ld: warning: linker symbol '$ld$hide$os10.4$__Unwind_Backtrace' hides a non-existent symbol '__Unwind_Backtrace'
ld: warning: linker symbol '$ld$hide$os10.5$__Unwind_Backtrace' hides a non-existent symbol '__Unwind_Backtrace'
ld: warning: linker symbol '$ld$hide$os10.4$__Unwind_DeleteException' hides a non-existent symbol '__Unwind_DeleteException'
ld: warning: linker symbol '$ld$hide$os10.5$__Unwind_DeleteException' hides a non-existent symbol '__Unwind_DeleteException'
ld: warning: linker symbol '$ld$hide$os10.4$__Unwind_FindEnclosingFunction' hides a non-existent symbol '__Unwind_FindEnclosingFunction'
ld: warning: linker symbol '$ld$hide$os10.5$__Unwind_FindEnclosingFunction' hides a non-existent symbol '__Unwind_FindEnclosingFunction'
ld: warning: linker symbol '$ld$hide$os10.4$__Unwind_Find_FDE' hides a non-existent symbol '__Unwind_Find_FDE'
ld: warning: linker symbol '$ld$hide$os10.5$__Unwind_Find_FDE' hides a non-existent symbol '__Unwind_Find_FDE'
ld: warning: linker symbol '$ld$hide$os10.4$__Unwind_ForcedUnwind' hides a non-existent symbol '__Unwind_ForcedUnwind'
ld: warning: linker symbol '$ld$hide$os10.5$__Unwind_ForcedUnwind' hides a non-existent symbol '__Unwind_ForcedUnwind'
ld: warning: linker symbol '$ld$hide$os10.4$__Unwind_GetCFA' hides a non-existent symbol '__Unwind_GetCFA'
ld: warning: linker symbol '$ld$hide$os10.5$__Unwind_GetCFA' hides a non-existent symbol '__Unwind_GetCFA'
ld: warning: linker symbol '$ld$hide$os10.4$__Unwind_GetDataRelBase' hides a non-existent symbol '__Unwind_GetDataRelBase'
ld: warning: linker symbol '$ld$hide$os10.5$__Unwind_GetDataRelBase' hides a non-existent symbol '__Unwind_GetDataRelBase'
ld: warning: linker symbol '$ld$hide$os10.4$__Unwind_GetGR' hides a non-existent symbol '__Unwind_GetGR'
ld: warning: linker symbol '$ld$hide$os10.5$__Unwind_GetGR' hides a non-existent symbol '__Unwind_GetGR'
ld: warning: linker symbol '$ld$hide$os10.4$__Unwind_GetIP' hides a non-existent symbol '__Unwind_GetIP'
ld: warning: linker symbol '$ld$hide$os10.5$__Unwind_GetIP' hides a non-existent symbol '__Unwind_GetIP'
ld: warning: linker symbol '$ld$hide$os10.4$__Unwind_GetIPInfo' hides a non-existent symbol '__Unwind_GetIPInfo'
ld: warning: linker symbol '$ld$hide$os10.5$__Unwind_GetIPInfo' hides a non-existent symbol '__Unwind_GetIPInfo'
ld: warning: linker symbol '$ld$hide$os10.4$__Unwind_GetLanguageSpecificData' hides a non-existent symbol '__Unwind_GetLanguageSpecificData'
ld: warning: linker symbol '$ld$hide$os10.5$__Unwind_GetLanguageSpecificData' hides a non-existent symbol '__Unwind_GetLanguageSpecificData'
ld: warning: linker symbol '$ld$hide$os10.4$__Unwind_GetRegionStart' hides a non-existent symbol '__Unwind_GetRegionStart'
ld: warning: linker symbol '$ld$hide$os10.5$__Unwind_GetRegionStart' hides a non-existent symbol '__Unwind_GetRegionStart'
ld: warning: linker symbol '$ld$hide$os10.4$__Unwind_GetTextRelBase' hides a non-existent symbol '__Unwind_GetTextRelBase'
ld: warning: linker symbol '$ld$hide$os10.5$__Unwind_GetTextRelBase' hides a non-existent symbol '__Unwind_GetTextRelBase'
ld: warning: linker symbol '$ld$hide$os10.4$__Unwind_RaiseException' hides a non-existent symbol '__Unwind_RaiseException'
ld: warning: linker symbol '$ld$hide$os10.5$__Unwind_RaiseException' hides a non-existent symbol '__Unwind_RaiseException'
ld: warning: linker symbol '$ld$hide$os10.4$__Unwind_Resume' hides a non-existent symbol '__Unwind_Resume'
ld: warning: linker symbol '$ld$hide$os10.5$__Unwind_Resume' hides a non-existent symbol '__Unwind_Resume'
ld: warning: linker symbol '$ld$hide$os10.4$__Unwind_Resume_or_Rethrow' hides a non-existent symbol '__Unwind_Resume_or_Rethrow'
ld: warning: linker symbol '$ld$hide$os10.5$__Unwind_Resume_or_Rethrow' hides a non-existent symbol '__Unwind_Resume_or_Rethrow'
ld: warning: linker symbol '$ld$hide$os10.4$__Unwind_SetGR' hides a non-existent symbol '__Unwind_SetGR'
ld: warning: linker symbol '$ld$hide$os10.5$__Unwind_SetGR' hides a non-existent symbol '__Unwind_SetGR'
ld: warning: linker symbol '$ld$hide$os10.4$__Unwind_SetIP' hides a non-existent symbol '__Unwind_SetIP'
ld: warning: linker symbol '$ld$hide$os10.5$__Unwind_SetIP' hides a non-existent symbol '__Unwind_SetIP'
ld: warning: linker symbol '$ld$hide$os10.4$___deregister_frame' hides a non-existent symbol '___deregister_frame'
ld: warning: linker symbol '$ld$hide$os10.5$___deregister_frame' hides a non-existent symbol '___deregister_frame'
ld: warning: linker symbol '$ld$hide$os10.4$___deregister_frame_info' hides a non-existent symbol '___deregister_frame_info'
ld: warning: linker symbol '$ld$hide$os10.5$___deregister_frame_info' hides a non-existent symbol '___deregister_frame_info'
ld: warning: linker symbol '$ld$hide$os10.6$___deregister_frame_info' hides a non-existent symbol '___deregister_frame_info'
ld: warning: linker symbol '$ld$hide$os10.4$___deregister_frame_info_bases' hides a non-existent symbol '___deregister_frame_info_bases'
ld: warning: linker symbol '$ld$hide$os10.5$___deregister_frame_info_bases' hides a non-existent symbol '___deregister_frame_info_bases'
ld: warning: linker symbol '$ld$hide$os10.6$___deregister_frame_info_bases' hides a non-existent symbol '___deregister_frame_info_bases'
ld: warning: linker symbol '$ld$hide$os10.4$___register_frame' hides a non-existent symbol '___register_frame'
ld: warning: linker symbol '$ld$hide$os10.5$___register_frame' hides a non-existent symbol '___register_frame'
ld: warning: linker symbol '$ld$hide$os10.4$___register_frame_info' hides a non-existent symbol '___register_frame_info'
ld: warning: linker symbol '$ld$hide$os10.5$___register_frame_info' hides a non-existent symbol '___register_frame_info'
ld: warning: linker symbol '$ld$hide$os10.6$___register_frame_info' hides a non-existent symbol '___register_frame_info'
ld: warning: linker symbol '$ld$hide$os10.4$___register_frame_info_bases' hides a non-existent symbol '___register_frame_info_bases'
ld: warning: linker symbol '$ld$hide$os10.5$___register_frame_info_bases' hides a non-existent symbol '___register_frame_info_bases'
ld: warning: linker symbol '$ld$hide$os10.6$___register_frame_info_bases' hides a non-existent symbol '___register_frame_info_bases'
ld: warning: linker symbol '$ld$hide$os10.4$___register_frame_info_table' hides a non-existent symbol '___register_frame_info_table'
ld: warning: linker symbol '$ld$hide$os10.5$___register_frame_info_table' hides a non-existent symbol '___register_frame_info_table'
ld: warning: linker symbol '$ld$hide$os10.6$___register_frame_info_table' hides a non-existent symbol '___register_frame_info_table'
ld: warning: linker symbol '$ld$hide$os10.4$___register_frame_info_table_bases' hides a non-existent symbol '___register_frame_info_table_bases'
ld: warning: linker symbol '$ld$hide$os10.5$___register_frame_info_table_bases' hides a non-existent symbol '___register_frame_info_table_bases'
ld: warning: linker symbol '$ld$hide$os10.6$___register_frame_info_table_bases' hides a non-existent symbol '___register_frame_info_table_bases'
ld: warning: linker symbol '$ld$hide$os10.4$___register_frame_table' hides a non-existent symbol '___register_frame_table'
ld: warning: linker symbol '$ld$hide$os10.5$___register_frame_table' hides a non-existent symbol '___register_frame_table'
ld: warning: linker symbol '$ld$hide$os10.6$___register_frame_table' hides a non-existent symbol '___register_frame_table'
AvaloniaCoreRTDemo -> /Users/danipen/Documents/GitHub/AvaloniaCoreRTDemo/src/bin/Release/net5.0/osx-x64/publish/
It compiles and generates the executable, but when I try to run it, I the process is just get aborted:
AvaloniaCoreRTDemo$ /Users/danipen/Documents/GitHub/AvaloniaCoreRTDemo/src/bin/Release/net5.0/osx-x64/publish/AvaloniaCoreRTDemo
[1] 23921 abort
How can I get some information about the crash? Any help would be appreciated.
when I compile the Avalonia program using MVVM and ReactiveUI, I face that exception
System.Security.SecurityException: Invalid assembly public key
that code I use
using ReactiveUI;
namespace AvaloniaTest
{
public class AvaloniaMainWindowViewModel : ReactiveObject, IScreen
{
public RoutingState Router { get; } = new RoutingState();
public AvaloniaMainWindowViewModel()
{
Router.Navigate.Execute(new LoginViewModel(this));
}
}
}
without that line
Router.Navigate.Execute(new LoginViewModel(this));
the program works well without any exception.
thanks
Severity Code Description Project File Line Suppression State
Error NU1101 Unable to find package Microsoft.DotNet.ILCompiler. No packages exist with this id in source(s): LocalProject, nuget.org
AvaloniaCoreRTDemo C:\github\AvaloniaCoreRTDemo\src\AvaloniaCoreRTDemo.csproj 1
It seems it isn't needed in the project?
hello, Can Add Demo With Fluent Theme? thanks
Have You Tried With Nightly Builds? it seems doesn't work at all after waiting more than half an hour to Compile the app crash immediately!
Hi,
I've noticed that libHarfBuzzSharp.dll and libSkiaSharp.dll are required for the application to start. I'm aware that there are some helpful options that can be used to 'include' those extra files inside .exe like IncludeNativeLibrariesInSingleFile
, IncludeNativeLibrariesForSelfExtract
and IncludeAllContentForSelfExtract
. Is there any way for NativeAOT to help with including those files inside exe also?
error CS0102: The type 'MainWindow' already contains a definition for 'MainControl'.
Im getting this error:
ILC: Method '[S.P.CompilerGenerated]Internal.CompilerGenerated.<Module>.ReverseDelegateStub__GdipSetAdjustableArrowCapHeight_delegate(native int,float32)' will always throw because: Marshaling directives are invalid
ILC: Method '[S.P.CompilerGenerated]Internal.CompilerGenerated.<Module>.ReverseOpenStaticDelegateStub__GdipSetAdjustableArrowCapHeight_delegate(native int,float32)' will always throw because: Marshaling directives are invalid
any clue?
I downloaded the project to my computer and used the cmd command inside the folder picture 1:
i download the project to my computer and use cmd command inside the folder and build with the command picture 2:
but when the build is finished running the .exe file, it doesn't show anything, hope you can help me, thank you.
I am not sure, wether this is intentional, but SkiaSharp is still present as a DLL. I thought the prupose of CoreRT was to bundle all files in a native executable?
Would it be possible to include SkiaSharp in the executable, but is it ommited for some reason, or is it not possible to include that DLL?
Thanks in advance.
Sorry to bother you, but I'm really stuck and don't know what to do. Can you please help me?
I have introduced a third-party library 'NetSparkle' based on your demo. This library has a built-in UI window that displays some information. However when I publish to NativeAot, some items on this window will display abnormally. Everything seems normal in Debug mode, as below.
Steps to reproduce
<PackageReference Include="NetSparkleUpdater.UI.Avalonia" Version="3.0.0-preview20230303001" />
public MainWindow(IMainWindow? window)
{
this.InitializeComponent(window);
#if DEBUG
this.AttachDevTools();
#endif
var sparkle = new SparkleUpdater("https://netsparkleupdater.github.io/NetSparkle/files/sample-app/appcast.xml", new DSAChecker(SecurityMode.Unsafe))
{
UIFactory = new NetSparkleUpdater.UI.Avalonia.UIFactory(null /* Icon; this throws null from 0.10.16 to 0.10.18 and don't have time to debug */)
{
// use the following property to change the main grid background on the update window. nullable.
},
// Avalonia version doesn't support separate threads: https://github.com/AvaloniaUI/Avalonia/issues/3434#issuecomment-573446972
ShowsUIOnMainThread = true,
//UseNotificationToast = false // Avalonia version doesn't yet support notification toast messages
};
// TLS 1.2 required by GitHub (https://developer.github.com/changes/2018-02-01-weak-crypto-removal-notice/)
sparkle.SecurityProtocolType = System.Net.SecurityProtocolType.Tls12;
sparkle.StartLoop(true, true);
}
The UI source code is here
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.