GithubHelp home page GithubHelp logo

Comments (9)

Kalmalyzer avatar Kalmalyzer commented on August 18, 2024 1

Thanks -- I got a repro of it just now. It is a Windows specific problem, having to do with forward vs backward slashes.

This opens correctly in my editor of choice:

-		frame	{UberLogger.LogStackFrame}	UberLogger.LogStackFrame
		DeclaringType	"PendingUnitAbility"	System.String
		FileName	"C:\\Plastic\\FreedomPrototype\\Assets\\Scripts\\PendingUnitAbility.cs"	System.String
		FormattedMethodName	"PendingUnitAbility.Execute(System.Action completionCallback) (at Assets\\Scripts\\PendingUnitAbility.cs:86)"	System.String
		LineNumber	86	System.Int32
		MethodName	"Execute"	System.String
		ParameterSig	"System.Action completionCallback"	System.String

This opens in the wrong editor:

-		frame	{UberLogger.LogStackFrame}	UberLogger.LogStackFrame
		DeclaringType	"FireAgainstUnitVisualTrigger+<AimThenFire>c__Iterator0"	System.String
		FileName	"Assets/Scripts/Abilities/VisualTriggers/FireAgainstUnitVisualTrigger.cs"	System.String
		FormattedMethodName	"FireAgainstUnitVisualTrigger+<AimThenFire>c__Iterator0.MoveNext () (at Assets/Scripts/Abilities/VisualTriggers/FireAgainstUnitVisualTrigger.cs:41)"	System.String
		LineNumber	41	System.Int32
		MethodName	"MoveNext "	System.String
		ParameterSig	null	System.String

Your screenshot is also one with forward slashes. When I look around at callstacks in my application it seems that paths come in three forms with the current UberLogger stacktrace code:

  • C:\buildslave\unity\... - Unity's internal callstacks. We do not have source so these are not openable.
  • Assets\blah\... - Code from my project
  • Assets/blah/...- Code from my project
    The third form does not open correctly.

There are several things we could do to sort this out:

  • Ensure that paths are always presented with backslashes on Windows. Before doing that, I wonder why there is a mix of forward- and backward-slashes though. Does that have to do with there being two methods for retrieving callstacks? Is this perhaps Unity 4.x legacy? Is it a good idea to have both?
  • Follow up on #2 and change the open-file call method to something else. Changing that has a downside in that paths outside of Assets/ will not open correctly. I'm not sure when those would appear... perhaps when using pre-built binaries / when splitting a Unity project over multiple build steps, if that is at all possible?

from uberlogger.

Kalmalyzer avatar Kalmalyzer commented on August 18, 2024

This might be related to #2 . With the current implementation, I notice that some paths open in MonoDevelop while other paths open in Visual Studio.

from uberlogger.

Kalmalyzer avatar Kalmalyzer commented on August 18, 2024

@michidk can you repro this? I know it sometimes happens but cannot repro it myself now. If you can, would you also be able to breakpoint on the line where UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal is called, and tell us what arguments are being passed to that function?

from uberlogger.

michidk avatar michidk commented on August 18, 2024

So this happens on both machines where i tested... Both of them running Unity 5.5 and having Sublime Text installed.
I noticed that Sublime Text only opens when Visual Studio is open. If Visual Studio is not running, a doubleclick always opens VS on the correct line.

Sadly after I added a Debug.Log line to print out the parameters of OpenFileAtLineExternal , it worked again.

from uberlogger.

Kalmalyzer avatar Kalmalyzer commented on August 18, 2024

Yeah, using debug.log for capturing results is "dangerous" whenever we deal with a tool that is intended to hook console logging; that is why I suggest putting a breakpoint on the line and inspecting variables in scope instead (and copy/pasting the exact results to this ticket so we have something more meaty to go on).

It should be possible to do it like this:

  1. dev normally
  2. once you notice that a file opened in the wrong editor, place a breakpoint, attach to Unity, and attempt again to open the same exact file
  3. inspect method arguments

from uberlogger.

michidk avatar michidk commented on August 18, 2024

Didn't know you can debug editor stuff. Awesome!

Here is the result:
VS

from uberlogger.

Kalmalyzer avatar Kalmalyzer commented on August 18, 2024

@bbbscarter What's the reason for having two different methods for retrieving callstacks? Is this to do with 4.x + 5.x compatibility? Do you know of specific situations where one method works better than the other?

from uberlogger.

bbbscarter avatar bbbscarter commented on August 18, 2024

One of them is for intercepting callstacks that come directly from Unity (e.g. Debug.Logxxx), the other is for intercepting callstacks from UberLogger itself (e.g. UberDebug.Logxxx). The former is slow and tries to fill in bits of missing info by parsing the already-stringified callstacks; the latter is fast and robust.

(Assuming those are the two paths you mean).

from uberlogger.

Kalmalyzer avatar Kalmalyzer commented on August 18, 2024

Hmm. It appears that the homemade stack-walk is being used for Debug.Logxxx calls as well. It is only if that walk totally fails that UberLogger falls back on parsing the Unity-provided multi-line string.

Unity does not show paths to internal code (i.e. C:\buildslave\Unity\...) and if there are multiple of these in the callstack it will collapse them (so I think you just see the "entry point").

Anyway, to the matter at hand; I think the right thing to do is to change folder separators in any paths to Assets\blah\... format on Windows before calling UnityEditorInternal.InternalEditorUtility.OpenFileAtLineExternal.

from uberlogger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.