Page 1 of 1

[SOLVED] Code runs in simulator but not in browser

Posted: Thu Nov 09, 2017 1:33 pm
by rkmore
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

Re: Code runs in simulator but not in browser

Posted: Fri Nov 10, 2017 4:51 am
by JS-Support @Userware
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

Re: Code runs in simulator but not in browser

Posted: Fri Nov 10, 2017 7:19 am
by rkmore
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

Re: Code runs in simulator but not in browser

Posted: Fri Nov 10, 2017 7:21 am
by JS-Support @Userware
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.

Re: Code runs in simulator but not in browser

Posted: Fri Nov 10, 2017 8:50 am
by TaterJuice
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!

Re: Code runs in simulator but not in browser

Posted: Fri Jan 12, 2018 10:36 am
by JS-Support @Userware
A compiler warning has now been added in Beta 13.1.
Thanks
Regards
JS-Support