DataView.get_Item throws a NullReferenceException

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

    DataView.get_Item throws a NullReferenceException

    What could cause a stack trace like this?

    Message:Object reference not set to an instance of an object.
    Stack Trace:

    at System.Data.Dat aView.GetRecord (Int32 recordIndex)
    at System.Data.Dat aView.get_RowVi ewCache()
    at System.Data.Dat aView.GetElemen t(Int32 index)
    at System.Data.Dat aView.get_Item( Int32 recordIndex)
    at myCode.myMethod

    --
    Jonathan Allen



  • Wessel Troost

    #2
    Re: DataView.get_It em throws a NullReferenceEx ception

    > What could cause a stack trace like this?[color=blue]
    >[/color]
    Impossible to tell without more information. Perhaps you could post the
    relevant part of myCode.myMethod ?

    Greetings,
    Wessel

    Comment

    • Nigel Norris

      #3
      Re: DataView.get_It em throws a NullReferenceEx ception

      Well, at one level it's an ADO.NET bug - the DataView indexer should return
      either a valid DataRowView, or throw an IndexOutOfRange Exception. Instead
      it's crashed somwhere in setting up the DataView's row cache.

      The question is, what have you done to upset it so?

      Is the problem reproducible - can you you trap the exception in the
      debugger?

      Did the failure occur on first use for the view, or later?

      How was the DataView and underlying table configured? Was anything
      interesting changed (like filters, schema, ...) after initially loading the
      table?

      ---
      Nigel Norris


      "Jonathan Allen" <x@x.x> wrote in message
      news:O7DEm$%23j FHA.3256@TK2MSF TNGP12.phx.gbl. ..[color=blue]
      > What could cause a stack trace like this?
      >
      > Message:Object reference not set to an instance of an object.
      > Stack Trace:
      >
      > at System.Data.Dat aView.GetRecord (Int32 recordIndex)
      > at System.Data.Dat aView.get_RowVi ewCache()
      > at System.Data.Dat aView.GetElemen t(Int32 index)
      > at System.Data.Dat aView.get_Item( Int32 recordIndex)
      > at myCode.myMethod
      >
      > --
      > Jonathan Allen
      >
      >
      >[/color]


      Comment

      • Jonathan Allen

        #4
        Re: DataView.get_It em throws a NullReferenceEx ception

        > The question is, what have you done to upset it so?

        I have no idea. I was hoping to start with a list of "What could have caused
        this?", and then work backwards. It is one of those server error log things
        that are difficult to track down without knowing the cause. And the code is
        way too complex to know where to start.
        [color=blue]
        > Is the problem reproducible - can you you trap the exception in the
        > debugger?[/color]

        Nope. It is happening (rarely) on our server farm. I think I am just going
        to have to right this one off as a mystery.

        --
        Jonathan Allen


        "Nigel Norris" <nospam@nospam. com> wrote in message
        news:uN8Z7fQkFH A.708@TK2MSFTNG P09.phx.gbl...[color=blue]
        > Well, at one level it's an ADO.NET bug - the DataView indexer should
        > return either a valid DataRowView, or throw an IndexOutOfRange Exception.
        > Instead it's crashed somwhere in setting up the DataView's row cache.
        >
        > The question is, what have you done to upset it so?
        >
        > Is the problem reproducible - can you you trap the exception in the
        > debugger?
        >
        > Did the failure occur on first use for the view, or later?
        >
        > How was the DataView and underlying table configured? Was anything
        > interesting changed (like filters, schema, ...) after initially loading
        > the table?
        >
        > ---
        > Nigel Norris
        >
        >
        > "Jonathan Allen" <x@x.x> wrote in message
        > news:O7DEm$%23j FHA.3256@TK2MSF TNGP12.phx.gbl. ..[color=green]
        >> What could cause a stack trace like this?
        >>
        >> Message:Object reference not set to an instance of an object.
        >> Stack Trace:
        >>
        >> at System.Data.Dat aView.GetRecord (Int32 recordIndex)
        >> at System.Data.Dat aView.get_RowVi ewCache()
        >> at System.Data.Dat aView.GetElemen t(Int32 index)
        >> at System.Data.Dat aView.get_Item( Int32 recordIndex)
        >> at myCode.myMethod
        >>
        >> --
        >> Jonathan Allen
        >>
        >>
        >>[/color]
        >
        >[/color]


        Comment

        Working...