Git Product home page Git Product logo

ilruntime's People

Contributors

aghci avatar clayzx avatar dayfox5317 avatar endures avatar frl1317 avatar gfodor avatar jinqi166 avatar jiogao avatar kamyker avatar kkvskkkk avatar kumokyaku avatar liaoqiang-t4f avatar liiir1985 avatar linchenrr avatar litefeel avatar liyingsong99 avatar luffy1314 avatar luyikk avatar m1stm4o avatar minamiyama avatar mybios avatar newbiegamecoder avatar oyji1992 avatar qiulirui avatar superkaka avatar takararei avatar tyrant39001 avatar wlzs04 avatar xiezhizhao avatar ymh199478 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ilruntime's Issues

脚本继承c#类,导致的脚本中的方法多执行一次

如果我 ILRTClass继承了 c#Class,并且在test()函数里执行力base.xxx() 那么,我在c#里通过 app.invoke(instance, "test")来调用这个方法的时候, test里面的代码就会执行两次。因为一次是我invoke调用的,一次貌似是adapter中转的时候调用的

c#
//#if ILRT
[ILRuntime.Other.NeedAdaptor]
//#endif

public class HKSpriteModel
{
    public string ModelName;

    public virtual void InitModel()
    {
        this.LogMessageInfo("parent init");
    }
}

ILRT
public class HKMonsterSpriteModel : HKSpriteModel
{
public int index = 0;
public override void InitModel()
{
base.InitModel();
Debug.Log("sub init");
index++;
}

    public void test()
    {
        InitModel();
        this.LogMessageInfo("index = " + index + this.ModelName);
    }

}

c#中调用部分
app.invoke(instance, "InitModel", null)

结果:
会输出两次 "sub init"
并且 index = 2 了

Json有多个Dictionary时类型处理不正确

测试代码如下:

class MyTest1
{
	public static void UnitTest_JsonMap()
	{
		string json = "{\"Items1\":{\"one\":{\"Type\":1},\"two\":{\"Type\":2}},\"Items2\":{\"one\":{\"Type\":\"OneType\"},\"two\":{\"Type\":\"TwoType\"}}}";
		MyTestDataMap data =JsonMapper.ToObject<MyTestDataMap> (json);
		Console.WriteLine("Type : " + data.Items1["one"].Type);
		Console.WriteLine("Type : " + data.Items2["one"].Type);
	}
}

class MyTestDataItem1 // : TestClass3
{
	public int Type;
}

class MyTestDataItem2 // : TestClass3
{
	public string Type;
}

class MyTestDataMap //: TestClass3
{
	public Dictionary<string, MyTestDataItem1> Items1;
	public Dictionary<string, MyTestDataItem2> Items2;
}

在AddObjectMetadata()的时候,Items1和Items2的类型没有区分开来,当处理Items2的时候,ElementType用的还是MyTestDataItem1,因此会报错:
Can't assign value 'OneType' (type System.String) to type Type: Int32

i found a bug

i have a class like this:
public static class Check
{
public static void Test(T value)
{
if (value == null) ;
}
}
And the i invoke like this:Check.Test(new byte[] {1,2}); it will crash

T issue

`public class B
{
public int aa = 2;
public virtual void Print()
{
Debug.Log("I am B"); ;
}
}

public class Class1
{
	public static void ParseDB<T>(System.Action<T> cbk) where T : B, new()
	{
		
	}
	public static string Test()
	{
		ParseDB<B>((d) =>
		{

		});

		return "xxxx1";
	}

}`

对象数组引用传递的问题

当一个对象数组,在使用out参数传递时会出错,测试代码如下:

	public static void UnitTest_Out2()
	{
		Dictionary<string, TestClassC[]> data = new Dictionary<string, TestClassC[]>();
		data["key"] = new TestClassC[0];
		TestClassC[] item;
		data.TryGetValue("key", out item);
		Console.WriteLine("value : " + item);
	}

	class TestClassC
	{
	}

生成绑定代码的时候没有处理静态构造方法

BindingCodeGenerator.cs
Line:307
CrawlAppdomain()方法里

                foreach (var i in ((CLR.TypeSystem.ILType)type).GetConstructors())
                    methods.Add(i);

这里并没有包含StaticConstructor。
这样可能会导致一些在静态构造方法里创建的泛型类的构造方法不会生成到绑定代码中,导致在il2cpp下出错。

Dictionary中处理数组的问题

Dictionary中加出数组会报错,代码:

	public static Dictionary<string, MyData[]> data = new Dictionary<string, MyData[]>();

	public static void UnitTest_Test1()
	{
		data["test"] = new MyData[5];
	}

错误信息:

Test:TestCases.MyTest.UnitTest_Test1
TestResult:False
Log:
类型“ILRuntime.Runtime.Intepreter.ILTypeInstance[]”的对象无法转换为类型“ILRuntime.Runtime.Intepreter.ILTypeInstance”。
Local Variables:

IL_0011: callvirt System.Void System.Collections.Generic.Dictionary`2<System.String,TestCases.MyData[]>::set_Item(!0,!1)
at TestCases.MyTest.UnitTest_Test1() D:\lib\ILRuntime\TestCases\MyTest.cs:Line 14

System.ArgumentException: 类型“ILRuntime.Runtime.Intepreter.ILTypeInstance[]”的对象无法转换为类型“ILRuntime.Runtime.Intepreter.ILTypeInstance”。
在 System.RuntimeType.CheckValue(Object value, Binder binder, CultureInfo culture, BindingFlags invokeAttr)
在 System.Reflection.MethodBase.CheckArguments(Object[] parameters, Binder binder, BindingFlags invokeAttr, CultureInfo culture, Signature sig)
在 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
在 System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
在 System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
在 ILRuntime.CLR.Method.CLRMethod.Invoke(ILIntepreter intepreter, StackObject* esp, List`1 mStack, Boolean isNewObj) 位置 D:\lib\ILRuntime\ILRuntime\CLR\Method\CLRMethod.cs:行号 271
在 ILRuntime.Runtime.Intepreter.ILIntepreter.Execute(ILMethod method, StackObject* esp, Boolean& unhandledException) 位置 D:\lib\ILRuntime\ILRuntime\Runtime\Intepreter\ILIntepreter.cs:行号 1729

=======================

在Unity端无法取到Hotfix端中父类的方法。

    public class TClass3<T> where T : class
    {
        public void Test()
        {
            Debug.LogError("TClass3 test..");
        }
    }

    public class Class3 : TClass3<Class3>
    {
    } 

// not work
var rObj = __app.Instantiate("WindHotfix.Test.Class3");
__app.Invoke("WindHotfix.Test.Class3", "Test", rObj);
    public class TClass3<T> where T : class
    {
        public virtual void Test()
        {
            Debug.LogError("TClass3 test..");
        }
    }

    public class Class3 : TClass3<Class3>
    {
		public override void Test()
		{
			base.Test();
		}
    }

// work
var rObj = __app.Instantiate("WindHotfix.Test.Class3");
__app.Invoke("WindHotfix.Test.Class3", "Test", rObj);

我这边很多地方有不重载父类方法的需求。

char类型转换成字符串的问题

发现char类型在转换成字符串的时候,同样的代码生成的IL会有差异(但都是vs2015,原因还不清楚)
第一种:
IL_00f2: ldloca.s c
IL_00f4: call instance string [mscorlib]System.Char::ToString()
IL_00f9: call string [mscorlib]System.String::Concat(string, string)
第二种:
IL_00e6: ldloca.s c
IL_00e8: constrained. [mscorlib]System.Char
IL_00ee: callvirt instance string [mscorlib]System.Object::ToString()
IL_00f3: call string [mscorlib]System.String::Concat(string, string)

第一种执行的结果正常,第二种字符转换成字符串后会变成数字。

GetClassName()不同类型生成名称重复

下面两种不同的类型,用此方法生成的名称是一样的:

		typeof(Dictionary<string, ILTypeInstance>).GetClassName(out className, out realClassName, out isByRef);
		Console.WriteLine(className);
		typeof(Dictionary<string, ILTypeInstance[]>).GetClassName(out className, out realClassName, out isByRef);
		Console.WriteLine(className);

都是:
System_Collections_Generic_Dictionary_2_String_ILTypeInstance_Binding

Json处理时,有使用了Adaptor的类时会出错

测试用例如下:

class MyTest1
{
	public static void UnitTest_Test1()
	{
		string json = "[{\"Name\":\"MyName\"}]";
		List<MyTestDataA> data = JsonMapper.ToObject<List<MyTestDataA>>(json);
		Console.WriteLine("Name : "+data[0].Name);
	}
}

class MyTestDataA  : TestClass3
{
	public string Name;
}

TestClass3即现有用例中的ILRuntimeTest.TestFramework.TestClass3。

out issue

	static bool TryGet(out A a)
	{
		a = null;
		return true;
	}

	public static string Test()
	{
		A aaa;
		TryGet(out aaa);
           }

ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
System.Collections.Generic.List`1[System.Object].get_Item (Int32 index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/List.cs:633)
ILRuntime.Runtime.Intepreter.ILIntepreter.Execute (ILRuntime.CLR.Method.ILMethod method, ILRuntime.Runtime.Stack.StackObject* esp, System.Boolean& unhandledException) (at Assets/ILRT/ILRuntime/Runtime/Intepreter/ILIntepreter.cs:807)
Rethrow as ILRuntimeException: Argument is out of range.
Parameter name: index
IL_0002: stind.ref
Game.DSimpleTown.TryInSoldierLst(Int32 soldierId, DSoldier& dSoldier) Code/Data/Player/DSimpleTown.cs:Line 75

字典获取Enumerator转换成基类接口报错

public class DictionaryEnumeratorTest<TKey, TValue>
{
Dictionary<TKey, TValue> dic = new Dictionary<TKey, TValue>();
public void Add(TKey key, TValue value)
{
dic.Add(key, value);
}

    public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
    {
        return dic.GetEnumerator();    //报错
    }

    public void GetEnumeratorTest()
    {
        var e = dic.GetEnumerator();   //正常
        while (e.MoveNext())
        {
            UnityEngine.Debug.Log(e.Current.Key + "  " + e.Current.Value);
        }
    }

    public void GetEnumeratorTest2()
    {
        IEnumerator<KeyValuePair<TKey, TValue>> e = dic.GetEnumerator();   //报错
        while (e.MoveNext())
        {
            UnityEngine.Debug.Log(e.Current.Key + "  " + e.Current.Value);
        }
    }
}

public class MyTest
{
    public static void Test()
    {
        DictionaryEnumeratorTest<int, int> t = new DictionaryEnumeratorTest<int, int>();
        t.Add(1, 1);
        t.GetEnumeratorTest();
        t.GetEnumeratorTest2();
        var e = t.GetEnumerator();
        while (e.MoveNext())
        {
            UnityEngine.Debug.Log(e.Current.Key + "  " + e.Current.Value);
        }
    }
}

Struct array element assignment issue.

    struct MyStruct
    {
        public int i;
    }

    public void Awake()
    {
        var m = new MyStruct[10];
        m[0] = new MyStruct();   // `Throw exception here.`
    }

Exception info:

NotImplementedException: The requested feature is not implemented.
ILRuntime.Runtime.Intepreter.ILIntepreter.Execute (ILRuntime.CLR.Method.ILMethod method, ILRuntime.Runtime.Stack.StackObject* esp, System.Boolean& unhandledException) (at Assets/Plugins/ILRuntime/ILRuntime/Runtime/Intepreter/ILIntepreter.cs:2860)
Rethrow as ILRuntimeException: The requested feature is not implemented.
IL_000f: initobj TestILR/MyStruct
TestILR.Awake() c:/Working/p21/devel/client/P21/Assets/Scripts/_Test/TestILR.cs:Line 18

Litjson bool Type Error.

public class TJ
{
    public bool b = true;
}


public class TestJson
{                 
    public void Start()
    {
        Debug.Log("TestJson1");
        var tj = new TJ();
        var json = JsonMapper.ToJson(tj);
        Debug.Log(json); //output: {"b":1} Error

        var outTj = JsonMapper.ToObject<TJ>(json); //Error Point!
        Debug.Log(outTj.b);
    }
}

Serialization has a problem. This is the bool type. The program returns a int type to me.

JsonException: Can't assign value '1' (type System.Int32) to type System.Boolean
LitJson.JsonMapper.ReadValue (System.Type inst_type, LitJson.JsonReader reader) (at Assets/Standard Assets/RunTime/LitJson/JsonMapper.cs:401)
LitJson.JsonMapper.ReadValue (System.Type inst_type, LitJson.JsonReader reader) (at Assets/Standard Assets/RunTime/LitJson/JsonMapper.cs:469)
LitJson.JsonMapper.JsonToObject (ILRuntime.Runtime.Intepreter.ILIntepreter intp, ILRuntime.Runtime.Stack.StackObject* esp, System.Collections.Generic.List`1 mStack, ILRuntime.CLR.Method.CLRMethod method, Boolean isNewObj) (at Assets/Standard Assets/RunTime/LitJson/JsonMapper.cs:1009)
ILRuntime.Runtime.Intepreter.ILIntepreter.Execute (ILRuntime.CLR.Method.ILMethod method, ILRuntime.Runtime.Stack.StackObject* esp, System.Boolean& unhandledException) (at Assets/Standard Assets/RunTime/ILRuntime/ILRuntime/Runtime/Intepreter/ILIntepreter.cs:1718)
Rethrow as ILRuntimeException: Can't assign value '1' (type System.Int32) to type System.Boolean
IL_001f: call !!0 LitJson.JsonMapper::ToObject<TJ>(System.String)
TestJson.Start()
GameMain.Start(GameObject gameObject)

use default(T) crash

public static class Check
{
public static void Test(T value)
{
if (default(T) == null) ;
}
}
Check.Test(1);

Delegate Null CallBack

///Unity Class
public class ResourceBase
{

}
public abstract class AssetBundleLoader
{

}

public class AssetBundleLoader<T> : AssetBundleLoader
{
    public Action<T> OnLoadOver;

    public void LoadOver(T o)
    {
        if (OnLoadOver != null)
        {
            OnLoadOver(o);
        }
    }
}

///Dll Test
public static void TestDelegateNull()
{
Console.WriteLine("TestDelegateNull ");
AssetBundleLoader gg=new AssetBundleLoader();
gg.OnLoadOver = OnLoadOver;
gg.LoadOver(null);
Console.WriteLine("TestDelegateNull end ");
}

    public static void OnLoadOver(ResourceBase rb)
    {
        Console.WriteLine("OnLoadOver");
    }

T issue

	public static void Swap<T>(T[] arr, int idx1, int idx2)
	{
		if (idx1 >= arr.Length || idx2 >= arr.Length) return;
		T temp = arr[idx1];
		arr[idx1] = arr[idx2];
		arr[idx2] = temp;
	}


	public static string Test()
	{
		Swap(new int[] { 1, 2 }, 0, 1);

}

NotImplementedException: The requested feature is not implemented.
ILRuntime.CLR.TypeSystem.ILGenericParameterType.MakeArrayType () (at Assets/ILRT/ILRuntime/CLR/TypeSystem/ILGenericParameterType.cs:113)
ILRuntime.CLR.Method.ILMethod.InitParameters () (at Assets/ILRT/ILRuntime/CLR/Method/ILMethod.cs:500)
ILRuntime.CLR.Method.ILMethod.get_Parameters () (at Assets/ILRT/ILRuntime/CLR/Method/ILMethod.cs:198)

栈溢出

使用CLR绑定string后,最导致栈溢出错误(在IL2CPP模式下)

Array Null Check

public static void TestArrayNull()
{
Console.WriteLine("TestArrayNull");
byte[] b = null;
if (b != null && b.Length > 0)
{

        }
        Console.WriteLine("TestArrayNullEnd ");

}

AppDomain.GetType()方法中对一些类型没有缓存

测试代码(脚本):

    public static Dictionary<string, int> p3 = new Dictionary<string, int>();
    ... ...
            p3["1"] = 1;
            p3["2"] = 2;
            p3["3"] = 3;
            p3["4"] = 4;
            p3["5"] = 5;
            p3["6"] = 6;
            p3["7"] = 7;
            p3["8"] = 8;
            p3["9"] = 9;
            p3["10"] = 10;
            p3["11"] = 11;
            p3["12"] = 12;
        ... ...
        string key;
        Dictionary<string, int>.Enumerator enumerator = p3.GetEnumerator();
        while (enumerator.MoveNext())
        {
            key = enumerator.Current.Key;
        }

发现如下类型因为没有被缓存到mapType中,每次调用AppDomain.GetType()都会重新生成一次:

       System.Collections.Generic.KeyValuePair`2[[System.String, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089

There is a issue of ldfld

error:
Rethrow as ILRuntimeException: Object reference not set to an instance of an object
IL_0045: ldfld UnityEngine.Object AssetsData::assetsData

error line:
if (ad.assetsData == null)

code:
AssetsData ad = apm.GetAssetByAssetName(iconName, eAssetsType.Texture);

    if (ad == null)
    {
        DebugLoger.LogError("PlayBGMSound 失败 没有加载到对应的资源" + iconName);
        return;
    }


    if (ad.assetsData == null)
    {
        DebugLoger.Log("Loger ad.assetsData null");
        return;
    }

Delegate remove bug

//Delegate Remove Order cause different result
static Action OnShowMessage;
static void AddDelegate()
{
OnShowMessage += show1;
OnShowMessage += show2;
OnShowMessage += show3;
OnShowMessage += show4;

    }

    static void ExcuteDelegate()
    {
        if (OnShowMessage != null)
        {
            OnShowMessage("Excute");
        }
    }

    static void WrongRemoveDelegate()
    {
        //移除顺序
        OnShowMessage -= show1;
        OnShowMessage -= show3;          
        OnShowMessage -= show4;
        OnShowMessage -= show2;

    }

    public static void TestWrongAddRemoveDelegate()
    {
        AddDelegate();//
        ExcuteDelegate();// Excute1 Excute2 Excute3 Excute4
        WrongRemoveDelegate();
        Console.WriteLine("WrongExcute Check");
        ExcuteDelegate();// Error Result Excute1
    }

    public static void TestRightAddRemoveDelegate()
    {
        AddDelegate();//
        ExcuteDelegate();// Excute1 Excute2 Excute3 Excute4
        RightRemoveDelegate();
        Console.WriteLine("RightExcute Check");
        ExcuteDelegate();// Right Result 
    }


    static void RightRemoveDelegate()
    {
        //Remove  4 3 2 1
        OnShowMessage -= show4;
        OnShowMessage -= show3;
        OnShowMessage -= show2;
        OnShowMessage -= show1;
    }


    static void show1(string mes)
    {
        Console.WriteLine(mes+" 1");
    }
    static void show2(string mes)
    {
        Console.WriteLine(mes + " 2");
    }
    static void show3(string mes)
    {
        Console.WriteLine(mes + " 3");
    }
    static void show4(string mes)
    {
        Console.WriteLine(mes + " 4");
    }

注册委托的问题

请问这个appDomain.DelegateManager.RegisterMethodDelegate<int, float>();委托的注册可以放到热更的DLL中么。
从泛型函数的角度来讲,原理上应该是不可以的啊。但是我测试了下,好像也没什么问题。所以想了解下这个是否真的可以。谢谢

不支持proto中的RepeatedField<int>类型

遇到包含RepeatedField<int>类型的proto类就报如下错误:
MyExpception.HandleException, e:The method or operation is not implemented.
Local Variables:
T v0 = null

IL_0009: box T
at Google.Protobuf.FieldCodec`1<System.Int32>..cctor() D:\GameLogic\Plugins\Google.Protobuf\FieldCodec.cs:Line 351

Type的Equals()比较结果不正确

测试用例如下:

	public static void UnitTest_Type()
	{
		if(typeof(MyTestDataItem1).Equals(typeof(MyTestDataItem2)))
		{
			Console.WriteLine("MyTestDataItem1 == MyTestDataItem2");
		}
		else
		{
			Console.WriteLine("MyTestDataItem1 != MyTestDataItem2");
		}
	}
}

class MyTestDataItem1
{
	public int Type;
}

class MyTestDataItem2
{
	public string Type;
}

两个不同的类,Type比较的结果是一样的。

Can support P/Invoke?

My unity project will use the third party plug-in(NoesisGUI), the plug-in used the C++ DLL , and the plug-in C# part of the use of P/Invoke.
My class needs to be registered to the plug-in, or plug-ins need to be registered by reflection of my class.
My class needs to execute in Runner IL, so I think the only way is to run the plugin in Runner IL.

Do you have any other ideas?

Json : Object和Dictionary中对使用了Adaptor的类的处理

测试用例如下:

class MyTest1
{
	public static void UnitTest_JsonMap()
	{
		string json = "{\"Items\":{\"one\":{\"Type\":\"OneType\"},\"two\":{\"Type\":\"TwoType\"}}}";
		MyTestDataMap data =JsonMapper.ToObject<MyTestDataMap> (json);
		Console.WriteLine("Type : "+data.Items["one"].Type);
	}
}

class MyTestDataItem : TestClass3
{
	public string Type;
}

class MyTestDataMap : TestClass3
{
	public Dictionary<string, MyTestDataItem> Items;
}

string.Format Error

public static void TestStringFormat()
{
Console.WriteLine("TestStringFormat");
var ts = string.Format("{0}{1}{2}{3}",1,"gfgf",-3,4);
Console.WriteLine(ts);
Console.WriteLine("TestStringFormat End");
}

v is Int32 无法运行

if(v is Int32) //这里报错
{
return true;
}

if (v.GetType() == typeof(Int32)) //改写成这样就可以了
{
return true;
}

default struct value in method Error

public struct TestStruct
{
    public int id;

    public override string ToString()
    {
        return id.ToString();
    }
}

public static void TestMethodDefaultStructValue()
{
    PrintValue(100);
}

public static void PrintValue(int a, TestStruct b = default(TestStruct))
{
    Console.WriteLine("a = " + a + ", b = " + b.ToString());
}

string format throw exception

hi:
i write following code in the dll:

float a = 1.0f;
float b = a/2;
var str = string.Format("{0:0.000}", b);

run with exception:

NotImplementedException: The requested feature is not implemented.
ILRuntime.Runtime.Intepreter.ILIntepreter.Execute (ILRuntime.CLR.Method.ILMethod method, ILRuntime.Runtime.Stack.StackObject* esp, System.Boolean& unhandledException) (at Assets/ILRuntime/ILRuntime/Runtime/Intepreter/ILIntepreter.cs:2135)
Rethrow as ILRuntimeException: The requested feature is not implemented.
IL_0012: box System.Single
HotFix_Project.InstanceClass.TestError() I:/New_Project/unity_lua_benchmark/HotFix-Project/InstanceClass.cs:Line 39

but following code works fine:

float a = 1.0f;
var str = string.Format("{0:0.000}", a);

it's maybe a boxing issue?

枚举类型值IL和本地行为不一致

定义一个枚举类型在本地代码里
enum TestEnum
{
One,
Two
}

在热更代码里定义
var testEnum = TestEnum.Two;

Debug.Log($"{testEnum} : {testEnum.ToString()}")
输出的是"Two : 1"

在本地代码中得到的结果是"Two : Two"

在此种用法中热更代码里和本地代码里的结果行为不一致

测试用例:
`
using System;
using LitJson;

namespace TestCases
{
public class EnumTest
{
public enum TestEnum : long
{
Enum1,
Enum2,
Enum4 = 0x123456789,
}

    public static void Test11()
    {
        //热更内定义的枚举
        var testEnum = TestEnum.Enum4;
        var valueDirectly = $"{testEnum}";
        var valueToString = testEnum.ToString();

        Console.WriteLine($"隐式字符值: {valueDirectly}");
        Console.WriteLine($"显式字符值: {valueToString}");
        if (valueDirectly.Equals(valueToString) == false)
        {
            throw new Exception($"字符值不一致: {valueDirectly} vs. {valueToString}");
        }

        //本地定义的枚举
        var jsonType = JsonType.Int;
        valueDirectly = $"{jsonType}";
        valueToString = jsonType.ToString();

        Console.WriteLine($"隐式字符值: {valueDirectly}");
        Console.WriteLine($"显式字符值: {valueToString}");
        if (valueDirectly.Equals(valueToString) == false)
        {
            throw new Exception($"字符值不一致: {valueDirectly} vs. {valueToString}");
        }
    }
}

}

`

NuGet package

Awesome project, congratulation!

But, it should be really easier to integrate ILRuntime to any solution from NuGet.

I would use a Cake script, with a .nuspec for automating release process.

Vectro3? 类型返回值的问题

C#:
public Vector3? Test()
{
return null;
}

ILRT:
var v3 = XXXX.Instance.Test();
if (null != v3)
{
logger.LogMessageInfo("v3 = ", v3.Value);
}

这样在判断非空那一行就会报错

delegate bug

public static class Check
{
public static void Test2(T obj)
{
Action action = (value) => { };
}
}
Check.Test2(1); it will crash

GetClassName()无法处理Enumerator类型

测试代码:

typeof(Dictionary<string, ILTypeInstance>.Enumerator).GetClassName(out className, out realClassName, out isByRef);

会产生循环调用。此错误会影响到为Enumerator生成方法绑定。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.