美文网首页
ILRuntime坑之自定义Attribute 参数不支持枚举

ILRuntime坑之自定义Attribute 参数不支持枚举

作者: 大其心宏其量扩其识 | 来源:发表于2023-11-17 21:31 被阅读0次

ILRuntime.Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly : 'Assembly-Charp, Version=0.0.0.0,Culture=nuetral,PublicKeyToken=null'
主工程定义了这个Attribute

public enum InfoType{
  Log,
  Error,
}

public class InfoAttribute
{
   readonly string Name;
   readonly InfoType Type;
    public InfoAttribute(string name, InfoType type){
         Name = name;
         Type = type;
   }
}

Hotfix里用了这个Attribute

var type = domain.GetType("com.test.TestInfo");
var obj = type.ReflectionType.GetCustomAttribute(typeof(InfoAttribute));
Debug.LogError(obj);
//结果 obj == null

断点查找后发现

namespace ILRuntime.Reflection
{
    static class Extensions
    {
        public static object CreateInstance(this CustomAttribute attribute, IType at, Runtime.Enviorment.AppDomain appdomain)
        // ........
      //attribute.HasConstructorArguments  在vs里报AssemblyResolutionException
  }
}

应该是ILRuntime不支持内部解析报错了
把InfoType 换成int类型就好了
目前不知道怎么支持
坑了一天时间

相关文章

  • Proxy

    Proxy 对象用于定义基本操作的自定义行为(如属性查找,赋值,枚举,函数调用等)。 语法 参数 target 用...

  • 枚举--java24(02/17/2016)

    如何自定义枚举类如何使用enum定义枚举类、枚举类的主要方法实现接口的枚举类 JDK1.5之前需要自定义枚举类JD...

  • 8.枚举和注解

    一、枚举 枚举的二种实现方式: 自定义类实现枚举 使用 enum 关键字实现枚举 自定义类实现枚举: 不需要提供s...

  • attributes和property同步问题

    attribute property是什么? 什么是attribute?html标签的预定义和自定义属性我们统称为...

  • Swift 自定义Protocol、enum

    自定义protocol 自定义枚举

  • 位移枚举

    位移枚举和普通枚举的区别位移枚举可以传递多个参数,普通的枚举只能传递单个参数 举个?在SDWebimage里有的地...

  • taro使用中的问题

    一. 多端踩过的那些技术坑 名称问题描述解决方案备注不支持自定义字体大小H5不支持字体换行taro 弹窗组件问题...

  • ET ILRuntime

    ET ILRuntime 官网:http://ourpalm.github.io/ILRuntime/public...

  • 2020-11-04

    21.Attribute //attribute操作属性的方式:语义化更强 //自定义属性:不会被浏览器解析,一...

  • NFS attribute cache

    参数指定 mount时候可以提供参数ac或者noac设置attribute cache参数。具体含义参考 Linu...

网友评论

      本文标题:ILRuntime坑之自定义Attribute 参数不支持枚举

      本文链接:https://www.haomeiwen.com/subject/vwruwdtx.html