Strange Exception with WebMethod

Discussion in 'ASP .Net' started by Kevin Spencer, Oct 25, 2004.

  1. Hi All,

    I'm experienceing a new and strange problem with a WebMethod I am working
    on. It creates an instance of a class which contains a number of fields,
    Collections, and classes, all of which are serializable (I'm pretty sure).
    It compiles fine, and when I run it, I can step through all of the code I
    wrote without exception, but it returns the following message:

    "There was an error generating the XML document. --> index is outside the
    bounds of this Collection"

    Anyone have a clue as to where to find the answer to this? I haven't been
    able to Google a thing.

    --
    Thanks,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    I get paid good money to
    solve puzzles for a living
     
    Kevin Spencer, Oct 25, 2004
    #1
    1. Advertising

  2. Does this error happen only through code or does it happen if you hit the
    ASMX through an application like Web Service Studio (or the local test
    page)? If it only happens in code, The place to look would be the
    reference.vb file.

    You don't have to use the generated classes in the reference.vb, you can
    erase them and add whatever imports are neccesary to make it use your
    original classes. This might be a good troubleshooting step.



    "Kevin Spencer" <> wrote in
    news:#:

    > Hi All,
    >
    > I'm experienceing a new and strange problem with a WebMethod I am
    > working on. It creates an instance of a class which contains a number
    > of fields, Collections, and classes, all of which are serializable
    > (I'm pretty sure). It compiles fine, and when I run it, I can step
    > through all of the code I wrote without exception, but it returns the
    > following message:
    >
    > "There was an error generating the XML document. --> index is outside
    > the bounds of this Collection"
    >
    > Anyone have a clue as to where to find the answer to this? I haven't
    > been able to Google a thing.
    >
     
    cbDevelopment, Oct 28, 2004
    #2
    1. Advertising

  3. Thanks,

    I figured it out. There actually WAS an exception occurring, which was being
    trapped. When I stepped through the code, I stepped over the method call
    that raised the exception. Fortunately, I was also logging exceptions, so
    when I went into the log I found the exception and the source of it.

    --
    HTH,
    Kevin Spencer
    ..Net Developer
    Microsoft MVP
    I get paid good money to
    solve puzzles for a living

    "cbDevelopment" <development@remove.700cb.net> wrote in message
    news:Xns958FD359943E9cbDevelopment@207.46.248.16...
    > Does this error happen only through code or does it happen if you hit the
    > ASMX through an application like Web Service Studio (or the local test
    > page)? If it only happens in code, The place to look would be the
    > reference.vb file.
    >
    > You don't have to use the generated classes in the reference.vb, you can
    > erase them and add whatever imports are neccesary to make it use your
    > original classes. This might be a good troubleshooting step.
    >
    >
    >
    > "Kevin Spencer" <> wrote in
    > news:#:
    >
    > > Hi All,
    > >
    > > I'm experienceing a new and strange problem with a WebMethod I am
    > > working on. It creates an instance of a class which contains a number
    > > of fields, Collections, and classes, all of which are serializable
    > > (I'm pretty sure). It compiles fine, and when I run it, I can step
    > > through all of the code I wrote without exception, but it returns the
    > > following message:
    > >
    > > "There was an error generating the XML document. --> index is outside
    > > the bounds of this Collection"
    > >
    > > Anyone have a clue as to where to find the answer to this? I haven't
    > > been able to Google a thing.
    > >

    >
     
    Kevin Spencer, Oct 28, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Temp
    Replies:
    1
    Views:
    1,105
    Natty Gur
    Aug 11, 2003
  2. sunnyz
    Replies:
    1
    Views:
    2,972
    Kevin Spencer
    Oct 15, 2004
  3. Tobias Lekman

    Returning Enumeration or Exception from WebMethod?

    Tobias Lekman, Aug 9, 2003, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    166
    Marina
    Aug 11, 2003
  4. Matt
    Replies:
    1
    Views:
    156
  5. Matt Bush

    Serializing custom exception through a webmethod call.

    Matt Bush, Nov 9, 2004, in forum: ASP .Net Web Services
    Replies:
    1
    Views:
    220
    Dan Rogers
    Nov 11, 2004
Loading...

Share This Page