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

release dll会出现的问题 #29

Closed
tinygridlock opened this issue Apr 15, 2022 · 1 comment
Closed

release dll会出现的问题 #29

tinygridlock opened this issue Apr 15, 2022 · 1 comment

Comments

@tinygridlock
Copy link

using System;
using System.Collections.Generic;
using UnityEngine;

public class App
{
public static int Main()
{
Test3();
Test4();
Test6();
Test7();
return 0;
}

public static void Test3()
{
    Debug.LogError("Test3");
    //release会崩 debug不崩
    var a1 = new A1();
    a1.Test<string>((a) => { });
    a1.Test<string>((a) => { });
}

public class A1
{
    public void Test<T>(Action<T> callback)
    {
        callback?.Invoke(default);
    }
}

public static void Test4()
{
    Debug.LogError("Test4");
    //release会崩 debug不崩
    var b = new B2();
    b.Dict = new Dictionary<string, string>();
    b.Dict.Add("123", "123");
    b.Dict["123"] = "456";
    Debug.LogError(b.Dict["123"]);
}

public class B2
{
    public Dictionary<string, string> Dict { get; set; }
}

public static void Test6()
{
    Debug.LogError("Test6");
    //release下输出错误
    var a = new[] {1, 2, 3};
    Debug.LogError(a[0]);
    Swap1(a, 0, 1);
    Debug.LogError(a[0]); //release输出1 debug输出2
    Swap2(a, 0, 2);
    Debug.LogError(a[0]); //release输出1 debug输出3
}

public static void Swap1(int[] arr, int idx1, int idx2)
{
    var temp = arr[idx1];
    arr[idx1] = arr[idx2];
    arr[idx2] = temp;
}

public static void Swap2<T>(T[] arr, int idx1, int idx2)
{
    var temp = arr[idx1];
    arr[idx1] = arr[idx2];
    arr[idx2] = temp;
}

public static void Test7()
{
    Debug.LogError("Test7");
    //release下输出错误
    var aa = new[,]
    {
        {1, 2, 3},
        {4, 5, 6}
    };
    Debug.LogError(aa[0, 0]);
    Debug.LogError(aa[0, 1]);
    Debug.LogError(aa[0, 2]);
    Debug.LogError(aa[1, 0]);
    Debug.LogError(aa[1, 1]);
    Debug.LogError(aa[1, 2]);
}

}

release下编译出的dll
附上dll的压缩包
HotFix.zip

@pirunxi
Copy link
Contributor

pirunxi commented Apr 15, 2022

确认bug。已修复提交。 dup指令的bug引起。

@pirunxi pirunxi closed this as completed Apr 15, 2022
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

2 participants