LuaCsForBarotrauma icon indicating copy to clipboard operation
LuaCsForBarotrauma copied to clipboard

Print exception stack trace in CsPackageManager.TryRun

Open Honkbinger opened this issue 1 year ago • 2 comments

This is not very helpful Screenshot_4 I suggest replacing it with at least this Screenshot_3

Notes

You can just print e, but it's a bit ugly: Screenshot_5 Idk how to capture line number Also, in theory there's a simpler method:

StackTrace st = new StackTrace(e);
st = new StackTrace(st.GetFrames().SkipLast(1));

But it's not available in .NET 6 :BaroDev:

Honkbinger avatar Sep 28 '24 15:09 Honkbinger

At first i thought inner exception could never happen and is useless but now i found that exceptions in static constructors could trigger it I added some prints but i didn't test them yet I obviously tested it by just replacing TryRun with harmony, but i can't do that for inner exception because it happens before my testing mod initialize :BaroDev: So i guess i need to compile luatrauma to test it, and it'll probably take me a few hours to figure out how to compile it in VSCode :BaroDev:

EDIT: seems working Screenshot_3

Honkbinger avatar Sep 28 '24 18:09 Honkbinger

Hi Honk,

This is a good PR. I won't be able to merge it as we're doing a big code refactor. However, I will be manually implementing this into the Runner. Thanks for the contribution.

I'm going to leave the PR open for now and will close it once implemented.

MapleWheels avatar Sep 28 '24 20:09 MapleWheels