GithubHelp home page GithubHelp logo

ilruntimeu3d's Issues

官方的例子,继承适配器这里,获取属性的时候会报错,大哥们有遇到么

运行继承适配器例子,InheritanceAdapter 的 public override System.Int32 Value 属性方法里面会报错。

NullReferenceException: Object reference not set to an instance of an object ILRuntime.CLR.TypeSystem.CLRType.GetMethod (System.String name, System.Collections.Generic.List1[T] param, ILRuntime.CLR.TypeSystem.IType[] genericArguments, ILRuntime.CLR.TypeSystem.IType returnType, System.Boolean declaredOnly) (at Library/PackageCache/[email protected]/CLR/TypeSystem/CLRType.cs:705)
ILRuntime.Runtime.Enviorment.CrossBindingAdaptor.GetMethod (System.String name, System.Collections.Generic.List1[T] param, ILRuntime.CLR.TypeSystem.IType[] genericArguments, ILRuntime.CLR.TypeSystem.IType returnType, System.Boolean declaredOnly) (at Library/PackageCache/[email protected]/Runtime/Enviorment/CrossBindingAdaptor.cs:52) ILRuntime.Runtime.Enviorment.CrossBindingMethodInfo.EnsureMethod (ILRuntime.Runtime.Intepreter.ILTypeInstance ins) (at Library/PackageCache/[email protected]/Runtime/Enviorment/CrossBindingMethodInfo.cs:729) ILRuntime.Runtime.Enviorment.CrossBindingMethodInfo.CheckShouldInvokeBase (ILRuntime.Runtime.Intepreter.ILTypeInstance ins) (at Library/PackageCache/[email protected]/Runtime/Enviorment/CrossBindingMethodInfo.cs:699) ILRuntimeDemo.TestClassBaseAdapter+Adapter.get_Value () (at Assets/Samples/ILRuntime/1.6.3/Demo/Scripts/Examples/04_Inheritance/InheritanceAdapter.cs:70) Inheritance.OnHotFixLoaded () (at Assets/Samples/ILRuntime/1.6.3/Demo/Scripts/Examples/04_Inheritance/Inheritance.cs:117) Inheritance+<LoadHotFixAssembly>d__4.MoveNext () (at Assets/Samples/ILRuntime/1.6.3/Demo/Scripts/Examples/04_Inheritance/Inheritance.cs:92) UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) (at D:/unity/Runtime/Export/Coroutines.cs:17)

问题:ILRuntime层调用async方法时,如果方块内没有await代码块,则不会有返回,请问下这个问题如何处理?

问题:ILRuntime层调用async方法时,如果方块内没有await代码块,则不会有返回,请问下这个问题如何处理?
复现方式:
1、我们使用的是这个链接下的实例,https://github.com/Ourpalm/ILRuntimeU3D/tree/master/ILRuntimeDemo。
2、在这个实例中,我们加入了一个处理async/await的跨域适配器,该适配器代码已打包成zip。
AsyncStateMachineAdaptor.zip
3、我们在Assets/Samples/ILRuntime/2.1.0/_Scenes/Examples/01_HelloWorld的场景里的nitializeILRuntime()方法中加入跨域注册的代码:appdomain.RegisterCrossBindingAdaptor(new AsyncStateMachineAdaptor());
image
4、我们在ILRuntime的工程中的StaticFunTest()中加入逻辑代码:
public static async void StaticFunTest()
{
UnityEngine.Debug.Log("!!! InstanceClass.StaticFunTest()");
string s = await SetAsyncTest(false);
UnityEngine.Debug.Log(s);
UnityEngine.Debug.Log("!!! 111111111");
}

    public static async Task<string> SetAsyncTest(bool flag)
    { 
        if (flag == true) 
        {
            await Task.Delay(1000);
            UnityEngine.Debug.Log("测试有await");
            return "测试有awaitReturn";
        }
        else
        {
            //如果是执行这段代码,如是没有下面的await Task.Yield()代码块,则不能接收到return的返回,
            //当加入await Task.Yield()代码块后,才能正常的返回。
            //尝试使用Task.FromResult("");也不行。
            //await Task.Yield();
            UnityEngine.Debug.Log("测试没有await");
            return "测试没有awaitReturn";
        }

    }

image
5、我们获取到测试结果:
当以上方法中flag=true的时候,方法中有await Task.Delay代码块,能正常获取到返回值。
当以上方法中flag=false的时候,方法中没有await Task代码块,无法正常获取到返回,也就是说
StaticFunTest方法中的如下代码不会执行。
UnityEngine.Debug.Log(s);
UnityEngine.Debug.Log("!!! 111111111");

关于hotfix_project 编译失败

vs打开hotfit_project后,右键菜单点击生成后报错,
请问下如何编译 热更DLL的vs工程 @liiir1985

1>------ 已启动生成: 项目: HotFix_Project, 配置: Debug Any CPU ------
1>E:\cst\demo\My project\Assets\Samples\ILRuntime\2.0.2\Demo\HotFix_Project~\TestInheritance.cs(7,36,7,49): error CS0012: 类型“Object”在未引用的程序集中定义。必须添加对程序集“netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”的引用。
1>E:\cst\demo\My project\Assets\Samples\ILRuntime\2.0.2\Demo\HotFix_Project~\TestDelegate.cs(8,16,8,34): error CS0012: 类型“MulticastDelegate”在未引用的程序集中定义。必须添加对程序集“netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”的引用。
1>E:\cst\demo\My project\Assets\Samples\ILRuntime\2.0.2\Demo\HotFix_Project~\TestDelegate.cs(9,16,9,36): error CS0012: 类型“MulticastDelegate”在未引用的程序集中定义。必须添加对程序集“netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”的引用。
1>E:\cst\demo\My project\Assets\Samples\ILRuntime\2.0.2\Demo\HotFix_Project~\TestInheritance.cs(21,23,21,38): error CS0012: 类型“Object”在未引用的程序集中定义。必须添加对程序集“netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51”的引用。
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========

AppDomain.GetCurrentStackTrace在ilr工程调用有异常

class TestTraceStack
    {
        public static void RunTest()
        {
            var s = HelloWorld.appdomain.GetCurrentStackTrace();//注释掉就不会有问题
            UnityEngine.GameObject go = new UnityEngine.GameObject();
            UnityEngine.Debug.Log(go.name);//报错,提示go是一个null
        }
    }

这个测试样例,为了取到appdomain,这里把HelloWorld.appdomain改成了静态属性。

2.02提示缺少脚本

打开 Samples\ILRuntime\2.0.2\Demo\HotFix_Project~ 工程之后,报错缺少脚本 TestDelegateMethod TestDelegateFunction TestClassBase

热更工程无法调试

使用unity案例工程中的CoroutineDemo,先运行Unity再“Attack to ILRuntime”,(ps.目前有安装官方调试插件,有去掉ILRUNTIME_DEBUG_DISABLE 宏),不能调试,显示为“cannot connect to ILRuntime”。查看端口,发现56000端口不存在,尝试更改端口为50000,再次查看端口,50000端口已存在,运行unity后,“Attack to ILRuntime”后显示“ILRuntime Debugger version mismatch”

我用LitJson.JsonMapper.ToObject<T>(Dictionary<int, List<SpellObject>>) 转换数据的时候报了一下错误,请问是怎么回事呢,谢谢!

ArgumentException: The value '1' is not of type 'System.Int32' and cannot be used in this generic collection.
Parameter name: key
System.Collections.Generic.Dictionary`2[TKey,TValue].System.Collections.IDictionary.Add (System.Object key, System.Object value) (at :0)
LitJson.JsonMapper.ReadValue (System.Type inst_type, LitJson.JsonReader reader) (at Assets/ILKit/Code/BDFramework/github/LitJson/JsonMapper.cs:501)
LitJson.JsonMapper.ToObject[T] (System.String json) (at Assets/ILKit/Code/BDFramework/github/LitJson/JsonMapper.cs:931)
SerializeTool.FromJson[T] (System.String json) (at Assets/StudyPlay/ScriptsIL/Tool/SerializeTool.cs:25)
FBPolyhoneLevelDataControl.InitTxtData () (at Assets/StudyPlay/ScriptsIL/Database/Data/FBPolyhoneLevelDataControl.cs:26)
DataControlMgr.FnDataControlAttributeInit () (at Assets/StudyPlay/ScriptsIL/Database/DataControlMgr.cs:76)
DataControlMgr..ctor () (at Assets/StudyPlay/ScriptsIL/Database/DataControlMgr.cs:25)
Eagle.FnInit () (at Assets/StudyPlay/ScriptsIL/Tool/Eagle.cs:27)
GameLogic.Awake () (at Assets/StudyPlay/ScriptsIL/Manager/GameLogic.cs:67)

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.