This is specifically about getting line numbers in stack traces when running c# under edge.js.
Given this C# source file (test.cs)
using System;
using System.Threading.Tasks;
namespace test {
public class Startup {
public async Task<object> Invoke(dynamic input) {
try {
throw new Exception("some error");
} catch(Exception e) {
Console.WriteLine(e);
}
return null;
}
}
}
I'm building a .dll (and .dll.mdb) with the command:
mcs -debug -target:library -out:test.dll test.cs
And running with this edge.js script:
var edge = require('edge');
var myfunc = edge.func({
assemblyFile: __dirname + '/test.dll'
});
myfunc(true, function(err, result) { });
The stack trace in the output has no filename or line numbers:
System.Exception: some error
at test.Startup+<Invoke>c__async0.MoveNext () [0x00000] in <filename unknown>:0
Is there a way to get filenames and line numbers in the stack trace instead of <filename unknown>:0 ?
From the command line, mono must be run using the --debug argument in order to get line numbers. If that's the case here, then this question may boil down to "How do i pass arguments to CLR from edge.js?"
Versions: node.js:v0.10.39, mcs/mono:4.0.4.0, edge.js:4.0.0
[Edit] I found you can get command line arguments into mono from edge by setting the environment variable MONO_ENV_OPTIONS. Unfortunately this doesn't work with --debug.