Page 1 of 2
Execscript support, Runtime compilation or razor templates?
Posted: Mon Jun 02, 2025 4:35 pm
by b2k
I have a web application framework that uses a custom templating solution akin to VBScript to generate html.
Here is an example:
Code: Select all
<html>
<body>
<%
LOCAL ldToday
ldToday = DATE()
%>
Today is <<tdToday>>
</body>
</html>
This template is converted to a foxpro string containing:
Code: Select all
TEXT TO lchtml TEXTMERGE (flags as needed)
<html>
<body>
ENDTEXT
LOCAL ldDate
ldToday = DATE()
TEXT TO lcHtml ADDITIVE TEXTMERGE (flags as needed)
Today is <<ldDate>>
</body>
</html>
ENDTEXT
Then executed with EXECSCRIPT(lcScript, params as needed) with the results returned to the calling web server (usually aspx.net calling VFP as a multithreaded com dll)
Does XSharp support the EXECSCRIPT command? Or even better, can it serve as the language for razor templates (.xshtml)?
Re: Execscript support, Runtime compilation or razor templates?
Posted: Mon Jun 02, 2025 7:12 pm
by robert
Brian,
Yes, we support ExecScript.
We have not looked at Razor Templates. I suspect that they are for C# only. I don't think they even support Visual Basic.
Robert
Re: Execscript support, Runtime compilation or razor templates?
Posted: Fri Jun 06, 2025 9:29 pm
by b2k
I am getting this error message when trying to run ExecScript from a XSharp class library called from an ASP.Net razor template. Note that this works fine from an XSharp executable.
"The invoked member is not supported in a dynamic assembly."
Here is my Execscript call:
RETURN ExecScript("RETURN 'Hello World!'")
See attached zip file demonstrating the issue.
Re: Execscript support, Runtime compilation or razor templates?
Posted: Sat Jun 07, 2025 8:35 am
by robert
Brian,
I am not in the office right now, so it is difficult to test and answer this.
I suspect that has to do with some startup code that is not running when you call ExecScript from a non X# appplication.
Normally this code is added to the main app and automatically running when the app is started,
This startup code sets the dialect in the runtime state and some other options, such as the current date/time format and codepage used for string comparisons.
I'll look into this early next week.
Robert
Re: Execscript support, Runtime compilation or razor templates?
Posted: Mon Jun 09, 2025 2:18 pm
by b2k
I modified the example to be able to run the program as an application. It works as an app, and fails as a library. Note that I had to update System.Memory as well. See attached. In the revised sample, I removed the separate console app. Simply change the project type and startup project to test as a console versus library. A summary of the code changes below:
Added to ExecScriptWebDispatcher.prg:
Code: Select all
FUNCTION Start() AS VOID STRICT
? EXECSCRIPT("RETURN 'Hello World!'")
WAIT
RETURN
END FUNCTION
Change Startup project to ExecScriptWeb with Output Type to Console Application and it works. Change it back to Class Library and Startup Project to WebRoot, and it fails as before.
Re: Execscript support, Runtime compilation or razor templates?
Posted: Tue Jun 10, 2025 11:50 am
by robert
Brian,
I can confirm the problem with the latest public build 2.21.
However, this now works as expected with the latest subscriber build 2.23.
We plan to release a public build 2.23 later this month.
Robert
Re: Execscript support, Runtime compilation or razor templates?
Posted: Fri Jun 20, 2025 2:00 pm
by b2k
Thanks so much for your help. I am eagerly awaiting the new release!
Re: Execscript support, Runtime compilation or razor templates?
Posted: Fri Jun 20, 2025 2:33 pm
by wriedmann
Hi Brian,
if you are relying in some manner on XSharp, then I would strongly recommend support the work of the development team by a FoX subscription.
After all, also Robert and his group needs to eat and to pay their bills, and more money permits them to dedicate more time to the project and/or hire other people to do work on the project.
And FoX membership gives you also access to the newest X# version and a better support from the team and sometimes also some possibility to have some influence on the future developments.
Wolfgang
Re: Execscript support, Runtime compilation or razor templates?
Posted: Tue Sep 09, 2025 3:00 pm
by b2k
I would love to support the project, but my company won't do so until we have a successful pilot project. And it's not been going well so far.
Re: Execscript support, Runtime compilation or razor templates?
Posted: Wed Sep 24, 2025 6:55 pm
by mainhatten
Brian,
I have posted my take on missing "base vfp DNA" in other thread here in vfp forum.
Perhaps you should offer a prioritized list of features xSharp must support for your programs.
regards
thomas