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

Unity2021 tolua生成的System_Int32Wrap文件存在编译错误 #244

Open
chessbeta opened this issue Nov 25, 2021 · 5 comments
Open

Unity2021 tolua生成的System_Int32Wrap文件存在编译错误 #244

chessbeta opened this issue Nov 25, 2021 · 5 comments

Comments

@chessbeta
Copy link

chessbeta commented Nov 25, 2021

Generate.zip
Unity版本2021.2.3f1
由于Unity2021版本中升级了mscorlib.dll的api版本
System.Int32中新增了如
public static Int32 Parse(ReadOnlySpan[char] s, NumberStyles style = NumberStyles.Integer, IFormatProvider provider = null);这样的重载方法,该重载方法的参数ReadOnlySpan[char]会导致生成wrap文件出现编译错误,具体表现为:
System.Span arg0 = StackTraits<System.Span[char]>.Check(L, 2); Span不能用作StackTraits的类型参数。
其他如System.DateTime和System.TimeSpan生成的wrap文件存在同样的问题。

@OneaXiaoBaiCai
Copy link

大佬,请问你有解决这个问题吗

@HonkerForce
Copy link

@topameng +1,求助

@loutian
Copy link

loutian commented Jun 15, 2023

大佬,问下现在有解决这个问题吗?

@MingLQing
Copy link

在ToLuaExpor的IsObsolete中加一段代码,忽略掉带有Span<>和ReadOnlySpan<>的方法

if (mb is MethodBase method)
{
    ParameterInfo[] parameters = method.GetParameters();
    foreach (ParameterInfo parameter in parameters)
    {
        Type parameterType = parameter.ParameterType;
        if (parameterType.IsGenericType)
        {
            Type genericTypeDefinition = parameterType.GetGenericTypeDefinition();
            if (genericTypeDefinition == typeof(System.Span<>) || genericTypeDefinition == typeof(System.ReadOnlySpan<>))
                return true;
        }
    }
}

@HonkerForce
Copy link

HonkerForce commented Jun 19, 2024 via email

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

5 participants