开发者

specific argument was out of range of valid value parameter name : index

Error : specific argument was out of range of valid value parameter name : index

This error message occurred every 2min in desi开发者_运维问答gn time!!

what should i do?


The designer executes code from controls on the design surface at design time. This error is probably coming from code in one of your UserControls, or possibly a buggy third party control.

Things you can do to help prevent code being executed at Design Time:

  • Avoid putting such code in the constructor of your UserControl.

  • Use if (this.DesignMode) to conditionally suppress the code at design-time. It's common to do this in the OnLoad method.

  • Mark properties in your usercontrol that should not be evaluated at design-time with appropriate attributes, e.g.:

    [
    Browsable(false),
    DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)
    ]
    public MyType MyRuntimeOnlyProperty
    {
        ...
    }
    

If all else fails, you can start a second instance of Visual Studio, and attach its debugger to your instance that's running the Designer. Then break on the appropriate exception.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜