Error when WebMethod returns a jagged array

M

MikeL

Hello.

I've been getting an error message like the following when testing a
webservice that I'm creating:

"File or assembly name 8rsiphqb.dll, or one of its dependencies,
was not found."

Each time I refresh the page the .dll name changes, which tells me that the
CLR is generating this .dll (right?)

I think I narrowed down the problem: It seems only to happen when the return
type of the WebMethod contains a jagged array. Here's what the XSD.exe
utility generated from my schema:

[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.myService.com/RatingHub")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.myService.com/RatingHub",
IsNullable=false)]

public class scPlan

{


/// <remarks/>

[System.Xml.Serialization.XmlArrayItemAttribute(typeof(scTermRate),
IsNullable=false)]

public scTermRate[][] scTermRates;


/// <remarks/>

[System.Xml.Serialization.XmlArrayItemAttribute(typeof(scSurcharge),
IsNullable=false)]

public scSurcharge[][] scSurcharges;


/// <remarks/>

[System.Xml.Serialization.XmlAttributeAttribute()]

public string code;


/// <remarks/>

[System.Xml.Serialization.XmlAttributeAttribute()]

public string description;

}

When I set a breakpoint on the first line of the WebMethod in the .asmx file
it is never reached, the error is generated in the browser.

Does anyone know what's going on?

Thanks in advance,

Mike
 
B

Bruce Johnson [C# MVP]

This type of error is usually indicative of something bad going on when the
web service tries to generate the class that is used to serialize the
incoming and outgoing messages. Check out
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/trblshtxsd.asp
to a description of how to identify these sorts of problems, paying
particular attention to the section towards the bottom that describes how to
keep the compiled code around.

Hope this helps.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce
 
M

MikeL

Hi, Bruce. Thanks for responding.

That certainly addresses my problem. If you don't mind I have three
additional questions:

1) Why would XSD.exe generate jagged arrays if the generated code can't be
compiled?
2) The article states to change the app's .config file. Is this the
web.config file of my webservice project? The reason I ask is because that's
exactly what I changed and nothing peristed.
3) The article offered no solution. Do you have any suggestions for a
solution?

Thanks again,

Mike

Bruce Johnson said:
This type of error is usually indicative of something bad going on when
the
web service tries to generate the class that is used to serialize the
incoming and outgoing messages. Check out
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/trblshtxsd.asp
to a description of how to identify these sorts of problems, paying
particular attention to the section towards the bottom that describes how
to
keep the compiled code around.

Hope this helps.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

MikeL said:
Hello.

I've been getting an error message like the following when testing a
webservice that I'm creating:

"File or assembly name 8rsiphqb.dll, or one of its
dependencies,
was not found."

Each time I refresh the page the .dll name changes, which tells me that
the
CLR is generating this .dll (right?)

I think I narrowed down the problem: It seems only to happen when the
return
type of the WebMethod contains a jagged array. Here's what the XSD.exe
utility generated from my schema:

[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.myService.com/RatingHub")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.myService.com/RatingHub",
IsNullable=false)]

public class scPlan

{


/// <remarks/>

[System.Xml.Serialization.XmlArrayItemAttribute(typeof(scTermRate),
IsNullable=false)]

public scTermRate[][] scTermRates;


/// <remarks/>

[System.Xml.Serialization.XmlArrayItemAttribute(typeof(scSurcharge),
IsNullable=false)]

public scSurcharge[][] scSurcharges;


/// <remarks/>

[System.Xml.Serialization.XmlAttributeAttribute()]

public string code;


/// <remarks/>

[System.Xml.Serialization.XmlAttributeAttribute()]

public string description;

}

When I set a breakpoint on the first line of the WebMethod in the .asmx
file
it is never reached, the error is generated in the browser.

Does anyone know what's going on?

Thanks in advance,

Mike
 
B

Bruce Johnson [C# MVP]

1. Don't know for sure if the code that xsd generated for jagged arrays is
causing the problem. It could be something as simple as a property name that
happens to be a keyword in C#. I don't see that in your code, but then
again, I can't see all of the code.

2. It's the web.config file on the server that gets changed. You might
have to search around for the persisted file. I found it a challenge to find
the first time.

3. It's difficult to come up with a solution until I see why the file isn't
compiling. And I suspect when you do see it, the reason will be obvious.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

MikeL said:
Hi, Bruce. Thanks for responding.

That certainly addresses my problem. If you don't mind I have three
additional questions:

1) Why would XSD.exe generate jagged arrays if the generated code can't be
compiled?
2) The article states to change the app's .config file. Is this the
web.config file of my webservice project? The reason I ask is because that's
exactly what I changed and nothing peristed.
3) The article offered no solution. Do you have any suggestions for a
solution?

Thanks again,

Mike

Bruce Johnson said:
This type of error is usually indicative of something bad going on when
the
web service tries to generate the class that is used to serialize the
incoming and outgoing messages. Check out
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/trblshtxsd.asp
to a description of how to identify these sorts of problems, paying
particular attention to the section towards the bottom that describes how
to
keep the compiled code around.

Hope this helps.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

MikeL said:
Hello.

I've been getting an error message like the following when testing a
webservice that I'm creating:

"File or assembly name 8rsiphqb.dll, or one of its
dependencies,
was not found."

Each time I refresh the page the .dll name changes, which tells me that
the
CLR is generating this .dll (right?)

I think I narrowed down the problem: It seems only to happen when the
return
type of the WebMethod contains a jagged array. Here's what the XSD.exe
utility generated from my schema:

[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.myService.com/RatingHub")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.myService.com/RatingHub",
IsNullable=false)]

public class scPlan

{


/// <remarks/>

[System.Xml.Serialization.XmlArrayItemAttribute(typeof(scTermRate),
IsNullable=false)]

public scTermRate[][] scTermRates;


/// <remarks/>

[System.Xml.Serialization.XmlArrayItemAttribute(typeof(scSurcharge),
IsNullable=false)]

public scSurcharge[][] scSurcharges;


/// <remarks/>

[System.Xml.Serialization.XmlAttributeAttribute()]

public string code;


/// <remarks/>

[System.Xml.Serialization.XmlAttributeAttribute()]

public string description;

}

When I set a breakpoint on the first line of the WebMethod in the .asmx
file
it is never reached, the error is generated in the browser.

Does anyone know what's going on?

Thanks in advance,

Mike
 
M

MikeL

Hi, Bruce. Thanks again for responding.

I found the .cs file. It was under <System Drive>\Documents and Setting\<My
Machine Name>\ASPNET\Local Settings\Temp.

I copied the source from that file into a new C# file in my project,
compiled the project, and the compile failed. The generated code tries to
assign string[] to a string, and vice versa.

Here's how the compile reads:

Preparing resources...
Updating references...
Performing main compilation...
c:\inetpub\wwwroot\jaggedarraytypes\codefile2.cs(19,6): warning CS0642:
Possible mistaken null statement
c:\inetpub\wwwroot\jaggedarraytypes\codefile2.cs(36,78): error CS0030:
Cannot convert type 'string[]' to 'string'
c:\inetpub\wwwroot\jaggedarraytypes\codefile2.cs(55,6): warning CS0642:
Possible mistaken null statement
c:\inetpub\wwwroot\jaggedarraytypes\codefile2.cs(71,80): error CS0030:
Cannot convert type 'string[]' to 'string'
c:\inetpub\wwwroot\jaggedarraytypes\codefile2.cs(115,6): warning CS0642:
Possible mistaken null statement
c:\inetpub\wwwroot\jaggedarraytypes\codefile2.cs(172,114): error CS0029:
Cannot implicitly convert type 'string' to 'string[]'
c:\inetpub\wwwroot\jaggedarraytypes\codefile2.cs(236,113): error CS0029:
Cannot implicitly convert type 'string' to 'string[]'

Build complete -- 4 errors, 3 warnings
Building satellite assemblies...
---------------------- Done ----------------------
Build: 0 succeeded, 1 failed, 0 skipped

Here's a snippet of the generated code in the assembly that is pointed to by
the first error (I added the elipses). The error is in the
"WriteElementString" method call:
....
{
System.String[][] a =
(System.String[][])((System.String[][])o.@JaggedArray1);
if (a != null)
{
WriteStartElement(@"JaggedArray1",
@http://www.stoneeagle.com/RatingHub);
for (int ia = 0; ia < a.Length; ia++)
{
WriteElementString(@"string",
@"http://www.stoneeagle.com/RatingHub", ((System.String)a[ia])); // THIS
IS WHERE THE ERROR IS
}
WriteEndElement();
}
}
....

I understand why the compile failed, but I don't know what I need to do in
the XSD.EXE-generated class file to make this work. Any suggestions?

I have looked at the "Contract-First WSDL" code generator by Thinktecture
and see that their code generates Collections instead of jagged arrays.

Have you any experience serializing Collections and do you think that that's
a better solution?

Thanks again,

Mike

Bruce Johnson said:
1. Don't know for sure if the code that xsd generated for jagged arrays
is
causing the problem. It could be something as simple as a property name
that
happens to be a keyword in C#. I don't see that in your code, but then
again, I can't see all of the code.

2. It's the web.config file on the server that gets changed. You might
have to search around for the persisted file. I found it a challenge to
find
the first time.

3. It's difficult to come up with a solution until I see why the file
isn't
compiling. And I suspect when you do see it, the reason will be obvious.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

MikeL said:
Hi, Bruce. Thanks for responding.

That certainly addresses my problem. If you don't mind I have three
additional questions:

1) Why would XSD.exe generate jagged arrays if the generated code can't
be
compiled?
2) The article states to change the app's .config file. Is this the
web.config file of my webservice project? The reason I ask is because
that's
exactly what I changed and nothing peristed.
3) The article offered no solution. Do you have any suggestions for a
solution?

Thanks again,

Mike

message
This type of error is usually indicative of something bad going on when
the
web service tries to generate the class that is used to serialize the
incoming and outgoing messages. Check out
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/trblshtxsd.asp
to a description of how to identify these sorts of problems, paying
particular attention to the section towards the bottom that describes
how
to
keep the compiled code around.

Hope this helps.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

:

Hello.

I've been getting an error message like the following when testing a
webservice that I'm creating:

"File or assembly name 8rsiphqb.dll, or one of its
dependencies,
was not found."

Each time I refresh the page the .dll name changes, which tells me
that
the
CLR is generating this .dll (right?)

I think I narrowed down the problem: It seems only to happen when the
return
type of the WebMethod contains a jagged array. Here's what the XSD.exe
utility generated from my schema:

[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.myService.com/RatingHub")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.myService.com/RatingHub",
IsNullable=false)]

public class scPlan

{


/// <remarks/>

[System.Xml.Serialization.XmlArrayItemAttribute(typeof(scTermRate),
IsNullable=false)]

public scTermRate[][] scTermRates;


/// <remarks/>

[System.Xml.Serialization.XmlArrayItemAttribute(typeof(scSurcharge),
IsNullable=false)]

public scSurcharge[][] scSurcharges;


/// <remarks/>

[System.Xml.Serialization.XmlAttributeAttribute()]

public string code;


/// <remarks/>

[System.Xml.Serialization.XmlAttributeAttribute()]

public string description;

}

When I set a breakpoint on the first line of the WebMethod in the
.asmx
file
it is never reached, the error is generated in the browser.

Does anyone know what's going on?

Thanks in advance,

Mike
 
B

Bruce Johnson [C# MVP]

Take a look at the following post:

http://groups-beta.google.com/group...convert%20type&hl=en&lr=&ie=UTF-8&sa=N&tab=wg

It describes a solution to the jagged array limitation in XmlSerializer that
will hopefully be useful.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

Bruce Johnson said:
1. Don't know for sure if the code that xsd generated for jagged arrays is
causing the problem. It could be something as simple as a property name that
happens to be a keyword in C#. I don't see that in your code, but then
again, I can't see all of the code.

2. It's the web.config file on the server that gets changed. You might
have to search around for the persisted file. I found it a challenge to find
the first time.

3. It's difficult to come up with a solution until I see why the file isn't
compiling. And I suspect when you do see it, the reason will be obvious.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

MikeL said:
Hi, Bruce. Thanks for responding.

That certainly addresses my problem. If you don't mind I have three
additional questions:

1) Why would XSD.exe generate jagged arrays if the generated code can't be
compiled?
2) The article states to change the app's .config file. Is this the
web.config file of my webservice project? The reason I ask is because that's
exactly what I changed and nothing peristed.
3) The article offered no solution. Do you have any suggestions for a
solution?

Thanks again,

Mike

Bruce Johnson said:
This type of error is usually indicative of something bad going on when
the
web service tries to generate the class that is used to serialize the
incoming and outgoing messages. Check out
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/trblshtxsd.asp
to a description of how to identify these sorts of problems, paying
particular attention to the section towards the bottom that describes how
to
keep the compiled code around.

Hope this helps.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

:

Hello.

I've been getting an error message like the following when testing a
webservice that I'm creating:

"File or assembly name 8rsiphqb.dll, or one of its
dependencies,
was not found."

Each time I refresh the page the .dll name changes, which tells me that
the
CLR is generating this .dll (right?)

I think I narrowed down the problem: It seems only to happen when the
return
type of the WebMethod contains a jagged array. Here's what the XSD.exe
utility generated from my schema:

[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.myService.com/RatingHub")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.myService.com/RatingHub",
IsNullable=false)]

public class scPlan

{


/// <remarks/>

[System.Xml.Serialization.XmlArrayItemAttribute(typeof(scTermRate),
IsNullable=false)]

public scTermRate[][] scTermRates;


/// <remarks/>

[System.Xml.Serialization.XmlArrayItemAttribute(typeof(scSurcharge),
IsNullable=false)]

public scSurcharge[][] scSurcharges;


/// <remarks/>

[System.Xml.Serialization.XmlAttributeAttribute()]

public string code;


/// <remarks/>

[System.Xml.Serialization.XmlAttributeAttribute()]

public string description;

}

When I set a breakpoint on the first line of the WebMethod in the .asmx
file
it is never reached, the error is generated in the browser.

Does anyone know what's going on?

Thanks in advance,

Mike
 
M

MikeL

Hi, Bruce. Thanks again.

I looked at your other posting.

Actually had already made the change suggested by Karthik so that the object
would serialize. A new problem arises at that point because the serializer
inserts another element, one that is not in the original schema, whose name
is something like <ArrayObjectElement>" or something like that.

That breaks the contract.

Is there a way to instruct the serializer to suppress elements?

Thanks again, I really appreciate all of your help.

Mike

Bruce Johnson said:
Take a look at the following post:

http://groups-beta.google.com/group...convert%20type&hl=en&lr=&ie=UTF-8&sa=N&tab=wg

It describes a solution to the jagged array limitation in XmlSerializer
that
will hopefully be useful.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

Bruce Johnson said:
1. Don't know for sure if the code that xsd generated for jagged arrays
is
causing the problem. It could be something as simple as a property name
that
happens to be a keyword in C#. I don't see that in your code, but then
again, I can't see all of the code.

2. It's the web.config file on the server that gets changed. You might
have to search around for the persisted file. I found it a challenge to
find
the first time.

3. It's difficult to come up with a solution until I see why the file
isn't
compiling. And I suspect when you do see it, the reason will be obvious.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

MikeL said:
Hi, Bruce. Thanks for responding.

That certainly addresses my problem. If you don't mind I have three
additional questions:

1) Why would XSD.exe generate jagged arrays if the generated code can't
be
compiled?
2) The article states to change the app's .config file. Is this the
web.config file of my webservice project? The reason I ask is because
that's
exactly what I changed and nothing peristed.
3) The article offered no solution. Do you have any suggestions for a
solution?

Thanks again,

Mike

message
This type of error is usually indicative of something bad going on
when
the
web service tries to generate the class that is used to serialize the
incoming and outgoing messages. Check out
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/trblshtxsd.asp
to a description of how to identify these sorts of problems, paying
particular attention to the section towards the bottom that describes
how
to
keep the compiled code around.

Hope this helps.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

:

Hello.

I've been getting an error message like the following when testing a
webservice that I'm creating:

"File or assembly name 8rsiphqb.dll, or one of its
dependencies,
was not found."

Each time I refresh the page the .dll name changes, which tells me
that
the
CLR is generating this .dll (right?)

I think I narrowed down the problem: It seems only to happen when
the
return
type of the WebMethod contains a jagged array. Here's what the
XSD.exe
utility generated from my schema:

[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.myService.com/RatingHub")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.myService.com/RatingHub",
IsNullable=false)]

public class scPlan

{


/// <remarks/>

[System.Xml.Serialization.XmlArrayItemAttribute(typeof(scTermRate),
IsNullable=false)]

public scTermRate[][] scTermRates;


/// <remarks/>

[System.Xml.Serialization.XmlArrayItemAttribute(typeof(scSurcharge),
IsNullable=false)]

public scSurcharge[][] scSurcharges;


/// <remarks/>

[System.Xml.Serialization.XmlAttributeAttribute()]

public string code;


/// <remarks/>

[System.Xml.Serialization.XmlAttributeAttribute()]

public string description;

}

When I set a breakpoint on the first line of the WebMethod in the
.asmx
file
it is never reached, the error is generated in the browser.

Does anyone know what's going on?

Thanks in advance,

Mike
 
M

MikeL

I called Microsoft and got an answer.

There is a bug in the serializer. To get the thing to serialize I had to
specify the "mixed" attribute of the "complexType" element.

MS is going to let me know if they are planning to fix the serializer.

MikeL said:
Hi, Bruce. Thanks again.

I looked at your other posting.

Actually had already made the change suggested by Karthik so that the
object would serialize. A new problem arises at that point because the
serializer inserts another element, one that is not in the original
schema, whose name is something like <ArrayObjectElement>" or something
like that.

That breaks the contract.

Is there a way to instruct the serializer to suppress elements?

Thanks again, I really appreciate all of your help.

Mike

Bruce Johnson said:
Take a look at the following post:

http://groups-beta.google.com/group...convert%20type&hl=en&lr=&ie=UTF-8&sa=N&tab=wg

It describes a solution to the jagged array limitation in XmlSerializer
that
will hopefully be useful.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

Bruce Johnson said:
1. Don't know for sure if the code that xsd generated for jagged arrays
is
causing the problem. It could be something as simple as a property name
that
happens to be a keyword in C#. I don't see that in your code, but then
again, I can't see all of the code.

2. It's the web.config file on the server that gets changed. You might
have to search around for the persisted file. I found it a challenge to
find
the first time.

3. It's difficult to come up with a solution until I see why the file
isn't
compiling. And I suspect when you do see it, the reason will be
obvious.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

:

Hi, Bruce. Thanks for responding.

That certainly addresses my problem. If you don't mind I have three
additional questions:

1) Why would XSD.exe generate jagged arrays if the generated code
can't be
compiled?
2) The article states to change the app's .config file. Is this the
web.config file of my webservice project? The reason I ask is because
that's
exactly what I changed and nothing peristed.
3) The article offered no solution. Do you have any suggestions for a
solution?

Thanks again,

Mike

message
This type of error is usually indicative of something bad going on
when
the
web service tries to generate the class that is used to serialize
the
incoming and outgoing messages. Check out
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnxmlnet/html/trblshtxsd.asp
to a description of how to identify these sorts of problems, paying
particular attention to the section towards the bottom that
describes how
to
keep the compiled code around.

Hope this helps.

Bruce Johnson [C# MVP]
http://www.objectsharp.com/blogs/bruce

:

Hello.

I've been getting an error message like the following when testing
a
webservice that I'm creating:

"File or assembly name 8rsiphqb.dll, or one of its
dependencies,
was not found."

Each time I refresh the page the .dll name changes, which tells me
that
the
CLR is generating this .dll (right?)

I think I narrowed down the problem: It seems only to happen when
the
return
type of the WebMethod contains a jagged array. Here's what the
XSD.exe
utility generated from my schema:

[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://www.myService.com/RatingHub")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="http://www.myService.com/RatingHub",
IsNullable=false)]

public class scPlan

{


/// <remarks/>

[System.Xml.Serialization.XmlArrayItemAttribute(typeof(scTermRate),
IsNullable=false)]

public scTermRate[][] scTermRates;


/// <remarks/>

[System.Xml.Serialization.XmlArrayItemAttribute(typeof(scSurcharge),
IsNullable=false)]

public scSurcharge[][] scSurcharges;


/// <remarks/>

[System.Xml.Serialization.XmlAttributeAttribute()]

public string code;


/// <remarks/>

[System.Xml.Serialization.XmlAttributeAttribute()]

public string description;

}

When I set a breakpoint on the first line of the WebMethod in the
.asmx
file
it is never reached, the error is generated in the browser.

Does anyone know what's going on?

Thanks in advance,

Mike
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top