Search Unity

Following errors within coroutines

Discussion in 'Editor & General Support' started by Jonathan Czeck, Jul 20, 2006.

  1. Jonathan Czeck

    Jonathan Czeck

    Joined:
    Mar 17, 2005
    Posts:
    1,713
    Is there a way to figure out what line an exception is generated in a coroutine?

    How can I decode:

    Graph+<Start>__58.MoveNext()

    Is that instruction 58, line 58, or who knows? :)

    Thank you!
    -Jon
     
  2. freyr

    freyr

    Joined:
    Apr 7, 2005
    Posts:
    1,148
    This is a bug in Mono. Currently Mono is really bad at reporting errors from coroutines.

    The reason is that when compiling, the c# compiler creates a new class for every coroutine. (Called something like OuterClass+<MethodName>__NN.)

    This class contains the code of the coroutine split up into a big switch statment and a MoveNext method for running the next segment of the coroutine and return the next yield value.

    The problem is that the relation to the original source code gets lost at some point, so it is hard to know where the error happened.
     
  3. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    One more reason to use javascript...

    You probably will be best off adding a couple of prints in c#.