SqlError Deserialization - Possible Version mismatch.

M

Mythran

We have an application on one server and a web service on another server.
Our BLL and DAL layers are behind the web service. When a SqlException is
thrown, the application receives the following error:

System.Runtime.Serialization.SerializationException: Possible Version
mismatch. Type System.Data.SqlClient.SqlError has 8 members, number of
members deserialized is 7.

After reviewing SqlError, framework v1.1 contains the following fields:

private byte errorClass;
private int lineNumber;
private string message;
private int number;
private string procedure;
private string source = ".Net SqlClient Data Provider";
private byte state;

SqlError, framework v2.0 contains:

private byte errorClass;
private int lineNumber;
private string message;
private int number;
private string procedure;
[OptionalField(VersionAdded=2)]
private string server;
private string source = ".Net SqlClient Data Provider";
private byte state;

I'm assuming that the application itself is running on v2.0 somehow. I
checked the ASP.Net tab in IIS for the application and it is set to run
under .Net 1.1, not 2.0...anyone familiar with this and can shed some light
or any other types of tests I can run.

Thanks,
Mythran
 
M

Mythran

Bah, found the problem. The System.Data.dll version on the web service
server was 1.1.4322.2032 while the version of the same dll on the
application server was 1.1.4322.2300. Go figure. The dll on the
application server DOES define the new field that is visible in the 2.0 dll,
but it doesn't have the OptionalFieldAttribute and thus, the serialization
process throws the exception because there is an extra field in the dll that
is used when deserializing.

Hope this helps anyone else out there with similar probs :)

Thanks,
Mythran
 

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

Top