Giter Site home page Giter Site logo

配置文件的Bug about x HOT 3 CLOSED

newlifex avatar newlifex commented on May 6, 2024
配置文件的Bug

from x.

Comments (3)

nnhy avatar nnhy commented on May 6, 2024

写成单元测试,提交PR进来,我找不到合适的单元测试用例

from x.

e4ky avatar e4ky commented on May 6, 2024

支持String[] 有问题

    [DisplayName("看门狗配置")]
    [Config("Watch")]
    class Settings : Config<Settings>
    {
        /// <summary>看护的程序完整路径及名称</summary>
        [Description("看护的程序完整路径及名称")]
        public String WatchProgramFullName { get; set; } = "";


        /// <summary>第二组开始的程序启动间隔时间(毫秒)</summary>
        [Description("第二组开始的程序启动间隔时间(毫秒)")]
        public int StartSecondProgramWaitTime { get; set; } = 1000;


        /// <summary>看护的程序名称(不包含后缀)</summary>
        [Description("第二组看护的程序名称列表(不包含后缀)")]
        public String[] SecondWatchProgramFullNames { get; set; } = { "" };
    }

报错信息

21:13:58.253 4 Y - System.Exception: 创建对象失败 type=System.String parameters= 没有为该对象定义无参数的构造函数。 ---> System.MissingMethodException: 没有为该对象定义无参数的构造函数。
在 System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck)
在 System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark)
在 System.Activator.CreateInstance(Type type, Boolean nonPublic)
在 NewLife.Reflection.DefaultReflect.CreateInstance(Type type, Object[] parameters) 位置 D:\X\Src\NewLife.Core\Reflection\IReflect.cs:行号 412
--- 内部异常堆栈跟踪的结尾 ---
在 NewLife.Reflection.DefaultReflect.CreateInstance(Type type, Object[] parameters) 位置 D:\X\Src\NewLife.Core\Reflection\IReflect.cs:行号 419
在 NewLife.Configuration.ConfigProvider.MapArray(IConfigSection section, Object model, PropertyInfo pi) 位置 D:\X\Src\NewLife.Core\Configuration\IConfigProvider.cs:行号 272
在 NewLife.Configuration.ConfigProvider.MapTo(IConfigSection section, Object model) 位置 D:\X\Src\NewLife.Core\Configuration\IConfigProvider.cs:行号 233
在 NewLife.Configuration.FileConfigProvider.Watch_Changed(Object sender, FileSystemEventArgs e) 位置 D:\X\Src\NewLife.Core\Configuration\FileConfigProvider.cs:行号 181

from x.

nnhy avatar nnhy commented on May 6, 2024

问题已修正,单元测试通过

Json/Xml配置文件支持字符串数组,单元测试覆盖通过
32e0342

from x.

Related Issues (20)

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.