Does ClearScript use CodeDom

Feb 21, 2014 at 5:13 AM
Does ClearScript use CodeDom where assemblies cannot be unloaded or is it a true scripting component like MS Script Control ?
Coordinator
Feb 21, 2014 at 8:23 PM
Hi,

ClearScript does not use CodeDom.

Cheers!
Feb 22, 2014 at 3:13 AM
Is it a true scripting component like MS Script Control ? Can it be used in a 64-bit ASP.NET app ? I think it uses COM Interop and Reflection, do these cause memory leaks in the long run, etc ?

I am asking this because I have to oversee migration of an old VB 6 ASP.NET application to dotNET 4/4.5 framework. The old app makes extensive use of MS Script Control and has substantial amount of business logic. We cannot afford any mistakes in it and the reason for such a long delay in migration was only because there was no scripting support for dotNet and we did not want to use CodeDom which would cause memory leaks in the long run.

Thanks again for your time.
Coordinator
Feb 23, 2014 at 3:25 PM
Hello!

Based on your earlier question in another thread, we'll assume that you're considering using ClearScript with JScript/VBScript rather than V8.

If that's correct, then yes, ClearScript uses the same JScript and VBScript engines as the Windows Script Control. However, as you pointed out, it also uses .NET facilities such as COM Interop and Reflection, and brings together components that were designed for fundamentally different environments.

To answer your specific questions:

Yes, ClearScript can be used in a 64-bit ASP.NET app. However, JScript and VBScript instances have thread affinity and therefore require careful handling in server applications. Also, ClearScript doesn't support certain server-friendly features, such as cloning. Finally, we've observed some JScript and VBScript bugs that are specific to the 64-bit versions of these components.

We're not currently aware of any memory leaks related to the use of COM Interop and Reflection, but of course there may always be bugs in any layer. We try to investigate issues as they're reported, but please keep in mind that this an open-source project with no official support.

Thanks for your questions, and good luck!
Feb 24, 2014 at 7:28 AM
Edited Feb 24, 2014 at 2:44 PM
Hey guys!

Thanks for the prompt replies and lovely support!

My use will be as:

Page1.aspx, Page2.aspx will use clearscript, each with their own engine declaration (dim engine as windows.jscriptengine = new window.jscriptengine at page start / engine.dispose at page end). All data for script processing will come from sessions. There will be 100's of users who will use Page1.aspx, Page2.aspx and there can be multiple instances of Page1.aspx, Page2.aspx for each/any user. There will be no engine sharing between any of the pages, or any of the users, only one engine declared and used from page load to page unload for each time page is run with data coming from session variables. Also Page1.aspx can be open in five tabs by User A at the same time and so there have to be 5 seperate engines because Page1.aspx's data will be different from each tab instance of Page1.aspx!

Sorry to go so detailed but the application logic depends on scripting so I am a bit paranoid! LOL

If VBScript / JScript can't support 64-bit, I will use 32-bit, as V8 is also in it's infancy but these engines are tried and tested.

My final question:

1) Can I still use VBScript/JScript engines without problems for the above ASP.NET scenario ? I won't use server cloning or 64-bit platform. Thread affinity is that engine objects can be called only from the thread that creates them right ? I am going to be using them only in the page that created them, so am I safe here ?

2) Can I use V8 in the above scenario safely as well ? Also in 64-bit. I am not going to use Server Cloning anyways but if V8 does away with COM Interop and Reflection is it faster ? Then I can consider using V8.

I would'nt hold you responsible, but what would you recommend ? Thanks for all the help and support so far.
Coordinator
Feb 25, 2014 at 3:58 AM
Hello again shripaldalal!

Thanks for the detailed description of your scenario. It sounds like JScript/VBScript should work just fine, and yes, both engines support 64-bit processes. Thread affinity should not be a problem as long as your application processes requests synchronously.

V8 should work as well, and is your only choice if your application uses asynchronous operations to process requests. V8 is generally much faster than JScript, but deploying ClearScript with V8 is a bit more difficult because it involves multiple assemblies.

Good luck!
Marked as answer by shripaldalal on 2/24/2014 at 8:17 PM
Feb 25, 2014 at 4:21 AM
Thank you for all your help and support!

I will use JScript/VBScript in 64-bit mode and as you said I can't use it asynchronously, I won't need to as I don't use WebSockets, AJAX, etc. I use simple form post, process values by running the form action page from start to finish, then return control back to user with response.write.

Anyways, its been a pleasure. :-)