Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Godot editor debugger doesn't give full stacktrace info for Mono exceptions #14589

Closed
realManix opened this issue Dec 12, 2017 · 17 comments
Closed

Comments

@realManix
Copy link

realManix commented Dec 12, 2017

Bugsquad edit: See #14822 for a clear description of the issue and how to fix it.


Operating system or device, Godot version, GPU Model and driver (if graphics related):
Windows 10
Godot 3.0 beta 1

Issue description:

When a exception occurs in a C# script, the debugger doesn't display very helpful information, such as the name of the script that caused the error, and the line where it happened.

Steps to reproduce:
Add a C# script to any node and try to produce a NullReferenceException in any Godot callbacks.
E.g.,
in _Ready(),
string nullStr = null;
int i = nullStr.Length;

When you run the code, the debugger will tell you that a NullReferenceException has been raised, but it won't tell you where it happened.

Link to minimal example project:

@realManix realManix changed the title C# debugger improvement C# debugger improvement (3.0 beta 1) Dec 12, 2017
@akien-mga akien-mga changed the title C# debugger improvement (3.0 beta 1) C# debugger improvement Dec 12, 2017
@akien-mga akien-mga changed the title C# debugger improvement Stack traces inside Mono do not show file/line numbers, mono should be run with --debug flag Dec 19, 2017
@akien-mga akien-mga added this to the 3.0 milestone Dec 19, 2017
@mhilbrunner
Copy link
Member

cc @neikeq :)

@neikeq
Copy link
Contributor

neikeq commented Dec 19, 2017

You mean the Godot editor debugger, right? We need to implement ScriptLanguage::debug_get_current_stack_info() and use StackTrace to get the StackFrames.

@PJB3005
Copy link
Contributor

PJB3005 commented Dec 20, 2017

Ok so. This actually does work perfectly fine.

... On MacOS.

@neikeq
Copy link
Contributor

neikeq commented Dec 21, 2017

@PJB3005 I guess you mean #14822 :) This is a different one.

@PJB3005
Copy link
Contributor

PJB3005 commented Dec 21, 2017

oh I only see it now, this one is about the menu cutting off anything except the exception header. Right.

Might wanna remove the thing about --debug because stack traces work either way in .NET. The file and line numbers are the difference.

@akien-mga
Copy link
Member

We have now entered release freeze for Godot 3.0 and want to focus only on release critical issues for that milestone. Therefore, we're moving this issue to the 3.1 milestone, though a fix may be made available for a 3.0.x maintenance release after it has been tested in the master branch during 3.1 development. If you consider that this issue is critical enough to warrant blocking the 3.0 release until fixed, please comment so that we can assess it more in-depth.

@akien-mga akien-mga modified the milestones: 3.0, 3.1 Jan 5, 2018
@akien-mga akien-mga changed the title Stack traces inside Mono do not show file/line numbers, mono should be run with --debug flag Godot editor debugger doesn't give full stacktrace info for Mono exceptions Jan 5, 2018
@realManix
Copy link
Author

realManix commented Jan 5, 2018

I think this should be a 3.0 milestone since without proper debugging support, developing in C# could be really tough because it would be hard to tell where the exceptions are coming from unless they are user-defined exceptions.

@akien-mga
Copy link
Member

I think the recommended workflow for now is to use a full-fledged C# IDE for debugging, and not Godot's debugger. Ideally it should be possible to get decent debugging support in Godot itself, but if it comes only in 3.1 / 3.0.1, it should not be a showstopper IMO.

But I'll let @neikeq and @Hinsbart comment further as they are more familiar with the C# workflow.

@mysticfall
Copy link
Contributor

mysticfall commented Jan 7, 2018

I also think it'd be worthwhile to include this along with #15234 to be moved to 3.0 milestone. The reason is because many people will try Godot 3.0 once it gets released, as it's the first major release with C# support.

However, if they see it's almost impossible to read error messages or to find out where they occurred, it'd probably give them a bad impression and prevent them from doing a serious project with it.

I suppose even seasoned developers of C# would find it very difficult to debug the project without being able to read the stacktrace. Having a remote debuger in an IDE helps, but it's mostly used to find out why a certain error has occurred, rather than to see what error has occurred and where.

Currently, I'm using Rider which is a very capable IDE for C# and it works well with Godot's remote debugging feature, but I have to rely on my 'gut feeling' and adding a lot of GD.Print messages to track down a problem in Godot. I suppose it's not the type of experience that we'd want to present to those who come to try Godot for the first time.

So I wish we could include both of the issues in 3.0 milestone if it wouldn't take too much time to fix, to ensure Godot to be at least a viable option to develop real game projects in C# for new users.

@PJB3005
Copy link
Contributor

PJB3005 commented Jan 7, 2018 via email

@realManix
Copy link
Author

realManix commented Jan 22, 2018

The file name still doesn't seem to appear properly though? For some reason it says: "C Source: 0". Tested on RC 2 Mono.

@mysticfall
Copy link
Contributor

@realManix Could it be a similar issue as #15885?

@neikeq
Copy link
Contributor

neikeq commented Jan 22, 2018

@realManix are you on Windows? it sounds like #14822

@realManix
Copy link
Author

@mysticfall I don't think so, for one I'm using C# and the all the details of the errors (or Exceptions, in my case) seem to be displayed, just not as it should. In my case, the debugger doesn't show me the file name of the script that raised the Exception, but I also just realised that it does display the full signature of the method from which the Exception was raised--which includes the class name--so I guess I can still find out the source of the error.

@realManix
Copy link
Author

@neikeq I think this is more closely related to the original problem I had, which seems to be somewhat resolved in #15463, but this new feature seems somewhat buggy.
untitled
The helper text says "C Source: :0" where it should tell me the file name--I think?--but I figure you can still deduce from "MySpatial._Ready() in the stack trace anyways, so this does not seem like a severe issue.

@neikeq
Copy link
Contributor

neikeq commented Jan 22, 2018

It really sounds a lot like #14822 (stack traces not including file location on Windows).

@realManix
Copy link
Author

I guess so then. I thought it was different because I recall seeing that issue posted before stack trace was implemented in #15463, but the title does sound about right.

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

No branches or pull requests

6 participants