Professional Web Applications Themes

Visual Studio.NET 2003 generates type object[] for ArrayList method return - ASP.NET Web Services

I've noticed what appears to be a bug in the Visual Studio.NET (1.0 and 2003 versions). If I declare a web method like so: [WebMethod] public ArrayList GetMyList() { ArrayList list = new ArrayList() list.Add("one"); list.Add("two"); return list; } If I bind to the above from a client application like so: ArrayList newlist = mywebservice.GetMyList(); The above fails (sometimes, sometimes it works), the compiler expects a type of object[] (object array) and not ArrayList. Casting also fails. I've even tried the following: [WebMethod] public object[] GetMyList() { ArrayList list = new ArrayList() list.Add("one"); list.Add("two"); return list.ToArray(); } Sometimes it works, ...

  1. #1

    Default Visual Studio.NET 2003 generates type object[] for ArrayList method return

    I've noticed what appears to be a bug in the Visual Studio.NET (1.0
    and 2003 versions). If I declare a web method like so:

    [WebMethod]
    public ArrayList GetMyList()
    {
    ArrayList list = new ArrayList()
    list.Add("one");
    list.Add("two");
    return list;
    }


    If I bind to the above from a client application like so:

    ArrayList newlist = mywebservice.GetMyList();

    The above fails (sometimes, sometimes it works), the compiler expects
    a type of object[] (object array) and not ArrayList. Casting also
    fails. I've even tried the following:


    [WebMethod]
    public object[] GetMyList()
    {
    ArrayList list = new ArrayList()
    list.Add("one");
    list.Add("two");
    return list.ToArray();
    }

    Sometimes it works, sometimes it doesn't work. The later example never
    works. Can anyone explain this? Is it a IDE generated code bug?
    JDeats Guest

  2. #2

    Default Re: Visual Studio.NET 2003 generates type object[] for ArrayList method return

    have a look at this
    [url]http://www.fawcette.com/vsm/2001_12/online/online_eprods/webservices_yshohoud12_12/default_pf.aspx[/url]

    It explains the situation you are confronting.

    -Dino


    "JDeats" <jeremypdq.net> wrote in message
    news:b0738dc6.0310271418.23a1a20bposting.google.c om...
    > I've noticed what appears to be a bug in the Visual Studio.NET (1.0
    > and 2003 versions). If I declare a web method like so:
    >
    > [WebMethod]
    > public ArrayList GetMyList()
    > {
    > ArrayList list = new ArrayList()
    > list.Add("one");
    > list.Add("two");
    > return list;
    > }
    >
    >
    > If I bind to the above from a client application like so:
    >
    > ArrayList newlist = mywebservice.GetMyList();
    >
    > The above fails (sometimes, sometimes it works), the compiler expects
    > a type of object[] (object array) and not ArrayList. Casting also
    > fails. I've even tried the following:
    >
    >
    > [WebMethod]
    > public object[] GetMyList()
    > {
    > ArrayList list = new ArrayList()
    > list.Add("one");
    > list.Add("two");
    > return list.ToArray();
    > }
    >
    > Sometimes it works, sometimes it doesn't work. The later example never
    > works. Can anyone explain this? Is it a IDE generated code bug?

    Dino Chiesa [Microsoft] Guest

Similar Threads

  1. Acrobat 9.0 + Visual studio 2003
    By Nethaji@adobeforums.com in forum Adobe Acrobat SDK
    Replies: 6
    Last Post: September 15th, 10:23 AM
  2. visual studio .net architect enterprise 2003
    By Cowboy \(Gregory A. Beamer\) [MVP] in forum ASP.NET Web Services
    Replies: 2
    Last Post: January 26th, 10:49 PM
  3. Webservice Timeout in Visual Studio 2003
    By John Nelson in forum ASP.NET Web Services
    Replies: 4
    Last Post: September 1st, 04:55 AM
  4. Control Render Method Problem and the Visual Studio Designer
    By Pete in forum ASP.NET Building Controls
    Replies: 0
    Last Post: December 10th, 06:36 AM
  5. Visual Studio 2003-Web Service problem
    By Hergass in forum ASP.NET Web Services
    Replies: 2
    Last Post: December 7th, 06:20 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139