Skip to content

Commit

Permalink
Fixed Ourpalm#709
Browse files Browse the repository at this point in the history
  • Loading branch information
liiir1985 committed Jul 7, 2022
1 parent 244d0fc commit e96470e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ILRuntime/Reflection/ILRuntimeType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ void InitializeProperties()
properties[i] = pi;
if (pd.GetMethod != null)
{
pi.Getter = type.GetMethod(pd.GetMethod.Name, pd.GetMethod.Parameters.Select(p => type.AppDomain.GetType(p.ParameterType, null, null)).ToList(), null) as ILMethod;
pi.Getter = type.GetMethod(pd.GetMethod.Name, pd.GetMethod.Parameters.Select(p => type.AppDomain.GetType(p.ParameterType, type, null)).ToList(), null) as ILMethod;
}
if (pd.SetMethod != null)
{
pi.Setter = type.GetMethod(pd.SetMethod.Name, pd.SetMethod.Parameters.Select(p => type.AppDomain.GetType(p.ParameterType, null, null)).ToList(), null) as ILMethod;
pi.Setter = type.GetMethod(pd.SetMethod.Name, pd.SetMethod.Parameters.Select(p => type.AppDomain.GetType(p.ParameterType, type, null)).ToList(), null) as ILMethod;
}
}
}
Expand Down
18 changes: 18 additions & 0 deletions TestCases/ReflectionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -601,5 +601,23 @@ public static void ReflectionTest22()
throw new Exception($"Field count mismatch,detail: {string.Join(",", fs.Select(f => f.Name))}");
}
}
public class HotBehaviour<T>
{
public T csObj { get; protected set; }
}

class XX : HotBehaviour<int>
{

}
public static void ReflectionTest23()
{
XX x = new XX();
var type = typeof(XX);
var value = type.GetProperty("csObj").GetValue(x);
type.GetProperty("csObj").SetValue(x, 11);
if (x.csObj != 11)
throw new Exception();
}
}
}

0 comments on commit e96470e

Please sign in to comment.