Page 1 of 1

[SOLVED] Error passing DateTime value in WCF(SOAP). [PATCH]

Posted: Sun Jan 03, 2016 3:46 pm
by mikeda
In the attached example, passing DateTime value fails in beta 6.1

“Uncaught TypeError: this.ymdToTicks is not a function” occurs in JSIL.XML.js line 735.

Code: Select all

if (tickOrMillisecond > 1000) {
                  var ticks = this['ymdToTicks'](year, month, day);
                  ticks = int64Type()['op_Addition'](ticks, this['hmsToTicks'](hour, minute, second));
                  ticks = int64Type()['op_Addition'](ticks, int64Type()['FromNumber'](tickOrMillisecond));
                  DateTimeCtorSign1().Call(dateTimeType().prototype, "_ctor", null, dt, ticks, kind);
              }

Re: Error passing DateTime value in WCF(SOAP).

Posted: Mon Jan 04, 2016 6:42 am
by JS-Support @Userware
Hi mikeda and welcome to the forums.

Thank you for sending the source project, which allowed us to successfully reproduce the issue.

It is related to the fact that the Service Reference is defined in the class library project instead of the Application project. The issue will be fixed in the Beta 6.2.

In the meantime, to fix the issue, please extract the ZIP file that is attached to this message, and copy the two JavaScript files that it contains to the following location:

C:\Program Files (x86)\MSBuild\CSharpXamlForHtml5\InternalStuff\Libraries

(omit " (x86)" from the path above if you are running on a 32bit system)

The folder should already contain two files with the same name. Please be sure to REPLACE those two existing files. If you do not see any existing file at the above location, please let me know.

You will need to Build your project to try again. Please let me know if the two files fixed the issue.

Thank you.
Regards,
JS-Support

Re: Error passing DateTime value in WCF(SOAP).

Posted: Mon Jan 04, 2016 4:24 pm
by mikeda
Hi JS-Support,

Thank you for your prompt reply.

I confirmed the error I submitted was fixed. But another error related to DateTime arose shown below.
Runtime Error "cannot construct UInt64 from negative number"

I guess this error caused by my time zone that is UTC+09:00 (Tokyo Japan).
In the function hmsmToTicks(hour, minute, second, millisecond) JSIL.Bootstrap.DateTime.js line 560,
the value “rest” becomes negative.

Code: Select all

function hmsmToTicks(hour, minute, second, millisecond) {
        var date = new Date();
        if (millisecond === undefined) {
            millisecond = 0;
        }
        var rest = hour * 60; //60 minutes in a hour
        rest += minute + date.getTimezoneOffset(); //getTimezoneOffset because when DateTimeKind is unspecified, we don't want it to be UTC (and get_Hour uses Date which considers the hour to be UTC and compensates it --> wrong hour at in the end)
        rest *= 60; //60 seconds in a minute
        rest += second;
        rest *= 1000; //1000 milliseconds in a second
        if (millisecond != 0) {
            rest += millisecond + 1; //for some reason, the constructor was creating a DateTime with 1 millisecond less than expected
        }
        rest *= 10000; //10000 ticks in a millisecond
        return $jsilcore.System.UInt64.FromNumber(rest);
    }

Re: Error passing DateTime value in WCF(SOAP).

Posted: Mon Jan 04, 2016 6:24 pm
by mikeda
Hi JS-Support,

I resolve the problem by recreating WCF IIS web site.

Please forget about my previous post.

Regards,
M.Ikeda

Re: Error passing DateTime value in WCF(SOAP).

Posted: Tue Jan 05, 2016 1:31 am
by JS-Support @Userware
Hi,

Thanks for the follow up. I am glad the original error was fixed.

As far as the negative number is concerned, I fear that it is related to the time at which you did the test (for example it happens at midnight UTC+1) and is not solved yet. It is the same bug as reported here:
http://forums.cshtml5.com/viewtopic.php?f=5&t=209
We are working to fix it asap.

Thanks,
Regards,
JS-Support

Re: Error passing DateTime value in WCF(SOAP). [PATCH]

Posted: Sat Sep 24, 2016 4:06 am
by JS-Support @Userware
Hi,

The issue has been fixed in Beta 9.4, which you can download from the following URL:

http://forums.cshtml5.com/viewforum.php?f=6

Thanks.
Regards,
JS-Support