[quoted text, click to view] "BOB Le Bricoleur" <bob@bob.bob> wrote in message
news:mn.d3d47d827393448a.86280@bob.bob...
> Daniel Cigic a exposé le 26/02/2008 :
>> Hi Bob,
>>
>> For the cast to succeed both array must have the same number of
>> dimensions ant there must be an implicit or explicit conversion from the
>> source element type to the target element type.
>> You could use just one of the overloaded Array.Copy() methods. Looking at
>> you code I see
>
> I get the same error messages with Array.Copy()
>
>
>> "return ((Categorie[])(results[0]));". Are you sure that you have array
>> of Categorie in first array - result[0] element?
>
> I am pretty sure; here is what the debugger gives for "results[0]":
>
> results[0]:{Dimensions:[3]}
> [0]:{ModuleAstuces.localhost.Categorie}
> [1]:{ModuleAstuces.localhost.Categorie}
> [2]:{ModuleAstuces.localhost.Categorie}
>
>
> The code was generated by visual studio 2005, it should work without
> modifying it. This is weird..
I've seen this when the serialization code is deserializing to a different
type than the proxy class is casting into. This has happened when the
serialization code (which is generated) is cached in one of the ASP.NET
caching locations (I forget how many there are), and then the code was
rebuilt, with a slightly different type.
You need to try deleting the cached version of the serialization code, then
rebuild the project. As I said, I never remember all the locations where
ASP.NET caches binaries for you, so someone else will have to help you
there. One thing that will help: is this a web project (File->New->Project),
or a web site (File->New->Web Site)?
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer