-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
AOT (Trimming) Exception. #65
Comments
@cyraid Trimming will not work as JavaScript is dynamic language and the all the runtime engine is loaded dynamically. For timebing you can simply disable trimming and see if it works, I tried looking at following issues, but looks like there isn't any easy way to do it. dotnet/runtime#49040 , dotnet/runtime#79003 |
@ackava With the help of a few hints (at https://learn.microsoft.com/en-ca/dotnet/core/deploying/trimming/prepare-libraries-for-trimming), you could avoid the trim warnings and allow the library to at least be partially trimmed, saving space. :) Edit: By having |
@cyraid This will require every method to be decorated with these attributes, which isn't possible. And it is too much of unnecessary code. Since none of the JavaScript runtime features are statically referenced anywhere in the code. In Xamarin, there was a way to completely disable trimming (linking) only for specific assemblies. And we were able to use YantraJS successfully in the Xamarin by disabling trimming. I think if it is not possible to trim entire assemblies, the feature may come in future. In this case, you can supply assemblies ( I will keep the issue open till I find some easy way to entirely ignore trimming/linking whole assemblies. |
With |
@ackava You mentioned supplying assemblies to YantraJS.Core and YantraJS.ExpressionCompiler, I wonder.. Is it possible to currently save the JavaScript compiled Assembly to a .dll file? |
@cyraid It would not work as every method would need to be present to execute the code. Also compile to assembly is actually used as caching as opposed to shipping assembly as alternative to JS. We haven't tried it yet. We are working on a new feature to improve faster loading time by statically initializing Runtime features as opposed to using reflection. This will improve speed and might support trimming. We will keep this issue open till then. |
Thank you! :) |
@cyraid We have removed all Reflection code and we have replaced it with generated source, AOT trimming should work, you can try new release and let us know if you face any issues. |
The library doesn't seem to work when producing a self contained, trimmed, executable.
The code of the program is:
Running without trimming works, and prints
Hi
. When trimming is on, running said executable produces:The text was updated successfully, but these errors were encountered: