For a long time, I’ve been wondering why the C# stack traces are so unreadable. I prefer to use C# over LUA or JS, because of its Intellisens and statically typed variables, but the C# stack traces in FiveM makes it a lot harder to debug and find where my problems originated.
While researching for this problem I found out that a better stack trace has been implemented for at least LUA and in the cookbook post " Improving script stack traces" they also show a better C# and JS stack trace. but I have never managed to replicate or get the same result.
This is the code that generates the intentional runtime error above
namespace CSErrorTest.Client {
public class ClientMain : BaseScript {
public ClientMain() {
object o = null;
string s = o.ToString();
}
}
}
Cookbook post: Improving script stack traces – FiveM Cookbook
EDIT: Just in case someone is wondering, yes I’m running the latest server build and Scripting API