[SOLVED] Code runs in simulator but not in browser

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
rkmore
Posts: 55
Joined: Mon Dec 07, 2015 1:53 pm

[SOLVED] Code runs in simulator but not in browser

Postby rkmore » Thu Nov 09, 2017 1:33 pm

Hello

I am attempting to create an extension to wrap WebGL (Three.JS) and I am having a strange issue.

I have gotten an early test to work in the simulator but in the browser I get an error I can't figure out.

[img]Capture.JPG[/img]

The error is

Uncaught Error: The function 'System.Void ThreeJS.Viewport3D/<Viewport3D_Loaded>d__2::MoveNext()' could not be translated.
at ThreeJS_Viewport3D_$lViewport3D_Loaded$gd__2.UntranslatableFunctionInvoked (JSIL.Core.js:1228)
at System_Runtime_CompilerServices_AsyncVoidMethodBuilder_CopyConstructor.AwaitOnCompleted [as Start$b1$175[!!0]=void] (JSIL.Bootstrap.Async.js:47)
at System_Runtime_CompilerServices_AsyncVoidMethodBuilder_CopyConstructor.System_Runtime_CompilerServices_AsyncVoidMethodBuilder_Start$b1 (jsil://closure/System.Runtime.CompilerS ... lder.Start`1:9)
at BoundGenericMethod_Invoke (jsil://closure/System.Runtime.CompilerS ... lder.Start`1.BindGenericArguments[1]:22)
at ThreeJS_Viewport3D.Viewport3D_Viewport3D_Loaded (app-cshtml5/app/ThreeJS.js?20171191629:45)
at ThreeJS_Viewport3D.Delegate_Invoke [as Loaded] (JSIL.Core.js:9346)
at ThreeJS_Viewport3D.FrameworkElement_INTERNAL_RaiseLoadedEvent (app-cshtml5/app/CSharpXamlForHtml5.js?20171191629:9022)
at Object.INTERNAL_VisualTreeManager_AttachVisualChild_Private (app-cshtml5/app/CSharpXamlForHtml5.js?20171191629:20765)
at Object.INTERNAL_VisualTreeManager_AttachVisualChildIfNotAlreadyAttached (app-cshtml5/app/CSharpXamlForHtml5.js?20171191629:20773)
at Function.Panel_ManageChildrenChanged$00 (app-cshtml5/app/CSharpXamlForHtml5.js?20171191629:23931)


A sample project that demonstrates this error is attached

Thank you
Attachments
ThreeJS.zip
(325.86 KiB) Downloaded 420 times
Capture.JPG
Capture.JPG (48 KiB) Viewed 9501 times

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

Re: Code runs in simulator but not in browser

Postby JS-Support @Userware » Fri Nov 10, 2017 4:51 am

Hi,

Thanks for your message. Wow, it looks promising!

Can you please click the button in the bottom-left corner of the Simulator that is named "View Compilation Log" and copy/paste its content here? The log should contain more information on the issues that JSIL has to translate to JavaScript some of the C# methods.

Regards,
JS-Support

rkmore
Posts: 55
Joined: Mon Dec 07, 2015 1:53 pm

Re: Code runs in simulator but not in browser

Postby rkmore » Fri Nov 10, 2017 7:19 am

Sigh

Never mind. It was just me being stupid.

I forgot the script had to be a compile time value.

Surely the compiler process can give an error when you try to set the script using as variable! It is really confusing that a runtime generated script will work in the simulator but not in the browser.

A compiler error would have saved me several hours worth of pulling my hair out.

Randy

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

Re: Code runs in simulator but not in browser

Postby JS-Support @Userware » Fri Nov 10, 2017 7:21 am

rkmore wrote:Surely the compiler process can give an error when you try to set the script using as variable! It is really confusing that a runtime generated script will work in the simulator but not in the browser.

A compiler error would have saved me several hours worth of pulling my hair out.


OK, we are going to add a compiler error. Thanks a lot for pointing out this issue.

TaterJuice
Posts: 147
Joined: Thu Mar 16, 2017 5:40 am
Contact:

Re: Code runs in simulator but not in browser

Postby TaterJuice » Fri Nov 10, 2017 8:50 am

rkmore wrote:Sigh

Never mind. It was just me being stupid.

I forgot the script had to be a compile time value.

Surely the compiler process can give an error when you try to set the script using as variable! It is really confusing that a runtime generated script will work in the simulator but not in the browser.

A compiler error would have saved me several hours worth of pulling my hair out.

Randy


I second this request. A compiler or design-time error would be ideal!

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

Re: Code runs in simulator but not in browser

Postby JS-Support @Userware » Fri Jan 12, 2018 10:36 am

A compiler warning has now been added in Beta 13.1.
Thanks
Regards
JS-Support


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 3 guests

 

 

cron