Quantcast
Channel: ClearScript
Viewing all 2297 articles
Browse latest View live

Commented Unassigned: Issue with building ClearScript with V8 support [62]

$
0
0
Hi there,

I just downloaded ClearScript-5.4.0.zip directly from CodePlex and tried to build it in order to run it with V8 support. However, I couldn't get past the point of building 32-bit version of V8. I've proceeded to analyze where it is breaking exactly, and it appears it is happening when this line is executed in V8Update.cmd:

```
msbuild /p:Configuration=%mode% /p:Platform=Win32 /t:v8 tools\gyp\v8.sln >build.log
```

Build log it-self revealed that I have some files missing that affect the build the process. see below:

```
...
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\CL.exe /c /I..\..\src /Zi /nologo /W3 /WX /O2 /Ob2 /Oi /Oy- /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D V8_TARGET_ARCH_IA32 /D WIN32 /D V8_DEPRECATION_WARNINGS /D V8_USE_DEFAULT_PLATFORM /D BUILDING_V8_SHARED /D V8_SHARED /D _UNICODE /D UNICODE /GF /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /GR- /Fo"..\..\build\Release\obj\v8_nosnapshot.ia32\\" /Fd"..\..\build\Release\obj\v8_nosnapshot.ia32\vc110.pdb" /Gd /TP /wd4355 /wd4800 /analyze- /errorReport:queue /MP ..\..\build\Release\obj\global_intermediate\libraries.cc "..\..\build\Release\obj\global_intermediate\experimental-libraries.cc" "..\..\build\Release\obj\global_intermediate\trig-table.cc" "..\..\src\snapshot-empty.cc"
libraries.cc
experimental-libraries.cc
trig-table.cc
snapshot-empty.cc
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\libraries.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\experimental-libraries.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\trig-table.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj.metaproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8.vcxproj.metaproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8.sln" (v8 target(s)) -- FAILED.
...
```
After inspecting above error paths in the explorer, I can confirm that above files are indeed missing, so I'm not 100% sure what could've led to it. Is there any help you could provide on this build issue?

Additional Info:
* Windows 7 Enterprise with SP1 installed, 64-bit.
* Visual Studio(s) installed: 2010/2012/2013
* ClearScript built by using Developer Command Prompt for VS2012
* Downloaded ClearScript API 5.4.0 as zip from [https://clearscript.codeplex.com/releases/view/135637](https://clearscript.codeplex.com/releases/view/135637)
* Build.log is attached for your reference
Comments: Just wanted to comment quickly...I was finally able to build after a complete re-install of VS2012. I also installed KB2781514 patch (could be found [here](http://www.microsoft.com/en-us/download/details.aspx?id=36020)) as part of the process of bringing my newly installed VS2012 to the compatibility level required to run it. Thanks, Max

New Post: Handling CLR exceptions in JS

$
0
0
I see there was mention of a more general version of this but I don't know where to look for follow-up.

Is there some sort of interface or magic return type we can use to signal the result of an invocation should be turned into a hosted script exception?

e.g. public void MyCLRMethod() {
if (errorCondition) {
  return new ITurnIntoaScriptingExceptionType('Oops you did something wrong');
}
}

script:
try {
 o.MyClrMethod();
}
catch(x) {
 // yay I was handled?
}

I need a way to raise errors in the .NET world that can be handled by the script (V8).

New Post: Handling CLR exceptions in JS

$
0
0
Hello!

ClearScript 5.4 does include a generalized version of tryCatch(). Here's an example:
engine.AddHostObject("host", new HostFunctions());
engine.AddHostType("Console", typeof(Console));
engine.AddHostType("WebClient", typeof(WebClient));
engine.Execute(@"
    var webClient = new WebClient();
    host.tryCatch(
        function () {
            // download web document
            Console.WriteLine(webClient.DownloadString('http://cnn.com'));
        },
        function (exception) {
            // dump exception
            Console.WriteLine('*** ERROR: ' + exception.GetBaseException().ToString());
            return true;
        },
        function () {
            // clean up
            Console.WriteLine('*** CLEANING UP ***');
            webClient.Dispose();
        }
    );
");
Please let us know if handling host exceptions this way isn't practical in your scenario. Unlike the older script engines, V8 could probably enable a more natural pattern, although ClearScript currently doesn't support that.

Thanks!

Edited Issue: Issue with building ClearScript with V8 support [62]

$
0
0
Hi there,

I just downloaded ClearScript-5.4.0.zip directly from CodePlex and tried to build it in order to run it with V8 support. However, I couldn't get past the point of building 32-bit version of V8. I've proceeded to analyze where it is breaking exactly, and it appears it is happening when this line is executed in V8Update.cmd:

```
msbuild /p:Configuration=%mode% /p:Platform=Win32 /t:v8 tools\gyp\v8.sln >build.log
```

Build log it-self revealed that I have some files missing that affect the build the process. see below:

```
...
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\CL.exe /c /I..\..\src /Zi /nologo /W3 /WX /O2 /Ob2 /Oi /Oy- /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D V8_TARGET_ARCH_IA32 /D WIN32 /D V8_DEPRECATION_WARNINGS /D V8_USE_DEFAULT_PLATFORM /D BUILDING_V8_SHARED /D V8_SHARED /D _UNICODE /D UNICODE /GF /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /GR- /Fo"..\..\build\Release\obj\v8_nosnapshot.ia32\\" /Fd"..\..\build\Release\obj\v8_nosnapshot.ia32\vc110.pdb" /Gd /TP /wd4355 /wd4800 /analyze- /errorReport:queue /MP ..\..\build\Release\obj\global_intermediate\libraries.cc "..\..\build\Release\obj\global_intermediate\experimental-libraries.cc" "..\..\build\Release\obj\global_intermediate\trig-table.cc" "..\..\src\snapshot-empty.cc"
libraries.cc
experimental-libraries.cc
trig-table.cc
snapshot-empty.cc
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\libraries.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\experimental-libraries.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\trig-table.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj.metaproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8.vcxproj.metaproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8.sln" (v8 target(s)) -- FAILED.
...
```
After inspecting above error paths in the explorer, I can confirm that above files are indeed missing, so I'm not 100% sure what could've led to it. Is there any help you could provide on this build issue?

Additional Info:
* Windows 7 Enterprise with SP1 installed, 64-bit.
* Visual Studio(s) installed: 2010/2012/2013
* ClearScript built by using Developer Command Prompt for VS2012
* Downloaded ClearScript API 5.4.0 as zip from [https://clearscript.codeplex.com/releases/view/135637](https://clearscript.codeplex.com/releases/view/135637)
* Build.log is attached for your reference

Commented Issue: Issue with building ClearScript with V8 support [62]

$
0
0
Hi there,

I just downloaded ClearScript-5.4.0.zip directly from CodePlex and tried to build it in order to run it with V8 support. However, I couldn't get past the point of building 32-bit version of V8. I've proceeded to analyze where it is breaking exactly, and it appears it is happening when this line is executed in V8Update.cmd:

```
msbuild /p:Configuration=%mode% /p:Platform=Win32 /t:v8 tools\gyp\v8.sln >build.log
```

Build log it-self revealed that I have some files missing that affect the build the process. see below:

```
...
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\CL.exe /c /I..\..\src /Zi /nologo /W3 /WX /O2 /Ob2 /Oi /Oy- /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D V8_TARGET_ARCH_IA32 /D WIN32 /D V8_DEPRECATION_WARNINGS /D V8_USE_DEFAULT_PLATFORM /D BUILDING_V8_SHARED /D V8_SHARED /D _UNICODE /D UNICODE /GF /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /GR- /Fo"..\..\build\Release\obj\v8_nosnapshot.ia32\\" /Fd"..\..\build\Release\obj\v8_nosnapshot.ia32\vc110.pdb" /Gd /TP /wd4355 /wd4800 /analyze- /errorReport:queue /MP ..\..\build\Release\obj\global_intermediate\libraries.cc "..\..\build\Release\obj\global_intermediate\experimental-libraries.cc" "..\..\build\Release\obj\global_intermediate\trig-table.cc" "..\..\src\snapshot-empty.cc"
libraries.cc
experimental-libraries.cc
trig-table.cc
snapshot-empty.cc
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\libraries.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\experimental-libraries.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\trig-table.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj.metaproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8.vcxproj.metaproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8.sln" (v8 target(s)) -- FAILED.
...
```
After inspecting above error paths in the explorer, I can confirm that above files are indeed missing, so I'm not 100% sure what could've led to it. Is there any help you could provide on this build issue?

Additional Info:
* Windows 7 Enterprise with SP1 installed, 64-bit.
* Visual Studio(s) installed: 2010/2012/2013
* ClearScript built by using Developer Command Prompt for VS2012
* Downloaded ClearScript API 5.4.0 as zip from [https://clearscript.codeplex.com/releases/view/135637](https://clearscript.codeplex.com/releases/view/135637)
* Build.log is attached for your reference
Comments: Thanks, Max. Please be aware that ClearScript's next point release will require Visual Studio 2013 (because more recent V8 drops require more C++11 support than Visual Studio 2012 provides).

Commented Issue: Issue with building ClearScript with V8 support [62]

$
0
0
Hi there,

I just downloaded ClearScript-5.4.0.zip directly from CodePlex and tried to build it in order to run it with V8 support. However, I couldn't get past the point of building 32-bit version of V8. I've proceeded to analyze where it is breaking exactly, and it appears it is happening when this line is executed in V8Update.cmd:

```
msbuild /p:Configuration=%mode% /p:Platform=Win32 /t:v8 tools\gyp\v8.sln >build.log
```

Build log it-self revealed that I have some files missing that affect the build the process. see below:

```
...
ClCompile:
C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\bin\CL.exe /c /I..\..\src /Zi /nologo /W3 /WX /O2 /Ob2 /Oi /Oy- /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D V8_TARGET_ARCH_IA32 /D WIN32 /D V8_DEPRECATION_WARNINGS /D V8_USE_DEFAULT_PLATFORM /D BUILDING_V8_SHARED /D V8_SHARED /D _UNICODE /D UNICODE /GF /Gm- /EHsc /MD /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /GR- /Fo"..\..\build\Release\obj\v8_nosnapshot.ia32\\" /Fd"..\..\build\Release\obj\v8_nosnapshot.ia32\vc110.pdb" /Gd /TP /wd4355 /wd4800 /analyze- /errorReport:queue /MP ..\..\build\Release\obj\global_intermediate\libraries.cc "..\..\build\Release\obj\global_intermediate\experimental-libraries.cc" "..\..\build\Release\obj\global_intermediate\trig-table.cc" "..\..\src\snapshot-empty.cc"
libraries.cc
experimental-libraries.cc
trig-table.cc
snapshot-empty.cc
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\libraries.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\experimental-libraries.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
c1xx : fatal error C1083: Cannot open source file: '..\..\build\Release\obj\global_intermediate\trig-table.cc': No such file or directory [c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj]
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8_nosnapshot.ia32.vcxproj.metaproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8.vcxproj.metaproj" (default targets) -- FAILED.
Done Building Project "c:\ClearScript\ClearScript\V8\V8\build\v8-ia32\tools\gyp\v8.sln" (v8 target(s)) -- FAILED.
...
```
After inspecting above error paths in the explorer, I can confirm that above files are indeed missing, so I'm not 100% sure what could've led to it. Is there any help you could provide on this build issue?

Additional Info:
* Windows 7 Enterprise with SP1 installed, 64-bit.
* Visual Studio(s) installed: 2010/2012/2013
* ClearScript built by using Developer Command Prompt for VS2012
* Downloaded ClearScript API 5.4.0 as zip from [https://clearscript.codeplex.com/releases/view/135637](https://clearscript.codeplex.com/releases/view/135637)
* Build.log is attached for your reference
Comments: Noted, thanks again.

New Post: Evaluating CLR Method as value in script

$
0
0
Well, I was using jQuery as an example since it's a common library. My code will be retrieving and executing scripts from 3rd party servers. I am trying to achieve a high level of compatibility (I have been using PhantomJS and/or Selenium/WebDriver but... this is more fun). I could do fixups and swap out libraries on the fly if I have to but I'd rather not if I can avoid it.

New Post: Evaluating CLR Method as value in script

$
0
0
Hi krisoye

Is there a way to override the toString() method on ClearScript objects? Perhaps via some sort of Prototype object? [...] Expected: Something other than undefined and ideally overridden to "function getElementsByClassName() { [native code] }"

Installing a custom toString method for host objects is quite simple. However, producing special output specifically for host methods is a bit tricky because the managed type that represents host methods is internal to ClearScript.

Nevertheless, it can be done with a bit of trickery. Here's a code sample that replaces the built-in toString method for host objects with a function that produces the desired output for host methods:
dynamic setup = engine.Evaluate(@"
    (function (obj, func) {
        obj.constructor.prototype.toString = function() { return func(this); }
    }).valueOf();
");

setup(newobject(), new Func<object, string>(obj => {
    var str = obj.ToString();
    if (obj.GetType().FullName == "Microsoft.ClearScript.HostMethod") {
        return"function " + str.Substring(11) + "() { [native code] }";
    }
    return str;
}));
Clearly this is quite hacky and may not work in the future, but hopefully it can provide a quick fix.

Good luck!

New Post: Handling CLR exceptions in JS

$
0
0
Awesome! I had some other issues that were resolved by reading from the forum here. Originally I had exceptions bubbling up and out, but now that I've been able to attach a debugger I can see it hitting the catch block and that it was able to continue on after (presumably after I fixed my other issues). The error message I got was not what I expected ("An expression of type 'System.Boolean' cannot be used to initialize an array of type 'System.Object'") but I don't care too much about that so long as it hits the catch block and continues on.

Thanks again!

New Post: Evaluating CLR Method as value in script

$
0
0
Well, that's pretty slick! V8 seems to run this code unless I attach a debugger. JScript (which seems easier to debug) does not (which complains about constructor.prototype not being defined). If I try to attach Eclipse with this hack in I get an appcash in QTAgent32.exe:
<ProblemSignatures>
        <EventType>APPCRASH</EventType>
        <Parameter0>QTAgent32.exe</Parameter0>
        <Parameter1>11.0.50727.1</Parameter1>
        <Parameter2>5011df53</Parameter2>
        <Parameter3>StackHash_08ac</Parameter3>
        <Parameter4>0.0.0.0</Parameter4>
        <Parameter5>00000000</Parameter5>
        <Parameter6>c0000005</Parameter6>
        <Parameter7>74e0cb49</Parameter7>
    </ProblemSignatures>
    <DynamicSignatures>
        <Parameter1>6.1.7601.2.1.0.256.48</Parameter1>
        <Parameter2>1033</Parameter2>
        <Parameter22>08ac</Parameter22>
        <Parameter23>08ac7c35000c889c52b861a824ddc684</Parameter23>
        <Parameter24>2ac4</Parameter24>
        <Parameter25>2ac405e344ce12df2b2c2da92f28dde5</Parameter25>
    </DynamicSignatures>
Thanks, though, that does seem to do exactly what I want even if it might not be available in the future.

New Post: Evaluating CLR Method as value in script

$
0
0
Additional: I disabled my own "prototype objects" and was able to step into the debugger. So it must be something in my code that is causing the crash. Thanks again for the workaround!

New Post: Evaluating CLR Method as value in script

$
0
0
Hi again,

Glad to hear that it worked for you, but yes, this solution can only work in V8, as JScript's embedding model is completely different and doesn't involve native proxies that conform to JavaScript's standard prototype scheme.

In fact, there's currently no way to set this up in JScript. You can expose a .NET type that defines toString as a universal extension method, but that doesn't work for host methods because script code is only allowed to invoke them (ClearScript blocks all other operations including member access).

Thanks!

New Post: ClearScript on Mono/Xamarin?

$
0
0
Just signing in to register my interest in running under Mono also.

considering Microsoft is making vNext cross platform I think having this EXCELLENT project cross platform would be awesome. I know, I know, easier said than done but from my user perspective talk is cheap :)

New Post: I get memory leaks without running CollectGarbage

$
0
0
Hi I have a script that is simply:
function foo(items) {
    items.toSomething(); // toSomething is a .NET function that does something to the list and returns a new one.
}

loop { // this loop runs many times
     var items = new List<int>(); // This list grows over time.
    _engine.Script.foo(items);
}
I find that if I do not collect garbage eventually I end up with a memory leak, what is it holding onto I assume the collection passed into the method? running garbage collection impacts my performance, is there something else I can do?



Thanks

New Post: I get memory leaks without running CollectGarbage

$
0
0
Hi Stefan,

I find that if I do not collect garbage eventually I end up with a memory leak, what is it holding onto I assume the collection passed into the method?

The CLR and the script engine have independent object systems and garbage collectors. When you pass a .NET object to script code (or vice versa), a proxy is created on the receiving side that provides access to the actual object on the sending side.

By necessity, the proxy represents a reachable reference to the actual object and prevents it from being collected. Only when the proxy is collected does the actual object become available to its garbage collector, and only if no other references exist on either side.

The issue you're running into, most likely, is that V8's garbage collector is very lazy and relies on external triggers. Specifically, V8 needs the host to say, "Hey V8, now would be a good time to collect some garbage" (CollectGarbage(false) in ClearScript), or "Hey V8, I'm running low on memory, collect all the garbage you can no matter how long it takes" (CollectGarbage(true) in ClearScript).

running garbage collection impacts my performance, is there something else I can do?

Sometimes V8 can detect garbage collection opportunities (or emergencies) internally, but it seems to favor performance very heavily over memory efficiency without external prodding. Therefore it's up to the host to track its own condition (e.g., detect idleness, low-memory situations, etc.) and send the appropriate notifications via CollectGarbage().

Good luck!

Created Unassigned: ClearScript V8ScriptEngine Arithmetic [63]

$
0
0
Hello,

I need help about clearscript. I am using class and this class has a variable. Example is under.

public class DataDict
{
public decimal AmountPenetrationBonus { get; set; }
public decimal TermFactor { get; set; }
public decimal ConstantBonus { get; set; }
public decimal BonusForOtherCreditTypes { get; set; }
public decimal CampaignExponent { get; set; }
public String Formula { get; set; }
}

DataDict dataDict = new DataDict();
dataDict.AmountPenetrationBonus = 5;
dataDict.TermFactor = 2;
dataDict.ConstantBonus = 3;
dataDict.BonusForOtherCreditTypes = 4;
dataDict.CampaignExponent = 2;
dataDict.Formula = AmountPenetrationBonus*TermFactor *ConstantBonus ;

and my script is
using (var engine = new V8ScriptEngine())
{

engine.AddHostObject("DataDict", dataDict);
engine.Execute(@"AmountPenetrationBonus= DataDict.AmountPenetrationBonus;
TermFactor=DataDict.TermFactor;
ConstantBonus = DataDict.ConstantBonus;
BonusForOtherCreditTypes=DataDict.BonusForOtherCreditTypes;
CampaignExponent = DataDict.CampaignExponent;
result = DataDict.Formula;
");
var result = engine.Script.result;
}
but return the result value =AmountPenetrationBonus*TermFactor *ConstantBonus , it was be 5*2*3 than return to me 30. engine.Script.result return to me the string value doesnt decimal value.
Please help about this problem.

Thanks for help and sorry for my english.

Edited Unassigned: ClearScript V8ScriptEngine Arithmetic [63]

Edited Issue: ClearScript V8ScriptEngine Arithmetic [63]

Commented Issue: ClearScript V8ScriptEngine Arithmetic [63]

$
0
0
i resolved issue, thanks :)
Comments: Glad to hear it!

New Post: access indexer of a hosted object

$
0
0
I am trying to get my NamedNodeMap type working which may be indexed either by a number or a string. If I implement IList then I can evaluate expressions like map[0] -> Attr(href="") but map['href'] = undefined. If I implement/inherit either IPropertyBag or DynamicObject then map['href'] acts as expected but map[0] = undefined.

Am I missing something obvious? I tried using DynamicObject's overrides for getting/setting members by name and index.
Viewing all 2297 articles
Browse latest View live




Latest Images