You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
A clear and concise description of what the bug is.
泛型函数中使用值为null的成员变量对out参数赋值之后,再次对out参数赋值会导致解析器越界异常
To Reproduce
Steps to reproduce the behavior:
请描述重现步骤或上下文
class TestClass
{
public TestClass()
{
t = s++;
}
public int t;
static int s = 1;
}
//如果TestClass2也会有一样的异常
class TestClass2
{
public TestClass2()
{
p = null;
//非null就不会有问题
//p = new TestClass();
}
public bool TryGetObject(out T res) where T : TestClass, new()
{
//用局部变量中转没问题
//var tmp = p as T;
//res = null;
//res = tmp;
//这一句现在没什么用(比如用来if判断)但没有这一句不会报错。
res = p as T;
res = new T();//这里解析器越界异常
//res = p as T;//这样也会解析器越界异常
UnityEngine.Debug.Log("!!! new T");
return true;
}
TestClass p;
}
Expected behavior
A clear and concise description of what you expected to happen.
正常执行返回
Unity Version
Please fill in the version of Unity you're currently using
2020.3.33
ILRuntime Version
Please fill in the version of ILRuntime you're currently using(package version or git commit hash or repository download date)
最新
The text was updated successfully, but these errors were encountered:
Describe the bug
A clear and concise description of what the bug is.
泛型函数中使用值为null的成员变量对out参数赋值之后,再次对out参数赋值会导致解析器越界异常
To Reproduce
Steps to reproduce the behavior:
请描述重现步骤或上下文
class TestClass
{
public TestClass()
{
t = s++;
}
public int t;
static int s = 1;
}
//如果TestClass2也会有一样的异常
class TestClass2
{
public TestClass2()
{
p = null;
//非null就不会有问题
//p = new TestClass();
}
public bool TryGetObject(out T res) where T : TestClass, new()
{
//用局部变量中转没问题
//var tmp = p as T;
//res = null;
//res = tmp;
//这一句现在没什么用(比如用来if判断)但没有这一句不会报错。
res = p as T;
res = new T();//这里解析器越界异常
//res = p as T;//这样也会解析器越界异常
UnityEngine.Debug.Log("!!! new T");
return true;
}
TestClass p;
}
Expected behavior
A clear and concise description of what you expected to happen.
正常执行返回
Unity Version
Please fill in the version of Unity you're currently using
2020.3.33
ILRuntime Version
Please fill in the version of ILRuntime you're currently using(package version or git commit hash or repository download date)
最新
The text was updated successfully, but these errors were encountered: