Tasharen Entertainment Forum

Support => TNet 3 Support => Topic started by: thelebaron on February 23, 2014, 02:36:26 AM

Title: Exception has been thrown by the target of an invocation.
Post by: thelebaron 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)
Title: Re: Exception has been thrown by the target of an invocation.
Post by: ArenMook 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.
Title: Re: Exception has been thrown by the target of an invocation.
Post by: RFCsDriveMeNuts 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.  
Title: Re: Exception has been thrown by the target of an invocation.
Post by: thelebaron on February 23, 2014, 02:07:04 PM
thanks guys   8)