-
Notifications
You must be signed in to change notification settings - Fork 238
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
cs-script does not support MAUI Android #379
Comments
A simple answer is no, your environment does not support scripting. It's not even CS-Script it is your .NET runtime that does not support Roslyn and other more advanced features present in other .NET distributions. Though it is my educated guess, not the knowledge as I cannot test it right now. I suggest a very simple experiment. You can disable this very valid call by disabling referencing appdomain assembly: CSScript.EvaluatorConfig.ReferenceDomainAssemblies = false; This will let your through the failings step but most likely it will fail when it tries to invoke Roslyn. Try and let me know how did you go. And it's not for CS-Script reason but for .NET. |
After configuration, it can take effect and run normally in Android. How was this achieved? |
What impact will this config ? I should understand it to prevent errors in other features of the project |
How
Wow, excellent, It's not what I expected as for years Roslyn was only available on the full scale (e.g. desktop/server) runtimes. The setting that you changed controls automatic assembly referencing. IE by default your script automatically references all assemblies currently loaded in the app domain including the host (your application). This way your script can call any method from your host app without any extra effort. When the auto referencing is is performed all AppDomain assemblies analyzed and global cache assemblies are filtered out. You do not need to reference them as they are always available anyway. The filtering involves checking the property The impact You can either reference all of them explicitly but when you do that you need to ensure that the GAC assessment is not performed. The appropriate call for that is this: dynamic script = CSScript.RoslynEvaluator
.ReferenceDomainAssemblies(DomainAssemblies.AllStatic)
.LoadMethod(@"public (int, int) func()
{
return (0,5);
}");
(int, int) result = script.func(); Or you can reference one by one only the assemblies that you need. This is how you can reference host assembly (executing assembly): dynamic script = CSScript.RoslynEvaluator
.ReferenceAssembly(Assembly.GetExecutingAssembly())
.LoadMethod(@"public (int, int) func()
{
return (0,5);
}");
(int, int) result = script.func(); Nevertheless, it is a defect. The script engine should handle the cases when |
thanks, it solved my doubts! |
- #379: cs-script does not support MAUI Android
Done. dotnet add package CS-Script --version 4.8.18-HotFix |
--- ## Changes ### CLI - #378: Bump Request -> Microsoft.CodeAnalysis.CSharp.Scripting 4.10.0 - Added custom command `-set-rt-self` for setting the cs-script engine target runtime to the currently active .NET configuration. ### CSScriptLib - #378: Bump Request -> Microsoft.CodeAnalysis.CSharp.Scripting 4.10.0 - #379: cs-script does not support MAUI Android
I tried using this code and found an error in maui Android
Error message:
So cs-script support maui or not?
The text was updated successfully, but these errors were encountered: