1. These forums are still being retired! Please use GitHub discussions or Discord. You cannot create new threads or new accounts now. If you need to contact some user of the forums, you should do it sooner, rather than later. This notice was last updated on May 30th, 2021.

Tutorial General Information for non programmers. How to read errors!

Discussion in 'Guides and Tutorials' started by Olink, Dec 30, 2011.

  1. Olink

    Olink Admin note: Actually a really nice person now

    Joined:
    Jul 21, 2011
    Messages:
    1,397
    Before you read on, take note. Any time you ask a question, you may be linked back here. If you are linked back, that means your questions is likely dumb(no offense) and has been answered by the explanation provided. If you do not understand something here, please comment, and I will try to clean it up into something more understandable( tbh, some of this stuff will go over your head, but you only need to understand the gist of it ). IF you would like something explained that you may have been told was obvious by me, or another person, feel free to leave a comment or pm me. I would love to post an explanation here.



    System.MissingMethodException: Method not found: 'Void TShockAPI.TSPlayer.SetPvP(Boolean)'.
    at MoreAdminCommands.MoreAdminCommands.OnUpdate()
    at System.Action.Invoke()
    at Hooks.GameHooks.OnUpdate(Boolean pre)
    at Terraria.Main.DedServ()
    at Terraria.ProgramServer.Main(String[] args)

    System.MissingFieldException: Field not found: 'Terraria.Main.tile'.
    at MoreAdminCommands.MoreAdminCommands.OnUpdate()
    at System.Action.Invoke()
    at Hooks.GameHooks.OnUpdate(Boolean pre)
    at Terraria.Main.DedServ()
    at Terraria.ProgramServer.Main(String[] args)

    System.MissingFieldException "Terraria.Main.tile".
    ChestControl.Chest.tileIsChest<(Int32 x, int32 y>
    ChestControl.ChestControl.NetHooks_GetData<GetDataEventArgs e>


    Heres how you read a bug report.

    The first line is the error, aka

    Most times this is unhelpful( like the above ). Sure for a programmer they tell us exactly what to look for, but for an end user its jibberish. The follwoing lines are useful though.

    We call them the stack trace. It is a trace, a history, a complete detail of the error. The most recent line( top line ) is the most detailed as you go down, it gets less specified. It essentially tells you whats calling what to cause this bug.

    Let me explain to you how to quickly read a stack trace.
    The first line is the offending line. As you know the error is that a method wasn't found, you know now what method isn't found. At first you want to say that tshock caused this error, which in a way, it did. But that method is just being called, executed, done by, etc etc by something else. Lets see what that something else is:

    Look at that, so the plugin MoreAdminCommands class MoreAdminCommands OnUpdate method called this tshock method which doesn't exist. But lets be sure that there isnt more to it and another plugin invloved.

    Nope, thats the event handler for our hooks. It tells all the methods "hooked" on to hooks that the event they hooked was fired/executed.

    Now you can read a simple stack trace.

    Assuming you read this, you should have a very good idea where to post your error logs
    *cough in the plugin that caused the error thread cough*

    So, if you ever post one of those somewhere outside of the respective plugin thread that is causing the error, you will get a warning. 5 seconds looking at the error can save you hours of waiting for a reply. It also helps plugin devs know there is an issue that needs fixing.
     
    • Like Like x 3
  2. Iscar

    Iscar Level 4

    Joined:
    Sep 8, 2011
    Messages:
    99
    Thanks! It was confusing before, but im getting it now :D
     
  3. Olink

    Olink Admin note: Actually a really nice person now

    Joined:
    Jul 21, 2011
    Messages:
    1,397
    Maybe some more useful information, maybe not.

    Today, I'll try to teach you all how to read this. when you look at an error report, the format is almost always this:

    Error
    at something
    at something
    at something

    The error and the somethings were discussed above. Imagine a stack (in this case a call stack ) as a pile of things. When you add to the pile, you have to add to the top. To get to the bottom you have to remove the top. In programming, this is referred to FILO ( First in Last out, theres also FIFO ). I digress. As a program is executed, there is a stack, or list in order, of what the program has done. In the event of an error, it prints this list( stack ). In programming when B is executed by A, we refer to it as A calling B. So in a call stack we have:

    Error
    at D
    at C
    at B
    at A

    Which we can read as Initially the program executed A. A eventually executed B. B executed C. And C finally executed D which results in the error. So for looking at what caused the error, we start with the error. That tells us what happened( at least, narrows what we should be looking for ). Then we can remove that from the stack. This lets us look at D. D says

    So we know this method is what caused the error. The error is that X method didn't exist. Which means in there we called a method X that doesnt exist. Pretty simple to fix.

    But how do we know where that thing is.

    Time to explain this
    Ok. In programming, it is common practice to group things together so that similar things are in the same place. In this case, a plugin is the top level.

    We can refer to this as the package. ( A lego space ship )
    A package is made up of one or many classes that either work together or perform a similar purpose. ( A lego block )
    A class is made up of many methods. These methods are what is necessary for the program to do what it needs to do. Classes are just used to group them into one place, kinda like a tupperware container. (The plastic that goes into a lego block ).
    A method is made up of code...(dunno....plastic particles? :D )

    In the example the First instance of MoreAdminCommands is the package name. This package name usually refers to the project name. So we look into the project MoreAdminCommands. We should see a class named MoreAdminCommands. This class, MoreAdminCommands should have a method OnUpdate(). In that method we should see the offending line somewhere( SetPvP or something ). With this, you should be able to see whats causing the issue and if necessary you can avoid it by avoiding what ever causes this( assume it wasnt onUpdate() but on some method executed that spawns slimes. ). This should allow you to use buggy plugins a little given the bugs arent too big.

    So, going back:

    Stack traces, or call stacks, show you in order, what the program was doing prior to dying. The topmost line is the finest portion of the error( the lego block ). The bottom most line is the original caller( usually the server ). Each line is essentially a PackageName.ClassName.MethodName() that refers to the programs error. Hopefully this make a little sense and helps you all better understand the errors. The goal of this is to get people to be informative when creating bug posts, and save them the time of having to wait to find out that they simply were using an outdated plugin or were missing a dll. Until next time. I'm thinking of having this be a General FAQ or something, so if you have any questions about stuff Ive told you is obvious, pm me and ill post it here.
     
  4. Snirk Immington

    Snirk Immington Level 9

    Joined:
    Jan 12, 2012
    Messages:
    378
    This is more like "Crash Message Information for non programmers" not that it doesn't help :p
     
  5. Olink

    Olink Admin note: Actually a really nice person now

    Joined:
    Jul 21, 2011
    Messages:
    1,397
    I was planning on updating it weekly, and answering questions, but people would rather remain ignorant :(
     
  6. Skryter

    Skryter Level 1

    Joined:
    Jun 1, 2012
    Messages:
    13
    Thanks Olink. this Really helped me :)