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

Please report bugs here. If you are unsure whether something is a bug or an expected behavior, please post it on the "Technical Support" forum instead, and wait for a moderator to handle/move the post.
mikeda
Posts: 8
Joined: Sun Jan 03, 2016 3:20 pm

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

Postby mikeda » Sun Jan 03, 2016 3:46 pm

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);
              }
Attachments
WcfService1.zip
(4.7 MiB) Downloaded 35 times

JS-Support
Site Admin
Posts: 664
Joined: Tue Apr 08, 2014 3:42 pm

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

Postby JS-Support » Mon Jan 04, 2016 6:42 am

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
Attachments
PatchForMikeda.zip
(14.92 KiB) Downloaded 31 times

mikeda
Posts: 8
Joined: Sun Jan 03, 2016 3:20 pm

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

Postby mikeda » Mon Jan 04, 2016 4:24 pm

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);
    }

mikeda
Posts: 8
Joined: Sun Jan 03, 2016 3:20 pm

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

Postby mikeda » Mon Jan 04, 2016 6:24 pm

Hi JS-Support,

I resolve the problem by recreating WCF IIS web site.

Please forget about my previous post.

Regards,
M.Ikeda

JS-Support
Site Admin
Posts: 664
Joined: Tue Apr 08, 2014 3:42 pm

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

Postby JS-Support » Tue Jan 05, 2016 1:31 am

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

JS-Support
Site Admin
Posts: 664
Joined: Tue Apr 08, 2014 3:42 pm

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

Postby JS-Support » Sat Sep 24, 2016 4:06 am

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


Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 1 guest

 

 

cron