Author Topic: Exception has been thrown by the target of an invocation.  (Read 4594 times)

thelebaron

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 15
    • View Profile
Exception has been thrown by the target of an invocation.
« on: February 23, 2014, 02:36:26 AM »
Not really sure why Im getting it but Im currently getting this error in the log constantly but the autosync still works(albeit it looks jumpy).

Exception has been thrown by the target of an invocation.
TNAutoSync.OnSync (UnityEngine.Quaternion, UnityEngine.Vector3)
UnityEngine.Debug:LogError(Object)
TNet.UnityTools:PrintException(Exception, CachedFunc, Object[]) (at Assets/TNet/Client/TNUnityTools.cs:83)
TNet.UnityTools:ExecuteAll(List`1, Byte, Object[]) (at Assets/TNet/Client/TNUnityTools.cs:162)
TNObject:Execute(Byte, Object[]) (at Assets/TNet/Client/TNObject.cs:310)
TNObject:FindAndExecute(UInt32, Byte, Object[]) (at Assets/TNet/Client/TNObject.cs:334)
TNManager:OnForwardedPacket(BinaryReader) (at Assets/TNet/Client/TNManager.cs:826)
TNet.GameClient:ProcessPacket(Buffer, IPEndPoint) (at Assets/TNet/Client/TNGameClient.cs:684)
TNet.GameClient:ProcessPackets() (at Assets/TNet/Client/TNGameClient.cs:627)
TNManager:Update() (at Assets/TNet/Client/TNManager.cs:834)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Exception has been thrown by the target of an invocation.
« Reply #1 on: February 23, 2014, 12:58:44 PM »
Happens when it executes some function, but that function crashes due to a null exception or something like that. If TNAutoSync is all you're doing then double-check what it's synchronizing. Something isn't set properly.

RFCsDriveMeNuts

  • Newbie
  • *
  • Thank You
  • -Given: 3
  • -Receive: 0
  • Posts: 12
    • View Profile
Re: Exception has been thrown by the target of an invocation.
« Reply #2 on: February 23, 2014, 01:07:08 PM »
I'd recommend making Tash's exception logger print out the inner exception.  I made a quick change to track down one of these bugs just a few minutes ago. 

Go to TNUnityTools's PrintException function, and print out the inner exception, if there is one.  You can use the StackTrace property on the exception to get the line numbers too.

My not-so-pretty-but-works Exception dumper:

  1.        
  2.         public static string FullDump(Exception exception, bool stacktrace)
  3.         {
  4.             string ret = "";
  5.             string tab = "";
  6.  
  7.             Exception current = exception;
  8.             while (current != null && ret.Length < 10000000)
  9.             {
  10.                 ret += tab + current.Message + "\r\n";
  11.                 if (stacktrace)
  12.                 {
  13.                     if (current.StackTrace != null)
  14.                     {
  15.                         string[] lines = current.StackTrace.Split('\n');
  16.                         foreach (string l in lines)
  17.                         {
  18.                             ret += tab + l + "\r\n";
  19.                         }
  20.                         ret += "\r\n";
  21.                     }
  22.                 }
  23.                 tab += "   ";
  24.  
  25.                 current = current.InnerException;
  26.             }
  27.  
  28.             return ret;
  29.         }
  30.  

thelebaron

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 15
    • View Profile
Re: Exception has been thrown by the target of an invocation.
« Reply #3 on: February 23, 2014, 02:07:04 PM »
thanks guys   8)