This project is read-only.

Compiles but doesn't run

Feb 10, 2012 at 12:03 PM

I'm a C# developer but have been trying to get this to compile with a vague hope of tweaking it to allow return of a Javascript object without it being converted to a .NET object (the javascript object returned caused stack overflow issues but I don't need it as a .NET object just a reference to it)

After many false starts (requiring VS2008 rather than VS2010, then finding my VS2008 only had C# installed, then finding a Python implementation, then working out what to change to find my python) I managed to get the thing to compile.

However, it barfs for me even on the included Tests.

I had to make two changes. I am running on Win7x64 and the Tests was set for AnyCPU - that crashes immediately presumably because the other code is 32bit. Changing that to x86 and modifying the path to the .js test files (needs an extra level of "..\") started the tests but it crashes with "AccessViolationException occurred" in JavaContext::SetParameter.

Debug won't compile. It comes up with a "general error c101008a: Failed to save the manifest to the file ".\Debug\Noesis.Javascript.dll.embed.manifest". The parameter is incorrect."

For the Release version, I did see three warnings along the lines of "unresolved typeref token (0100002C) for 'v8.internal.Object;; image may not run" but I've no idea whether this is the problem and I've no idea what that means anyway.

So are you guys managing to compile and run the 0.5 download without problems?

Cheers
Simon

 

Feb 12, 2012 at 11:49 PM

Regarding returning the JavaScript object to C#, how will you wrap it?  You need to understand that C# can only handle it as an opaque IntPtr, which perhaps can be passed back into JavaScript later if you want to look at it.

I am not clear whether you are now using VS2008 or VS2010.  If you are using 2010 then did you do the extra things required in the README.txt?  I suggest you use VS2008 if you can.

You are correct that you will need to compile in 32-bit mode in VS2010 because the v8 source code does not compile in VS2010 64-bit.  I have not worked out why.  Probably it can be fixed by moving to a newer version of v8.

I don't have any clues about your problem saving to the manifest file, nor about your AccessViolationException in JavascriptContext::SetParameter().

You can ignore the "unresolved typeref token (0100002C) for 'v8.internal.Object;'".  It always occurs and does not cause problems.  From memory it is because the v8 header files declare a class which they provide no linkable implementation for.  However since that class is never instantiated in the javascriptdotnet it does not cause a problem.

If you can give a list of precise steps you take, from the download to a problem, then is a chance someone can/will reproduce it.

 

  Oliver

Feb 13, 2012 at 10:08 AM

Well its a Javascript object that I need to call methods on. I may be missing something here but Noesis seems limited here. I can use GetParameter and SetParameter and Run but these appear to work for global objects only? GetParameter and SetParameter also seem misleading since they are global variables and not parameters - correct? (to my inexperience eye, I seems the context is designed to load a single script and run it)

I have had some success before using IE as the scripting host. There I get a COM object back which I can cast as an IExpando object. That takes care of getting and setting untyped properties. I can also use GetType and then call methods from that.

I was using VS2008 to compile Noesis. Since your mail I have started from scratch by downloading your 0.5 code. The only change I have made is to modify one line in js2c.cmd to point to IronPython [if not exist %PYTHON% set PYTHON="C:\Program Files (x86)\IronPython 2.7.1\ipy.exe"]. I can compile the code without problems for Debug and Release but neither will run: Release mode give me the Access Violation Exception as before; Debug gives a little more info which might help:
#
# Fatal error in f:\scratch\noesis.javascript\externals\v8\src\handles-inl.h, line 48
# CHECK(location_ != 0) failed
#

I have downloaded the 0.5 binary and that works fine in as much as it gets me past the above problems. Unfortunately, I can't get a handle to the Java script object because it is too complex and bombs with the StackOverflow exception.

So in summary, I can't rebuild from the source - don't know why.  I can use the pre-build binary but the Noesis interface code as it currently stands is too limiting AFAIK for my needs and crashes. I need to be able to get a Javascript object reference and manipulate it without any attempt being made to convert it to a C# object. The only other options which isn't too appealing is to write javascript code to mirror all of the functions/properties I need to call/access and reference the instances I created by name. That way all the objects stay in the Javascript context and I just get back the primitives into C#

To be honest I can't really why the current code attempts any conversion at all other than for primitives and strings. Wouldn't it be simpler to just wrap the IntPtr into a C# object which has CallFunction() and SetProperty(string, object) and GetProperty() methods (and maybe ToJSON and FromJSSON methods)?

The Javascript code I am using is CiteProc by the way and I am calling its CreateEngine function. Since G8 doesn't have a DOM implementation of its own, I had to provide one using js I found on the web. Unfortunately that was written using arrays to store child elements whereas Citeproc expects an object with an item property. So I cheated and added a function to the Array:

Array.prototype.item = function (index) { return this[index]; };

This wouldn't cause the Stackoverflow issue would it?

Cheers
Simon

Feb 13, 2012 at 10:45 PM

Your build problems are odd.  I just did these steps:

  1. Downloaded the 0.5 ZIP and let Windows unzip it where it wants (C:\Noesis.Javascript-v0.5-Source\Noesis.Javascript-v0.5-Source).
  2. Opened Noesis.Javascript.sln in VS2008.
  3. Observed that everything is set to Win32/x86 Debug.
  4. Build | Build Solution.
  5. Right clicked on Noesis.Javascript.Tests project and chose Debug | Start New Instance
  6. Observed that it works fine.

Can you repeat these exact steps with a different result?  That is, if you make no modifications at all, does it work?  If it does then we must suspect your modifications.  If not we must suspect your installation of Visual Studio.  My VS2008 shows this in its About box:

Microsoft Visual Studio 2008
Version 9.0.30729.4462 QFE
Microsoft .NET Framework
Version 3.5 SP1

Installed Edition: Professional
Microsoft Visual Basic 2008   91605-270-9339022-60153
Microsoft Visual C# 2008   91605-270-9339022-60153
Microsoft Visual C++ 2008   91605-270-9339022-60153
Microsoft Visual Web Developer 2008   91605-270-9339022-60153
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB2465361)   KB2465361...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB2538241)   KB2538241...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB944899)   KB944899...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB945282)   KB945282...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946040)   KB946040...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946308)   KB946308...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946344)   KB946344...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946581)   KB946581...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947171)   KB947171...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947173)   KB947173...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947180)   KB947180...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947540)   KB947540...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947789)   KB947789...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB948127)   KB948127...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB953256)   KB953256...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB971092)   KB971092...
Microsoft Visual Studio 2008 Professional Edition - ENU Service Pack 1 (KB945140)   KB945140...
Microsoft Visual Studio 2008 Professional Edition - ENU Service Pack 1 (KB947888)   KB947888...
Microsoft Visual Studio 2008 Professional Edition - ENU Service Pack 1 (KB948484)   KB948484...
Security Update for Microsoft Visual Studio 2008 Professional Edition - ENU (KB2251487)   KB2251487...
Security Update for Microsoft Visual Studio 2008 Professional Edition - ENU (KB972222)   KB972222...
Security Update for Microsoft Visual Studio 2008 Professional Edition - ENU (KB973675)   KB973675...
Update for Microsoft Visual Studio 2008 Professional Edition - ENU (KB956453)   KB956453...
Update for Microsoft Visual Studio 2008 Professional Edition - ENU (KB967143)   KB967143...
ANTS Profiler Add-in...

 

Why do you want to use IronPython?

 

Regarding using JavaScript objects from within C#, you are right that this project does not provide support for that.  I use it as an internal scripting engine, in which role it works well.  Interaction between C# comes via calls from JavaScript to my C# objects.  Exposing JavaScript objects to C# (related to http://javascriptdotnet.codeplex.com/workitem/8952) would be possible, and perhaps is what the nascent JavascriptObject class was for (deleted as part of 0.4 build - I don't know why - see http://javascriptdotnet.codeplex.com/SourceControl/changeset/view/73934#1140956).  Anyway, if it was done it would need to work something like this:

Construct a C# object with general-purpose get/set/invoke methods to wrap a JavaScript PermanentHandle<>.  You would use strings to identify the JavaScript properties/methods you want.  (I suppose you could also use the new .Net 4.0 dynamic stuff.)

When a property or method was to be invoked, it would need to enter unmanaged code and construct a v8::Locker, then use v8 methods to get/set/invoke.  Parameters would be converted to/from v8 using the existing javascriptdotnet conversion functions.

 

If you are not using multiple threads then your stack overflow is probably real.  I don't know JavaScript well enough to be able to say whether your code is recursive.  Perhaps you should execute some simpler JavaScript to test the engine.

 

  Oliver

Feb 14, 2012 at 4:59 PM

Hi Oliver

1. I use Winzip not Windows but can’t see that would make a difference. Opened directly in WinZip and dragged the single Noesis.Javascript-v0.5-Source to F: (drive C: is Windows 7 and doesn’t like stuff going in the root).

2. Opened VS2008 by clicking on the Noesis.Javascript.sln file.

3. Is set to Debug/Mixed Platforms by default on my system (Windows 7 64 bit). There is a choice of AnyCPU/Mixed Platforms/Win32/x64.
Looking in Configuration Manager – the default Mixed Platforms has Win32 for all except Noesis.Javascript.Tests which is x86 so I think we are the same here.

4. OK, Build | Build Solution (compiling C++ seems so slow compared to C#!! What about the multi-cpu compile I though C++ could do)
Fails on build due to “Error 2 Error result 1 returned from 'C:\Windows\SysWow64\cmd.exe'. Project noesis_v8”
That is down to the fact that the build is looking for a python.exe on the path which I don’t have – hence the installation of IronPython.
The js2c.cmd is setting the environment variable to <<set PYTHON="..\..\..\third_party\python_24\python.exe">> which isn’t portable and I don’t know what python_24 is.
Made my change to point to the Iron Python and did Build | Build Solution again. All compiles fine (except for the unresolved typeref token warnings to be ignored)

5. Did that.

6. Bombs with the following output

'Noesis.Javascript.Tests.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll'

'Noesis.Javascript.Tests.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll'

'Noesis.Javascript.Tests.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'

'Noesis.Javascript.Tests.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll'

'Noesis.Javascript.Tests.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'

'Noesis.Javascript.Tests.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll'

'Noesis.Javascript.Tests.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll'

'Noesis.Javascript.Tests.vshost.exe' (Managed): Loaded 'F:\Noesis.Javascript-v0.5-Source\Tests\Noesis.Javascript.Tests\bin\x86\Debug\Noesis.Javascript.Tests.vshost.exe'

'Noesis.Javascript.Tests.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll'

'Noesis.Javascript.Tests.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Xml.Linq\3.5.0.0__b77a5c561934e089\System.Xml.Linq.dll'

'Noesis.Javascript.Tests.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Data.DataSetExtensions\3.5.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll'

'Noesis.Javascript.Tests.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll'

'Noesis.Javascript.Tests.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll'

The thread 0x36dc has exited with code 0 (0x0).

The thread 0x30b4 has exited with code 0 (0x0).

'Noesis.Javascript.Tests.vshost.exe' (Managed): Loaded 'F:\Noesis.Javascript-v0.5-Source\Tests\Noesis.Javascript.Tests\bin\x86\Debug\Noesis.Javascript.Tests.exe', Symbols loaded.

'Noesis.Javascript.Tests.vshost.exe' (Managed): Loaded 'F:\Noesis.Javascript-v0.5-Source\Tests\Noesis.Javascript.Tests\bin\x86\Debug\Noesis.Javascript.dll', Symbols loaded.

'Noesis.Javascript.Tests.vshost.exe' (Managed): Loaded 'C:\Windows\WinSxS\x86_microsoft.vc90.debugcrt_1fc8b3b9a1e18e3b_9.0.30729.4148_none_2a4cbfc25558bcd3\msvcm90d.dll'

The program '[8228] Noesis.Javascript.Tests.vshost.exe: Managed' has exited with code 3 (0x3).

Tried switching on Break on all Exceptions and disabling JustMyCode but can’t get it to stop at the problem. Did some manual breakpointing and the last executable line is the last line in this method.

void

JavascriptContext::Enter()

{

// We store the old context so that JavascriptContexts can be created and run

// recursively.

oldContext = sCurrentContext;

sCurrentContext = this;

(*mContext)->Enter(); --- Gets to here but doesn’t come back}

My Help/About looks like this:

Microsoft Visual Studio 2008

Version 9.0.30729.1 SP

Microsoft .NET Framework

Version 3.5 SP1

Installed Edition: Professional

Microsoft Visual C# 2008 91605-270-5353401-60184

Microsoft Visual C++ 2008 91605-270-5353401-60184

Microsoft Visual Studio 2008 Tools for Office 91605-270-5353401-60184

Crystal Reports AAJ60-G0MSA4K-68000CF

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB971091) KB971091

Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB973674) KB973674

Hotfix for Microsoft Visual Studio 2008 Shell (integrated mode) - ENU (KB945282) KB945282

Hotfix for Microsoft Visual Studio 2008 Shell (integrated mode) - ENU (KB946040) KB946040

Hotfix for Microsoft Visual Studio 2008 Shell (integrated mode) - ENU (KB946308) KB946308

Hotfix for Microsoft Visual Studio 2008 Shell (integrated mode) - ENU (KB946344) KB946344

Hotfix for Microsoft Visual Studio 2008 Shell (integrated mode) - ENU (KB946581) KB946581

Hotfix for Microsoft Visual Studio 2008 Shell (integrated mode) - ENU (KB947173) KB947173

Hotfix for Microsoft Visual Studio 2008 Shell (integrated mode) - ENU (KB947540) KB947540

Hotfix for Microsoft Visual Studio 2008 Shell (integrated mode) - ENU (KB947789) KB947789

Hotfix for Microsoft Visual Studio 2008 Shell (integrated mode) - ENU (KB958017) KB958017

Hotfix for Microsoft Visual Studio 2008 Shell (integrated mode) - ENU (KB963035) KB963035

JetBrains ReSharper 5.1 C# Edition build 5.1.3000.12 on 2011-01-28T05:05:56

Security Update for Microsoft Visual Studio 2008 Shell (integrated mode) - ENU (KB2251487) KB2251487

Security Update for Microsoft Visual Studio 2008 Shell (integrated mode) - ENU (KB972222) KB972222

SQL Server Analysis Services Microsoft SQL Server Analysis Services Designer Version 10.0.4000.0

SQL Server Integration Services Microsoft SQL Server Integration Services Designer Version 10.0.4064.0 ((Katmai_SP2_GDR).110225-1353 )

SQL Server Reporting Services Microsoft SQL Server Reporting Services Designers Version 10.0.4064.0

Update for Microsoft Visual Studio 2008 Professional Edition - ENU (KB972221) KB972221

Xsd2Code

I too am using this as an internal scripting engine, the trouble is that I have no real control over the main script: Citeproc.js is the only complete implementation of a CSL processor I know of. If there was a C# version I would be using that instead and sometimes I think it would be easier to write one from scratch. I can add additional scripts/methods or whatever into an additional script that gets loaded into the Javascript context but I can’t modify Citeproc.js itself.

I don’t actually want to use Javascript objects in C#, I just need to keep a reference to the Javascript object created by CiteProc’s createEngine function and then call it’s methods. I have managed to fudge a hacky test version (using the old 0.4 release) and global variables/dictionaries so that the engines can be referred to by name. It is around 3x faster than the version I had working with IE9’s script engine (not that that hasn’t been painful to get a working version!!).

I still don’t understand the rationale behind why Run() is doing what it is doing: It has no knowledge of what C# object a Javascript object is going to be translated into so why do anything other than return a Wrapper-type object. The only exceptions should be primitives – some can be translated easily e.g. strings/ints and some might need translation e.g. DateTime; and arrays. Writing code to convert whole graphs of objects is very difficult (I have experience with C# remoting), so it would be easier to just return an object in that case.By the way, JSON fails with OutOfStackSpace under IE9 for the same object.

With regard to Wrapper objects – that’s what I did with the IE9 implementation. I get an IExpando back and put it into a wrapper which has GetProperty/SetProperty methods. For the cases where I do want to translate to/from a C# data object I have added a JavaScriptNameAttribute attribute which I add to public properties on the C# class. I have a couple of methods which use these to know how to translate to/from Javascript/C#. Graphs are not supported – this is just for data objects.

I don’t have the luxury of .Net 4.0 so dynamic is out – I am stuck on .Net 2.0 unfortunately. I see what you are suggesting but the auto-convert is getting there first! To be honest, looking at the code and with the problems I have just compiling I am not confident of making any changes – only suggesting them. J

Cheers

Simon

From: oliverbock [email removed]
Sent: 13 February 2012 22:46
To: simon.hewitt@simmotech.co.uk
Subject: Re: Compiles but doesn't run [javascriptdotnet:302881]

From: oliverbock

Your build problems are odd. I just did these steps:

1. Downloaded the 0.5 ZIP and let Windows unzip it where it wants (C:\Noesis.Javascript-v0.5-Source\Noesis.Javascript-v0.5-Source).

2. Opened Noesis.Javascript.sln in VS2008.

3. Observed that everything is set to Win32/x86 Debug.

4. Build | Build Solution.

5. Right clicked on Noesis.Javascript.Tests project and chose Debug | Start New Instance

6. Observed that it works fine.

Can you repeat these exact steps with a different result? That is, if you make no modifications at all, does it work? If it does then we must suspect your modifications. If not we must suspect your installation of Visual Studio. My VS2008 shows this in its About box:

Microsoft Visual Studio 2008
Version 9.0.30729.4462 QFE
Microsoft .NET Framework
Version 3.5 SP1

Installed Edition: Professional
Microsoft Visual Basic 2008 91605-270-9339022-60153
Microsoft Visual C# 2008 91605-270-9339022-60153
Microsoft Visual C++ 2008 91605-270-9339022-60153
Microsoft Visual Web Developer 2008 91605-270-9339022-60153
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB2465361) KB2465361...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB2538241) KB2538241...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB944899) KB944899...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB945282) KB945282...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946040) KB946040...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946308) KB946308...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946344) KB946344...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB946581) KB946581...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947171) KB947171...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947173) KB947173...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947180) KB947180...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947540) KB947540...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB947789) KB947789...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB948127) KB948127...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB953256) KB953256...
Hotfix for Microsoft Visual Studio 2008 Professional Edition - ENU (KB971092) KB971092...
Microsoft Visual Studio 2008 Professional Edition - ENU Service Pack 1 (KB945140) KB945140...
Microsoft Visual Studio 2008 Professional Edition - ENU Service Pack 1 (KB947888) KB947888...
Microsoft Visual Studio 2008 Professional Edition - ENU Service Pack 1 (KB948484) KB948484...
Security Update for Microsoft Visual Studio 2008 Professional Edition - ENU (KB2251487) KB2251487...
Security Update for Microsoft Visual Studio 2008 Professional Edition - ENU (KB972222) KB972222...
Security Update for Microsoft Visual Studio 2008 Professional Edition - ENU (KB973675) KB973675...
Update for Microsoft Visual Studio 2008 Professional Edition - ENU (KB956453) KB956453...
Update for Microsoft Visual Studio 2008 Professional Edition - ENU (KB967143) KB967143...
ANTS Profiler Add-in...

Why do you want to use IronPython?

Regarding using JavaScript objects from within C#, you are right that this project does not provide support for that. I use it as an internal scripting engine, in which role it works well. Interaction between C# comes via calls from JavaScript to my C# objects. Exposing JavaScript objects to C# (related to http://javascriptdotnet.codeplex.com/workitem/8952) would be possible, and perhaps is what the nascent JavascriptObject class was for (deleted as part of 0.4 build - I don't know why - see http://javascriptdotnet.codeplex.com/SourceControl/changeset/view/73934#1140956). Anyway, if it was done it would need to work something like this:

Construct a C# object with general-purpose get/set/invoke methods to wrap a JavaScript PermanentHandle<>. You would use strings to identify the JavaScript properties/methods you want. (I suppose you could also use the new .Net 4.0 dynamic stuff.)

When a property or method was to be invoked, it would need to enter unmanaged code and construct a v8::Locker, then use v8 methods to get/set/invoke. Parameters would be converted to/from v8 using the existing javascriptdotnet conversion functions.

If you are not using multiple threads then your stack overflow is probably real. I don't know JavaScript well enough to be able to say whether your code is recursive. Perhaps you should execute some simpler JavaScript to test the engine.

Oliver

Feb 14, 2012 at 11:20 PM

python_24 refers to Python (CPython) 2.4.  The relative path is relative to the full v8 checkout, I think.  I don't have Python 2.4 installed, and yet it works for me.  I guess it is finding Python 2.7 in my path or environment.  Is there any reason you cannot install CPython?  If a lack of admin prevents you installing CPython then you could just check out the CPython included with v8 and try to get it to work:

svn co http://src.chromium.org/svn/trunk/tools/third_party/python_26@89111 third_party/python_26

 

I suspect the error code (3) you are getting is the result of v8 calling abort (http://msdn.microsoft.com/en-us/library/k089yyh0%28v=vs.71%29.aspx) because it reckons things have gone pear shaped.  You could try setting breakpoints in the few bits of managed code that make this call.  (I once debugged a problem leading to abort() and found that v8 was trying to write stuff to the console, but it was not getting through.  If you found a way to get v8 console output to the .Net console then that would be very useful.  The global, managed Log() function below should work if called by unmanaged code.  I haven't tried this, but it looks like you need to write a #pragma unmanaged function and hook it up to V8::AddMessageListener, and then converts Handle<Message> to a wchar_t * and call my Log().)

void Log(wchar_t const *s)
{
    System::Console::WriteLine(gcnew System::String(s));
}

Can you confirm you have SP1 installed on your VS2008?

 

The automatic conversion of the result of Run() was a decision of the original writers of this library, which would cause backward compatbility problems if changed.  You could add a GetWrappedParameter that would return some sort of wrapper object.  Your JavaScript code would just need to store its result in a local variable, I think.

 

   Oliver