How can I resolve a VS2008 designer error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • steve

    How can I resolve a VS2008 designer error


    VS designer has started to complain about the following errors :

    Object reference not set to an instance of an object.
    Instances of this error (2)

    and

    Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
    Instances of this error (12)

    1. Hide Call Stack

    at System.Componen tModel.ReflectP ropertyDescript or.SetValue(Obj ect component, Object value)
    at System.Componen tModel.Design.S erialization.Co deDomSerializer Base.Deserializ ePropertyAssign Statement(IDesi gnerSerializati onManager
    manager, CodeAssignState ment statement, CodePropertyRef erenceExpressio n propertyReferen ceEx, Boolean reportError)
    at System.Componen tModel.Design.S erialization.Co deDomSerializer Base.Deserializ eAssignStatemen t(IDesignerSeri alizationManage r
    manager, CodeAssignState ment statement)
    at System.Componen tModel.Design.S erialization.Co deDomSerializer Base.Deserializ eStatement(IDes ignerSerializat ionManager manager,
    CodeStatement statement)




    It has been working fine for months. I haven't even changed the code in this module. And, the code runs fine when I just run the
    code.

    Any idea how to get rid of this problem would be welcome. They don't even bother to indicate what field there is a problem with or
    where the problem happened in the code - at least as far as I can see.

    Thanks,
    Steve
  • maximz2005

    #2
    Re: How can I resolve a VS2008 designer error

    Please post some of your code so we can see what's happening.
    Try to step through your code (set a breakpoint at run time and then
    press F11 to go forward). Analyze each line, and see where it gives
    the exception. That will really help find the problem.

    I don't exactly remember what the first exception means (need to get
    some sleep lol) but it'll be logical once there is some code for
    dissecting.

    Sorry, could you also explain what you mean by "And, the code runs
    fine when I just run the code. "???



    On Aug 20, 2:24 pm, steve <s_j_b...@yahoo .comwrote:
    VS designer has started to complain about the following errors :
    >
    Object reference not set to an instance of an object.
    Instances of this error (2)
    >
    and
    >
    Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
    Instances of this error (12)
    >
    1.              Hide Call Stack
    >
    at System.Componen tModel.ReflectP ropertyDescript or.SetValue(Obj ect component, Object value)
    at System.Componen tModel.Design.S erialization.Co deDomSerializer Base.Deserializ ePropertyAssign Statement(IDesi gnerSerializati onManager
    manager, CodeAssignState ment statement, CodePropertyRef erenceExpressio n propertyReferen ceEx, Boolean reportError)
    at System.Componen tModel.Design.S erialization.Co deDomSerializer Base.Deserializ eAssignStatemen t(IDesignerSeri alizationManage r
    manager, CodeAssignState ment statement)
    at System.Componen tModel.Design.S erialization.Co deDomSerializer Base.Deserializ eStatement(IDes ignerSerializat ionManager manager,
    CodeStatement statement)
    >
    It has been working fine for months. I haven't even changed the code in this module. And, the code runs fine when I just run the
    code.
    >
    Any idea how to get rid of this problem would be welcome. They don't evenbother to indicate what field there is a problem with or
    where the problem happened in the code - at least as far as I can see.
    >
    Thanks,
    Steve

    Comment

    • Michael Rubinstein

      #3
      Re: How can I resolve a VS2008 designer error

      Steve, changes made outside the IDE can 'confuse' the designer. I would try
      two things. I would comment out my initialization code and leave nothing but
      InitializeCompo nent() in the form's constructor, and rebuild. If this did
      not help, I would take a look at the .Designer.cs code and try isolating
      code that may cause the problem by commenting out sections. This requires
      understanding what the code does, so you know where to cut. Of course, I'd
      backup the file before making any changes in the IDE-generated code. I get
      Designer errors in my projects once in a while, often enough to get used to
      it.

      Michael

      "steve" <s_j_bull@yahoo .comwrote in message
      news:4f2pa49675 dogeqijt33dkmet bq397t0bv@4ax.c om...
      >
      VS designer has started to complain about the following errors :
      >
      Object reference not set to an instance of an object.
      Instances of this error (2)
      >
      and
      >
      Index was out of range. Must be non-negative and less than the size of the
      collection. Parameter name: index
      Instances of this error (12)
      >
      1. Hide Call Stack
      >
      at System.Componen tModel.ReflectP ropertyDescript or.SetValue(Obj ect
      component, Object value)
      at
      System.Componen tModel.Design.S erialization.Co deDomSerializer Base.Deserializ ePropertyAssign Statement(IDesi gnerSerializati onManager
      manager, CodeAssignState ment statement, CodePropertyRef erenceExpressio n
      propertyReferen ceEx, Boolean reportError)
      at
      System.Componen tModel.Design.S erialization.Co deDomSerializer Base.Deserializ eAssignStatemen t(IDesignerSeri alizationManage r
      manager, CodeAssignState ment statement)
      at
      System.Componen tModel.Design.S erialization.Co deDomSerializer Base.Deserializ eStatement(IDes ignerSerializat ionManager
      manager,
      CodeStatement statement)
      >
      >
      >
      >
      It has been working fine for months. I haven't even changed the code in
      this module. And, the code runs fine when I just run the
      code.
      >
      Any idea how to get rid of this problem would be welcome. They don't even
      bother to indicate what field there is a problem with or
      where the problem happened in the code - at least as far as I can see.
      >
      Thanks,
      Steve

      Comment

      • steve

        #4
        Re: How can I resolve a VS2008 designer error


        Thanks for the input.

        I eventually found the problem. The designer was instantiating some classes which had properties that didn't check for null values
        on some properties. The values would not normally have been null it was just that the designer calls the default constructor which
        doesn't get called in the normal running of the program.


        Steve

        Comment

        Working...