Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect translation of C# async methods #994

V0d01ey opened this Issue Jul 25, 2018 · 1 comment


None yet
3 participants
Copy link

V0d01ey commented Jul 25, 2018

Following additional method of the template class Client throw exception on usage.

        static public async Task<string> SendObject(string str)
                return await Remoting.DoSomething(str);
            catch (Exception ex)

Console output:

> ClientServer7.Client.SendObject('123');
Object { status: 3, continuations: [] }
Remoting exception ClientServer7:ClientServer7.Remoting.DoSomething:1544666470 
	innerExceptions: (1) […]​​
		0: TypeError: "$this is undefined"
			AsyncBase	http://localhost:49824/Scripts/WebSharper/WebSharper.Main.js?h=-482975838:423:7
			FromContinuations	http://localhost:49824/Scripts/WebSharper/WebSharper.Main.js?h=-482975838:1202:4
			Bind	http://localhost:49824/Scripts/WebSharper/WebSharper.Main.js?h=-482975838:1363:10
			tick	http://localhost:49824/Scripts/WebSharper/WebSharper.Main.js?h=-482975838:820:8
			Fork	http://localhost:49824/Scripts/WebSharper/WebSharper.Main.js?h=-482975838:834:5​​
			length: 1​​
		<prototype>: Array []

Line 423 of WebSharper.Main.js is:


This comment has been minimized.

Copy link

Jand42 commented Jul 30, 2018

@V0d01ey thanks for the report! try/finally is not supported for async and iterators, but try/catch should be, so this is another scoping bug, looking into this.

@Jand42 Jand42 added the bug label Jul 30, 2018

Jand42 added a commit that referenced this issue Jul 30, 2018

@Jand42 Jand42 closed this in 062fea3 Jul 30, 2018

@Tarmil Tarmil added the label Jul 31, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.