.NET's unreadable stack traces

Since Tasks are now a thing in S&box stack traces will look even worse.
Thats why I suggest to implement something like this library.

Here is an example:

It’s as simple as exception.Demystify().


Sorry if this question is a dumb one, but can’t we use this library on the developer side only (manually installed)? Without implementing it natively in the game?

If your screen comparison is correct, that library should be used by developers for sure. However, I don’t know the overhead induced by that library and maybe developers helpers should be manually installed by developers so that we can keep the best performances natively for players.

Maybe 1 library doesn’t break the game, but a heap of them would. Please keep in mind that I’m not a C# developer nor a game developer so maybe I’m totally wrong

I don’t think addons can replace the related code, aside that we can not use NuGet libraries.

I’m trying to understand this library and it seems that’s it’s trying to parse the Exception object to something easier to read (not replacing C# native stacktraces).

If you can’t use Demystify() directly on Exceptions, you would be at least able to use the EnhancedStackTrace class:

I am talking about the exceptions that are shown via the UI, I don’t think that part of the UI is accessible to addons. Aside that the library is using reflection which we don’t have access to either.

not even with something like this?

    # doing many things that will eventually break
catch (Exception ex)
    exception = ex.Demystify();

I didn’t follow if we would have the possibility of printing things in the console

Its not about the console, its about these:

Yes, you can’t do this because Demystify() uses reflection.

Oh I see, well okay, then it would be hard indeed.

Mmmmh, I want to believe you are able to use var stackTrace = new EnhancedStackTrace(exception); and just not use reflection if that’s not supported on S&B.

Problem is that EnhancedStackTrace is using reflection. Otherwise I could just add some random library that wraps all the forbidden stuff and bypass it

1 Like