-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Experimental CoreRT support #1476
Comments
Current ProgressOur sample app (courtesy of @wieslawsoltes) compiles successfully with some warnings on Windows, Linux CoreRT builds however are not fully tested due to MIT Kerberos library DSO's not being detected in Ubuntu by the ILCompiler. On runtime however, we encountered a fatal exception regarding BooleanConverter in System.ComponentModel.TypeConverter namespace. |
Exception when trying to run compiled executable:
|
The <Directives>
<Application>
<Assembly Name="System.ComponentModel.TypeConverter" Dynamic="Required All" />
<Assembly Name="Avalonia.Animation" Dynamic="Required All" />
<Assembly Name="Avalonia.Base" Dynamic="Required All" />
<Assembly Name="Avalonia.Controls" Dynamic="Required All" />
<Assembly Name="Avalonia.DesignerSupport" Dynamic="Required All" />
<Assembly Name="Avalonia.Diagnostics" Dynamic="Required All" />
<Assembly Name="Avalonia.Input" Dynamic="Required All" />
<Assembly Name="Avalonia.Interactivity" Dynamic="Required All" />
<Assembly Name="Avalonia.Layout" Dynamic="Required All" />
<Assembly Name="Avalonia.Logging.Serilog" Dynamic="Required All" />
<Assembly Name="Avalonia.Visuals" Dynamic="Required All" />
<Assembly Name="Avalonia.Styling" Dynamic="Required All" />
<Assembly Name="Avalonia.Themes.Default" Dynamic="Required All" />
<Assembly Name="Avalonia.Markup" Dynamic="Required All" />
<Assembly Name="Avalonia.Markup.Xaml" Dynamic="Required All" />
<Assembly Name="Avalonia.DotNetCoreRuntime" Dynamic="Required All" />
<Assembly Name="Avalonia.Win32" Dynamic="Required All" />
<Assembly Name="Avalonia.Direct2D1" Dynamic="Required All" />
<Assembly Name="Avalonia.Skia" Dynamic="Required All" />
<Assembly Name="Avalonia.Gtk3" Dynamic="Required All" />
<Assembly Name="Avalonia.MonoMac" Dynamic="Required All" />
<Assembly Name="Core2D.Avalonia" Dynamic="Required All" />
<Assembly Name="Newtonsoft.Json" Dynamic="Required All" />
<Assembly Name="mscorlib" Dynamic="Required All" />
<Assembly Name="System.Memory" Dynamic="Required All" />
<Assembly Name="System.Runtime" Dynamic="Required All" />
</Application>
</Directives> |
I got past this by not doing -c Release |
I'm having a further issue now with it not finding:
|
need to add
|
|
If you don't use Window Icons that doesn't happen (Windows only AFAIK) |
Generic types and reflection in general were not working in CoreRT. And due to a yet-to-find bug in either AvaloniaUI or CoreRT, we can't publish native builds in Release configuration as of the time when this progress report was written. |
I have disabled default theme, the error is still there in release publish.
|
Managed to run partial control catalog using release publish. Code: https://github.com/wieslawsoltes/Avalonia/tree/ef8f19c82dada5a5055e739c22bf1c3931192d54 From command-line in
|
So my current finding is that setting Boolean property
|
So it seems the issue is with
value = tc.ConvertFrom(service_provider, CultureInfo.InvariantCulture, value); |
This issue is blocked by dotnet/corert#5661 |
The issue of Native Compilation in linux is fixed with dotnet/corert#5663. We'll just have to wait for a new ILCompiler package to be released |
Tested Avalonia app (the plain avalonia.mvvm template) and it has compiled successfully in linux (Ubuntu 16.04); unfortunately, an issue with |
Core2D on Kubuntu 16.04 |
tracking dotnet/corert#5690 and dotnet/corert#5691 |
This bug dotnet/corert#5661 got closed today, I think this version includes fixes: https://dotnet.myget.org/feed/dotnet-core/package/nuget/Microsoft.DotNet.ILCompiler/1.0.0-alpha-26413-01
|
The NuGet package description has the commit SHA in it. The package you're linking to is at commit 753b12932bf934605d40901d5e10c67e1e1a34fd and doesn't include the fix yet. The next package should have it. |
Nice. How big is the executable? Is the startup time reduced significantly? |
About 29MB. Start-up time is greatly reduced, almost instant. |
Thanks, that's great to hear. 29MB is also very good result considering the size of standard release build publish binaries is around 80MB. Hopefully it will be even better in the future when CoreRT matures. |
You can likely get to less than 29 MB by tweaking the RD.XML used. The CoreRT compiler normally starts compilation from the This is a problem if the app uses reflection to find things that are otherwise not used. CoreRT wouldn't compile those things and since there's no JIT (and we don't carry the original IL anyway), the code will fail at runtime. Using RD.XML to say that everything in all assemblies should be considered used is a relatively quick fix, but comes with a cost - potentially compiling things that really aren't used. It's possible to tweak RD.XML at a finer granularity (going down to individual types). This might be tedious, but the reward is a smaller executable that only has code and data that is really needed. |
Issue while running ControlCatalog.NetCore on xamlil branch:
|
Core2D runs on CoreRT, file dialogs do not work wieslawsoltes/Core2D#83 rd.xml files: |
The dialog issue is due to dotnet/corert#4219 |
We might want to use SharpGenTools for COM interop on Windows. @jkoritzinsky Is it possible to define interfaces without C/C++ header files? |
You can manually define them but it’s not exactly pretty. You’d basically be writing the generated code. My suggestion would be for us to make another small project that maps the dialog interfaces from the headers and publishes to NuGet and then consume that library in Avalonia. |
We'd need to do that for |
I succeeded in compiling my project by CoreRT on Windows and Linux, but failed in Max OS X because of the delegate marshalling here:
And according to this issue, maybe the delegates should be marked with UnmanagedFunctionPointerAttribute .
|
I had exception with missing "clrcompression.dll". |
Also need to mention https://github.com/teobugslayer/AvaloniaCoreRTDemo |
Only out of curiosity: Is there any reason why something like this is not implemented yet? It is really the only thing stopping me from compiling my app to CoreRT... |
You can use managed dialogs for now. |
Is it possible to use Avalonia in an old style UWP project? I have errors like this when I try to build it: Setting |
@gleblebedev we don't officially support embedding Avalonia in UWP because of .NET Native limitations. |
FYI: I was able to reduce number of errors from 440+ to only 62 by making all fields in Avalonia.Themes.Default.dll, Avalonia.Themes.Fluent.dll, Avalonia.Dialogs.dll public.... |
Ok, I'm at last 20 errors and most of them look like this: Error Method 'XamlIlHelpers.Avalonia.Data.TemplateBinding,Avalonia.Markup.Converter!Property()' will always throw an exception due to the missing method 'XamlIlHelpers.Avalonia.Data.TemplateBinding,Avalonia.Markup.Converter!Getter(object)' in assembly 'Avalonia.Themes.Default'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release. Why would the method be missing? |
Actually... making methods public also solves the problem. So I only have 2 errors left, the root one is: C:\Users\gleb.nuget\packages\microsoft.net.native.compiler\2.2.8-rel-28605-00\tools\Microsoft.NetNative.targets(801,5): error : RHBIND : error RHB0011: Internal error: 'ch == L':'' at 'f:\dd\ndp\rh\src\tools\rhbind\makepdb.cpp:1136' I guess this one should be reported to the native.compiler. Do you know where it is? Is it https://github.com/dotnet/corert/issues ? |
For .NET Native, you need to report on the VS Feedback site: https://developercommunity.visualstudio.com |
This repo is successor to CoreRT I guess- |
NativeAOT obsoletes this issue, closing now |
We will be tracking here all of the relevant info regarding AvaloniaUI's compile and runtime compatibility with CoreRT.
The text was updated successfully, but these errors were encountered: