Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9065507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T16:31:07+00:00 2026-06-16T16:31:07+00:00

I want to execute a javascript code from c# using DLR. So I wrote

  • 0

I want to execute a javascript code from c# using DLR.

So I wrote a simple code using c# and Jint :

  var script = @"
                               function show( )
                               {
                                      return  parseInt('123asd'); //in js it's 123
                               };
                               return show();";

                var result = new JintEngine().Run(script);
                Console.WriteLine(result);

parseInt('123asd') in javascript is : 123

But the result I get is :

enter image description here

  • Maybe I don’t see the whole picture, but if a programmer on the other side of the world sends me his script file, I (and him) expect the result to be consistent!

  • If I was mistaken, in what scenario would I use running other code on .Net? (I will have to be very very suspicious for every line of code…)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T16:31:08+00:00Added an answer on June 16, 2026 at 4:31 pm

    This seems to be current behavior of Jint’s partseInt function.

    Related code:

    // most common case
    double result;
    if(double.TryParse(number,NumberStyles.Any, CultureInfo.InvariantCulture, out result)) {
        // parseInt(12.42) == 42
        return NumberClass.New(sign * Math.Floor(result));
    }
    else {
        return this["NaN"];
    }
    

    .NET’s double.TryParse won’t parse '123asd' as 123, but returns that it cannot parse the whole string.

    You should fill in bug report in Jint.

    E: This is problem with “standards”. You can never get standards 100% compatible across all implementations. There will always be differences. Just look at IE vs Chrome vs Firefox vs Opera. All of those use different javascript engines, so you can expect differences. If you really want to be cross-compatible, you should implement according to standard and treat all non-standard behavior as bug in implementation. It is up to you if you try to work around this bug or report it and expect it to be fixed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to execute javascript code from my iPhone application using UIWebView. But only
I want to execute a javascript function in a c# code. Here is what
I want to execute any JavaScript function that is part of a JSON using
I am trying to execute a javascript function from a PHP script by sending
I have asp.net generated html code. I want execute jQuery click function when user
I want to execute a code helloword.cpp which takes in some argument from console
i want to execute some commands using NSIS script , but for the commands
I'm using TinyMCE and want to execute a php script get the output and
I want some personally developed JavaScript code to execute whenever I load a page
I have to execute a given String as JavaScript code, e.g. eval('Foo.setMessage(Hello!)') , from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.