HighTechTalks DotNet Forums  

JScript engine as a COM (internal compiler error during the 1st compilation)

Dotnet VSA microsoft.public.dotnet.vsa


Discuss JScript engine as a COM (internal compiler error during the 1st compilation) in the Dotnet VSA forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
AT
 
Posts: n/a

Default JScript engine as a COM (internal compiler error during the 1st compilation) - 07-24-2003 , 02:14 PM






Hello everyone,

I would like to extend a legacy application with .NET scripting
possibilities. Everything with VSA and .NET works fine. Except all
those memory-leaks problems. But I don't care too much now because my
scenario looks more like compile once/run many times (run long time).

So I've included the engine into a [in-process] COM object and
created sink object for the interaction in my legacy application.
Again, everything works fine BUT :

If I create the COM object (containing the engine) for the first time
and call Compile() method, there appears an internal compiler error
(inner exception : DivideByZeroException). Afterthat, everything works
as supposed. So :
- calling Compile() once more -> code compiled and runs as expected
- creating new instance of the COM engine objects -> compiles on the
first call

The other interesting thing are :
- if I make a syntax error in the script source (wherever; at the end
as well), this error is reported -> so the compilation runs till the
end of the source
- this behaviour appears when there is a cycle in the script source
(I tried "for" and "while") -> I haven't tried anything else. But I
know I need "for" and similar constructs.
- if I use the class (COM object) directly from a .NET program
everything works for the first time

I could live with this suspicious behaviour but I am not sure whether
there are not other strange things I would encounter in the future.

Any ideas ?

Thanks in advance
- Marek

Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: JScript engine as a COM (internal compiler error during the 1st compilation) - 07-25-2003 , 07:06 AM






I have made a bit more "research" and found the "real" cause is
assigning 0 to a variable :
..
..
var a = 0;
..
..
wherever in the script makes the error. When I assign something else,
it works. It has nothing to do with cycles, but with this assignment.
To be complete, there is the exception thrown :

Microsoft.Vsa.VsaException: InternalCompilerError (0x80133021):
System.DivideByZeroException: Attempted to divide by zero.
at Microsoft.JScript.ConstantWrapper.TranslateToIL(IL Generator il,
Object val, Type rtype)
at Microsoft.JScript.ConstantWrapper.TranslateToIL(IL Generator il,
Type rtype)
at Microsoft.JScript.Binding.TranslateToILSet(ILGener ator il, AST
rhvalue)
at Microsoft.JScript.Lookup.TranslateToILSet(ILGenera tor il,
Boolean doBoth, AST rhvalue)
at Microsoft.JScript.VariableDeclaration.TranslateToI L(ILGenerator
il, Type rtype)
at Microsoft.JScript.Block.TranslateToIL(ILGenerator il, Type
rtype)
at Microsoft.JScript.Block.TranslateToIL(ILGenerator il, Type
rtype)
at Microsoft.JScript.FunctionObject.TranslateToIL(Com pilerGlobals
compilerGlobals)
at Microsoft.JScript.FunctionDeclaration.TranslateToI LInitializer(ILGenerator
il)
at Microsoft.JScript.Block.TranslateToILInstanceIniti alizers(ILGenerator
il)
at Microsoft.JScript.Class.TranslateToCOMPlusClass()
at Microsoft.JScript.Class.TranslateToIL(ILGenerator il, Type
rtype)
at Microsoft.JScript.Block.TranslateToIL(ILGenerator il, Type
rtype)
at Microsoft.JScript.ScriptBlock.TranslateToIL(ILGene rator il, Type
rtype)
at Microsoft.JScript.ScriptBlock.TranslateToILClass(C ompilerGlobals
compilerGlobals)
at Microsoft.JScript.VsaStaticCode.TranslateToIL()
at Microsoft.JScript.Vsa.VsaEngine.DoCompile()
at Microsoft.Vsa.BaseVsaEngine.Compile()
at XB.Extensions.ScriptEngine.ScriptSite.Compile(Stri ng p_name,
String p_source_text)
in c:\\...\\vsasite.cs:line 164
at XB.Extensions.ScriptEngine.ScriptEngine.Compile(St ring p_name,
String p_source)
in c:\\...\\comaccess.cs:line 68

- Marek

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.