Closed JechoJekov closed 9 years ago
Workaround: Assign the exception to a local variable and pass it to the delegate instead.
var value = 1;
var exc2 = exc;
PrintException(() => Tuple.Create(value, exc2));
The generated code is as follows:
var exc = ss.Exception.wrap($t1);
var value = { $: 1 };
var exc2 = { $: exc };
$Test_App_Application.$printException(ss.mkdel({ value: value, exc2: exc2 }, function() {
return { item1: this.value.$, item2: this.exc2.$ };
}));
Yes, this is a bug
In the code below the "exc" value inside the "PrintException" method is null instead of the exception passed.
The code prints the following:
Instead of the error message.
The code generated for the main method is:
The reason is that unlike the "value" variable "exc" is not wrapped and thus "exc.$" is undefined.