Initial Commit
This commit is contained in:
parent
53eb92e9af
commit
270ab7d11f
15341 changed files with 700234 additions and 0 deletions
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace UnityEngine.UI.Tests.Utils
|
||||
{
|
||||
class ExceptionUtils
|
||||
{
|
||||
public static void PreserveStackTrace(Exception e)
|
||||
{
|
||||
var ctx = new StreamingContext(StreamingContextStates.CrossAppDomain);
|
||||
var mgr = new ObjectManager(null, ctx);
|
||||
var si = new SerializationInfo(e.GetType(), new FormatterConverter());
|
||||
|
||||
e.GetObjectData(si, ctx);
|
||||
mgr.RegisterObject(e, 1, si); // prepare for SetObjectData
|
||||
mgr.DoFixups(); // ObjectManager calls SetObjectData
|
||||
|
||||
// voila, e is unmodified save for _remoteStackTraceString
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue