Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

结构体的构造中添加类似out List<string>的参数时,会在给此out参数赋值时报错 #757

Open
ZHOURUIH opened this issue May 4, 2023 · 0 comments

Comments

@ZHOURUIH
Copy link

ZHOURUIH commented May 4, 2023

版本:2.1.0
unity:2020.3.40f1c1

public struct test : IDisposable
{
public List a;
public test(out List b)
{
a = new List();
b = a;
}
public void Dispose() { }
}

new test(out List s);
具体报错信息为数组越界,ILInterpreter.cs:1152行.mStack[dst->Value] = mStack[val->Value];
本地测试mStack的长度为4,dst->Value为6,val->Value为3,所以访问数组下标6时会越界.
如果将struct改为class则没有此问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant