KeenSoftwareHouse / SpaceEngineers

2.94k stars 894 forks source link

Programmable block better exception handling #537

Open Pingger opened 8 years ago

Pingger commented 8 years ago

Hi,

Because I hated those simple "an exception occured" messages and always wanted to know where exactly the Exception occurd, I added the Scripts StackTrace to the DetailedInfo, so the Programmer knows where to search for the Problem.

These are the CodeChanges:

TestCode:

public void Main(String arg)
{
    Test_1();
}

public void Test_1()
{
    Test_2();
}

public void Test_2()
{
    Test_3();
}

public void Test_3()
{
    throw new Exception("Test");
}

This is my first .NET programming I have ever made, so feel free to give feedback about my changes. Before I programmed in Java and Scripted in SpaceEngineers.

Greetings Pingger

Edit: Clarified what the code does ...

Jimmacle commented 8 years ago

Do you have a screenshot showing what the exception text looks like with these changes?

Pingger commented 8 years ago

No because the VRage.Game (MyModel.cs and MyPhysicsComponent.cs) and VRage.Network (MyRakNet... .cs) have compilation Errors ... Leading to more Errors because VRage.Game.dll and VRage.Network.dll are missing after these ... They are missing a using directive or sth like that.

BUT the Output should look like a normal StackTrace of C#

Jimmacle commented 8 years ago

"Should" doesn't get merged. You need to test your code and prove that it works with no bad side effects. There are guides on the forums on how to tweak the source to compile in x64.

Pingger commented 8 years ago

Seems you haven't been active for 3 months now here in this gitHub Repository ... There are few dozens of issues that state, that the code here in gitHub currently isn't compilable! THIS NOT MY FAULT! IT IS KEENS FAULT! But I just found a small bug in my code ... because I couldn't test it forgot to use the return value of .Replace(...) But this is fixed now. Also as stated here (#471) http://www.viva64.com/en/b/0376/ their code is full of bugs ... Here some of those issues: #412 #447 #462 #471 #502 I could go on, but I'm far too lazy for this. (Oh and this repository wasn't updated for 3 months now)

rexxar-tc commented 8 years ago

Dude, you don't even know if this code works or not. You don't even know if it compiles.

Gwindalmir commented 8 years ago

Environment.StaceTrace returns the stack trace of where that property was called at. It is not the same as the exception stack trace. I'm not sure how that's useful here, while the original is not.

Jimmacle commented 8 years ago

@Pingger My last comment in this repository was four days ago and the source was last updated nine days ago. Since you've decided to start freaking out I'm far less inclined to help you get your code into the game, sorry.

Pingger commented 8 years ago

I know that Environment.StaceTrace is for the current position and it is suppoed to. so I can filter SpaceEngineers calls from Script calls! As stated in the comments.

Gwindalmir commented 8 years ago

Ah ok. The fact you are filtering out the game's internal methods from the call stack was not clear from the post. I understand now.

Pingger commented 8 years ago

I just managed to get SE to launch (I had to resolve 13 errors in RakNet ... I simply put // infront of each line) RESULT: I Made a Screenshot with some TestCode! see first post

Sibz commented 8 years ago

Any way to get the exception name in there?