Object Reference not set to an instance of an object

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

    Object Reference not set to an instance of an object

    I am getting "Object reference not set to an instance of an object. " when I
    attempt to open a C# windows service class in design view, although I was
    able to initially create the service and open in design view. This happens
    once I restarted Visual Studio adn opened teh solution

    Any ideas on how to fix this would be appreciated..

    BR
    ::Ben
  • Chris, Master of All Things Insignificant

    #2
    Re: Object Reference not set to an instance of an object

    Do you see the object that it is complaining about.

    Dim C as ClassA
    C.SomeProperty = 12345 <--- Error: Object reference not set to an instance
    of an object.

    Dim C as New ClassA
    C.SomeProperty = 12345 <--- Happy!

    So find out what object it is complaining about and assign it an instance of
    the object.

    Hope this helps
    Chris

    "NewToDotNe t" <NewToDotNet@di scussions.micro soft.com> wrote in message
    news:3786403A-A522-4D2B-9FE7-F3A67A6FA8C8@mi crosoft.com...[color=blue]
    >I am getting "Object reference not set to an instance of an object. " when
    >I
    > attempt to open a C# windows service class in design view, although I was
    > able to initially create the service and open in design view. This happens
    > once I restarted Visual Studio adn opened teh solution
    >
    > Any ideas on how to fix this would be appreciated..
    >
    > BR
    > ::Ben[/color]


    Comment

    • NewToDotNet

      #3
      Re: Object Reference not set to an instance of an object

      Chris

      It does not show me the object;
      ------------start of error
      One or more errors encountered while loading the designer.The errors are
      listed below. Some errors can be fixed by rebuilding your project, while
      others may require code changes. Clicking on each error will take you to the
      line of code that caused it.

      Object reference not set to an instance of an object.

      Hide
      Edit


      at
      Microsoft.Visua lStudio.Design. Toolbox.AutoToo lboxManagerServ ice.AddToolboxI tem(IVsHierarch y
      hierarchy, String typeName, Type loadedType, String category, String
      referencePath, ToolboxItemFilt erAttribute projectFilter,
      ToolboxItemFilt erAttribute itemFilter)
      at
      Microsoft.Visua lStudio.Design. Toolbox.Project AutoToolboxMana ger.UpdateToolb oxItems(Boolean updateRefs, Boolean updateBuild)
      at
      Microsoft.Visua lStudio.Design. Toolbox.Project AutoToolboxMana ger..ctor(AutoT oolboxManagerSe rvice
      ownerService, IServiceProvide r provider, IVsHierarchy hierarchy, Boolean&
      keepMe)
      at
      Microsoft.Visua lStudio.Design. Toolbox.AutoToo lboxManagerServ ice.GetAutoTool boxManager(Obje ct vsHierarchy)
      at
      Microsoft.Visua lStudio.Design. Toolbox.AutoToo lboxManagerServ ice.GetAutoTool boxManagerFromH ost(IDesignerHo st host)
      at
      Microsoft.Visua lStudio.Design. Toolbox.AutoToo lboxManagerServ ice.OnDesignerL oadComplete(Obj ect sender, EventArgs e)
      at System.EventHan dler.Invoke(Obj ect sender, EventArgs e)
      at System.Componen tModel.Design.D esignerHost.OnL oadComplete(Eve ntArgs e)
      at
      System.Componen tModel.Design.D esignerHost.Sys tem.ComponentMo del.Design.Seri alization.IDesi gnerLoaderHost. EndLoad(String
      rootClassName, Boolean successful, ICollection errorCollection )
      at
      System.Componen tModel.Design.S erialization.Ba sicDesignerLoad er.OnEndLoad(Bo olean successful, ICollection errors)
      at
      System.Componen tModel.Design.S erialization.Co deDomDesignerLo ader.OnEndLoad( Boolean successful, ICollection errors)
      at
      System.Componen tModel.Design.S erialization.Ba sicDesignerLoad er.System.Compo nentModel.Desig n.Serialization .IDesignerLoade rService.Depend entLoadComplete (Boolean successful, ICollection errorCollection )
      at
      System.Componen tModel.Design.S erialization.Ba sicDesignerLoad er.BeginLoad(ID esignerLoaderHo st host)
      at System.Componen tModel.Design.D esignerHost.Beg inLoad(Designer Loader loader)
      ---end of error message---


      "Chris, Master of All Things Insignifican" wrote:
      [color=blue]
      > Do you see the object that it is complaining about.
      >
      > Dim C as ClassA
      > C.SomeProperty = 12345 <--- Error: Object reference not set to an instance
      > of an object.
      >
      > Dim C as New ClassA
      > C.SomeProperty = 12345 <--- Happy!
      >
      > So find out what object it is complaining about and assign it an instance of
      > the object.
      >
      > Hope this helps
      > Chris
      >
      > "NewToDotNe t" <NewToDotNet@di scussions.micro soft.com> wrote in message
      > news:3786403A-A522-4D2B-9FE7-F3A67A6FA8C8@mi crosoft.com...[color=green]
      > >I am getting "Object reference not set to an instance of an object. " when
      > >I
      > > attempt to open a C# windows service class in design view, although I was
      > > able to initially create the service and open in design view. This happens
      > > once I restarted Visual Studio adn opened teh solution
      > >
      > > Any ideas on how to fix this would be appreciated..
      > >
      > > BR
      > > ::Ben[/color]
      >
      >
      >[/color]

      Comment

      • Chris, Master of All Things Insignificant

        #4
        Re: Object Reference not set to an instance of an object

        Have you modified any code in the section that is usually commented out by
        the Windows Designer. I haven't played much with windows services so I
        don't remember what the template looks like, but what this is telling you is
        that a change was made where the designer usually plays.

        Sorry I can't be more helpful.
        Chris


        "NewToDotNe t" <NewToDotNet@di scussions.micro soft.com> wrote in message
        news:9ECB2CC8-268F-4939-B97E-86F5CB5ACF2E@mi crosoft.com...[color=blue]
        > Chris
        >
        > It does not show me the object;
        > ------------start of error
        > One or more errors encountered while loading the designer.The errors are
        > listed below. Some errors can be fixed by rebuilding your project, while
        > others may require code changes. Clicking on each error will take you to
        > the
        > line of code that caused it.
        >
        > Object reference not set to an instance of an object.
        >
        > Hide
        > Edit
        >
        >
        > at
        > Microsoft.Visua lStudio.Design. Toolbox.AutoToo lboxManagerServ ice.AddToolboxI tem(IVsHierarch y
        > hierarchy, String typeName, Type loadedType, String category, String
        > referencePath, ToolboxItemFilt erAttribute projectFilter,
        > ToolboxItemFilt erAttribute itemFilter)
        > at
        > Microsoft.Visua lStudio.Design. Toolbox.Project AutoToolboxMana ger.UpdateToolb oxItems(Boolean
        > updateRefs, Boolean updateBuild)
        > at
        > Microsoft.Visua lStudio.Design. Toolbox.Project AutoToolboxMana ger..ctor(AutoT oolboxManagerSe rvice
        > ownerService, IServiceProvide r provider, IVsHierarchy hierarchy, Boolean&
        > keepMe)
        > at
        > Microsoft.Visua lStudio.Design. Toolbox.AutoToo lboxManagerServ ice.GetAutoTool boxManager(Obje ct
        > vsHierarchy)
        > at
        > Microsoft.Visua lStudio.Design. Toolbox.AutoToo lboxManagerServ ice.GetAutoTool boxManagerFromH ost(IDesignerHo st
        > host)
        > at
        > Microsoft.Visua lStudio.Design. Toolbox.AutoToo lboxManagerServ ice.OnDesignerL oadComplete(Obj ect
        > sender, EventArgs e)
        > at System.EventHan dler.Invoke(Obj ect sender, EventArgs e)
        > at System.Componen tModel.Design.D esignerHost.OnL oadComplete(Eve ntArgs e)
        > at
        > System.Componen tModel.Design.D esignerHost.Sys tem.ComponentMo del.Design.Seri alization.IDesi gnerLoaderHost. EndLoad(String
        > rootClassName, Boolean successful, ICollection errorCollection )
        > at
        > System.Componen tModel.Design.S erialization.Ba sicDesignerLoad er.OnEndLoad(Bo olean
        > successful, ICollection errors)
        > at
        > System.Componen tModel.Design.S erialization.Co deDomDesignerLo ader.OnEndLoad( Boolean
        > successful, ICollection errors)
        > at
        > System.Componen tModel.Design.S erialization.Ba sicDesignerLoad er.System.Compo nentModel.Desig n.Serialization .IDesignerLoade rService.Depend entLoadComplete (Boolean
        > successful, ICollection errorCollection )
        > at
        > System.Componen tModel.Design.S erialization.Ba sicDesignerLoad er.BeginLoad(ID esignerLoaderHo st
        > host)
        > at System.Componen tModel.Design.D esignerHost.Beg inLoad(Designer Loader
        > loader)
        > ---end of error message---
        >
        >
        > "Chris, Master of All Things Insignifican" wrote:
        >[color=green]
        >> Do you see the object that it is complaining about.
        >>
        >> Dim C as ClassA
        >> C.SomeProperty = 12345 <--- Error: Object reference not set to an
        >> instance
        >> of an object.
        >>
        >> Dim C as New ClassA
        >> C.SomeProperty = 12345 <--- Happy!
        >>
        >> So find out what object it is complaining about and assign it an instance
        >> of
        >> the object.
        >>
        >> Hope this helps
        >> Chris
        >>
        >> "NewToDotNe t" <NewToDotNet@di scussions.micro soft.com> wrote in message
        >> news:3786403A-A522-4D2B-9FE7-F3A67A6FA8C8@mi crosoft.com...[color=darkred]
        >> >I am getting "Object reference not set to an instance of an object. "
        >> >when
        >> >I
        >> > attempt to open a C# windows service class in design view, although I
        >> > was
        >> > able to initially create the service and open in design view. This
        >> > happens
        >> > once I restarted Visual Studio adn opened teh solution
        >> >
        >> > Any ideas on how to fix this would be appreciated..
        >> >
        >> > BR
        >> > ::Ben[/color]
        >>
        >>
        >>[/color][/color]


        Comment

        • NewToDotNet

          #5
          Re: Object Reference not set to an instance of an object

          Chris

          Thanks for loking into this..I really do appreciate the effort.

          As far as I know I have not made any changes to the designer code..

          Ben

          "Chris, Master of All Things Insignifican" wrote:
          [color=blue]
          > Have you modified any code in the section that is usually commented out by
          > the Windows Designer. I haven't played much with windows services so I
          > don't remember what the template looks like, but what this is telling you is
          > that a change was made where the designer usually plays.
          >
          > Sorry I can't be more helpful.
          > Chris
          >
          >
          > "NewToDotNe t" <NewToDotNet@di scussions.micro soft.com> wrote in message
          > news:9ECB2CC8-268F-4939-B97E-86F5CB5ACF2E@mi crosoft.com...[color=green]
          > > Chris
          > >
          > > It does not show me the object;
          > > ------------start of error
          > > One or more errors encountered while loading the designer.The errors are
          > > listed below. Some errors can be fixed by rebuilding your project, while
          > > others may require code changes. Clicking on each error will take you to
          > > the
          > > line of code that caused it.
          > >
          > > Object reference not set to an instance of an object.
          > >
          > > Hide
          > > Edit
          > >
          > >
          > > at
          > > Microsoft.Visua lStudio.Design. Toolbox.AutoToo lboxManagerServ ice.AddToolboxI tem(IVsHierarch y
          > > hierarchy, String typeName, Type loadedType, String category, String
          > > referencePath, ToolboxItemFilt erAttribute projectFilter,
          > > ToolboxItemFilt erAttribute itemFilter)
          > > at
          > > Microsoft.Visua lStudio.Design. Toolbox.Project AutoToolboxMana ger.UpdateToolb oxItems(Boolean
          > > updateRefs, Boolean updateBuild)
          > > at
          > > Microsoft.Visua lStudio.Design. Toolbox.Project AutoToolboxMana ger..ctor(AutoT oolboxManagerSe rvice
          > > ownerService, IServiceProvide r provider, IVsHierarchy hierarchy, Boolean&
          > > keepMe)
          > > at
          > > Microsoft.Visua lStudio.Design. Toolbox.AutoToo lboxManagerServ ice.GetAutoTool boxManager(Obje ct
          > > vsHierarchy)
          > > at
          > > Microsoft.Visua lStudio.Design. Toolbox.AutoToo lboxManagerServ ice.GetAutoTool boxManagerFromH ost(IDesignerHo st
          > > host)
          > > at
          > > Microsoft.Visua lStudio.Design. Toolbox.AutoToo lboxManagerServ ice.OnDesignerL oadComplete(Obj ect
          > > sender, EventArgs e)
          > > at System.EventHan dler.Invoke(Obj ect sender, EventArgs e)
          > > at System.Componen tModel.Design.D esignerHost.OnL oadComplete(Eve ntArgs e)
          > > at
          > > System.Componen tModel.Design.D esignerHost.Sys tem.ComponentMo del.Design.Seri alization.IDesi gnerLoaderHost. EndLoad(String
          > > rootClassName, Boolean successful, ICollection errorCollection )
          > > at
          > > System.Componen tModel.Design.S erialization.Ba sicDesignerLoad er.OnEndLoad(Bo olean
          > > successful, ICollection errors)
          > > at
          > > System.Componen tModel.Design.S erialization.Co deDomDesignerLo ader.OnEndLoad( Boolean
          > > successful, ICollection errors)
          > > at
          > > System.Componen tModel.Design.S erialization.Ba sicDesignerLoad er.System.Compo nentModel.Desig n.Serialization .IDesignerLoade rService.Depend entLoadComplete (Boolean
          > > successful, ICollection errorCollection )
          > > at
          > > System.Componen tModel.Design.S erialization.Ba sicDesignerLoad er.BeginLoad(ID esignerLoaderHo st
          > > host)
          > > at System.Componen tModel.Design.D esignerHost.Beg inLoad(Designer Loader
          > > loader)
          > > ---end of error message---
          > >
          > >
          > > "Chris, Master of All Things Insignifican" wrote:
          > >[color=darkred]
          > >> Do you see the object that it is complaining about.
          > >>
          > >> Dim C as ClassA
          > >> C.SomeProperty = 12345 <--- Error: Object reference not set to an
          > >> instance
          > >> of an object.
          > >>
          > >> Dim C as New ClassA
          > >> C.SomeProperty = 12345 <--- Happy!
          > >>
          > >> So find out what object it is complaining about and assign it an instance
          > >> of
          > >> the object.
          > >>
          > >> Hope this helps
          > >> Chris
          > >>
          > >> "NewToDotNe t" <NewToDotNet@di scussions.micro soft.com> wrote in message
          > >> news:3786403A-A522-4D2B-9FE7-F3A67A6FA8C8@mi crosoft.com...
          > >> >I am getting "Object reference not set to an instance of an object. "
          > >> >when
          > >> >I
          > >> > attempt to open a C# windows service class in design view, although I
          > >> > was
          > >> > able to initially create the service and open in design view. This
          > >> > happens
          > >> > once I restarted Visual Studio adn opened teh solution
          > >> >
          > >> > Any ideas on how to fix this would be appreciated..
          > >> >
          > >> > BR
          > >> > ::Ben
          > >>
          > >>
          > >>[/color][/color]
          >
          >
          >[/color]

          Comment

          • susan.entwisle@eds.com

            #6
            Re: Object Reference not set to an instance of an object


            NewToDotNet wrote:[color=blue]
            > I am getting "Object reference not set to an instance of an object. "[/color]
            when I[color=blue]
            > attempt to open a C# windows service class in design view, although I[/color]
            was[color=blue]
            > able to initially create the service and open in design view. This[/color]
            happens[color=blue]
            > once I restarted Visual Studio adn opened teh solution
            >
            > Any ideas on how to fix this would be appreciated..
            >
            > BR
            > ::Ben[/color]

            Comment

            • Andrew

              #7
              Re: Object Reference not set to an instance of an object

              I am experiencing the exact same thing with the Dec 2004 beta release.
              Any resolution to this yet?

              susan.entwisle@ eds.com wrote:[color=blue]
              > NewToDotNet wrote:[color=green]
              > > I am getting "Object reference not set to an instance of an object.[/color][/color]
              "[color=blue]
              > when I[color=green]
              > > attempt to open a C# windows service class in design view, although[/color][/color]
              I[color=blue]
              > was[color=green]
              > > able to initially create the service and open in design view. This[/color]
              > happens[color=green]
              > > once I restarted Visual Studio adn opened teh solution
              > >
              > > Any ideas on how to fix this would be appreciated..
              > >
              > > BR
              > > ::Ben[/color][/color]

              Comment

              Working...