Skip to content
This repository has been archived by the owner on Jan 6, 2022. It is now read-only.

Programmable block better exception handling #537

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Programmable block better exception handling #537

wants to merge 4 commits into from

Conversation

Pingger
Copy link

@Pingger Pingger commented Jun 5, 2016

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 ...

Pingger added 2 commits June 5, 2016 16:00
Added the Scripts StackTrace when an Exception is thrown by the Script,
removing all internal calls leading to the Scripts Call.
@Jimmacle
Copy link

Jimmacle commented Jun 5, 2016

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

@Pingger
Copy link
Author

Pingger commented Jun 5, 2016

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
Copy link

Jimmacle commented Jun 5, 2016

"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
Copy link
Author

Pingger commented Jun 5, 2016

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
Copy link
Contributor

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

@Gwindalmir
Copy link
Contributor

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
Copy link

Jimmacle commented Jun 5, 2016

@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
Copy link
Author

Pingger commented Jun 5, 2016

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
Copy link
Contributor

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.

Changed string to StringBuilder so less allocations are made when
"replacing" (deleting) the internal calls
@Pingger
Copy link
Author

Pingger commented Jun 6, 2016

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
Copy link
Contributor

Sibz commented Jun 21, 2016

Any way to get the exception name in there?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants