mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-16 22:27:45 +08:00
Fix exception state being "sticky"
This commit is contained in:
parent
4af86e0e25
commit
62fa7f30f3
@ -96,23 +96,6 @@ namespace UnityExplorer.CacheObject
|
|||||||
|
|
||||||
// Updating and applying values
|
// Updating and applying values
|
||||||
|
|
||||||
public void SetUserValue(object value)
|
|
||||||
{
|
|
||||||
value = value.TryCast(FallbackType);
|
|
||||||
|
|
||||||
TrySetUserValue(value);
|
|
||||||
|
|
||||||
if (CellView != null)
|
|
||||||
SetDataToCell(CellView);
|
|
||||||
|
|
||||||
// If the owner's ParentCacheObject is set, we are setting the value of an inspected struct.
|
|
||||||
// Set the inspector target as the value back to that parent.
|
|
||||||
if (Owner.ParentCacheObject != null)
|
|
||||||
Owner.ParentCacheObject.SetUserValue(Owner.Target);
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void TrySetUserValue(object value);
|
|
||||||
|
|
||||||
// The only method which sets the CacheObjectBase.Value
|
// The only method which sets the CacheObjectBase.Value
|
||||||
public virtual void SetValueFromSource(object value)
|
public virtual void SetValueFromSource(object value)
|
||||||
{
|
{
|
||||||
@ -132,6 +115,23 @@ namespace UnityExplorer.CacheObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetUserValue(object value)
|
||||||
|
{
|
||||||
|
value = value.TryCast(FallbackType);
|
||||||
|
|
||||||
|
TrySetUserValue(value);
|
||||||
|
|
||||||
|
if (CellView != null)
|
||||||
|
SetDataToCell(CellView);
|
||||||
|
|
||||||
|
// If the owner's ParentCacheObject is set, we are setting the value of an inspected struct.
|
||||||
|
// Set the inspector target as the value back to that parent.
|
||||||
|
if (Owner.ParentCacheObject != null)
|
||||||
|
Owner.ParentCacheObject.SetUserValue(Owner.Target);
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract void TrySetUserValue(object value);
|
||||||
|
|
||||||
protected virtual void ProcessOnEvaluate()
|
protected virtual void ProcessOnEvaluate()
|
||||||
{
|
{
|
||||||
var prevState = State;
|
var prevState = State;
|
||||||
@ -171,7 +171,7 @@ namespace UnityExplorer.CacheObject
|
|||||||
|
|
||||||
public ValueState GetStateForType(Type type)
|
public ValueState GetStateForType(Type type)
|
||||||
{
|
{
|
||||||
if (LastValueType == type)
|
if (LastValueType == type && (State != ValueState.Exception || LastException != null))
|
||||||
return State;
|
return State;
|
||||||
|
|
||||||
LastValueType = type;
|
LastValueType = type;
|
||||||
|
@ -28,7 +28,23 @@ namespace UnityExplorer.Tests
|
|||||||
|
|
||||||
public static object LiterallyAnything = null;
|
public static object LiterallyAnything = null;
|
||||||
|
|
||||||
public static string Exception => throw new Exception("This is a test.");
|
public static string Exception
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!shouldThrow)
|
||||||
|
{
|
||||||
|
shouldThrow = true;
|
||||||
|
throw new Exception("This is a test.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
shouldThrow = false;
|
||||||
|
return "No exception";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
static bool shouldThrow;
|
||||||
|
|
||||||
// Test enumerables
|
// Test enumerables
|
||||||
public static int[,,] MultiDimensionalArray = new int[45, 45, 45];
|
public static int[,,] MultiDimensionalArray = new int[45, 45, 45];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user