I'm trying to resolve a circular reference in a web service. The solution builds fine and some operations are callable, but one which uses a referenced type gives a circular reference exception (below).
System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: A circular reference was detected while serializing an object of type MyCoreAssembly.MyType <-------- this is the referenced type
at System.Xml.Serialization.XmlSerializationWriter.WriteStartElement(String name, String ns, Object o, Boolean writePrefixed, XmlSerializerNamespaces xmlns)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write21_VRD(String n, String ns, VRD o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write21_VRD(String n, String ns, VRD o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write31_Hereditament(String n, String ns, Hereditament o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write32_HereditamentVrd(String n, String ns, HereditamentVrd o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write33_VRDResponse(String n, String ns, VRDResponse o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write43_VRDResponse(Object o)
at Microsoft.Xml.Serialization.GeneratedAssembly.VRDResponseSerializer.Serialize(Object objectToSerialize, XmlSerializationWriter writer) <------- this is my type
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
at System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o, XmlSerializerNamespaces namespaces)
at System.Web.Services.Protocols.XmlReturnWriter.Write(HttpResponse response, Stream outputStream, Object returnValue)
at System.Web.Services.Protocols.HttpServerProtocol.WriteReturns(Object[] returnValues, Stream outputStream)
at System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[] returnValues)
at System.Web.Services.Protocols.WebServiceHandler.Invoke()
The architecture looks roughly like this:
Core layer <------ Data Layer <----- Logic Layer <---------- Web service
\/--------------------\/ <-------------------|
\/--------------------|
Each layer is a separate assembly and the web service references all three assemblies. I've attached a debugger but it doesn't break. It looks like the internals are failing but I have no idea where as everything builds. How would I go about debugging this?
Your circular reference is not in the project files, but in the objects you try to send over the webservice. One of you object has a reference to itself or an object that references to the object.
The error message tell you to look in your type: MyCoreAssembly.MyType
Related
When I try to update my database using the code first approach, I got the below error. The build was succeeded. I am using entity framework core.
System.ArgumentNullException: Value cannot be null. (Parameter 'o')
at Microsoft.EntityFrameworkCore.Utilities.Check.NotNull[T](T value, String parameterName)
at Microsoft.EntityFrameworkCore.Migrations.MigrationCommandListBuilder.Append(String o)
at Microsoft.EntityFrameworkCore.Migrations.SqlServerMigrationsSqlGenerator.Generate(AlterDatabaseOperation operation, IModel model, MigrationCommandListBuilder builder)
at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.<>c.<.cctor>b__83_5(MigrationsSqlGenerator g, MigrationOperation o, IModel m, MigrationCommandListBuilder b)
at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.Generate(MigrationOperation operation, IModel model, MigrationCommandListBuilder builder)
at Microsoft.EntityFrameworkCore.Migrations.SqlServerMigrationsSqlGenerator.Generate(MigrationOperation operation, IModel model, MigrationCommandListBuilder builder)
at Microsoft.EntityFrameworkCore.Migrations.MigrationsSqlGenerator.Generate(IReadOnlyList`1 operations, IModel model, MigrationsSqlGenerationOptions options)
at Microsoft.EntityFrameworkCore.Migrations.SqlServerMigrationsSqlGenerator.Generate(IReadOnlyList`1 operations, IModel model, MigrationsSqlGenerationOptions options)
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.GenerateUpSql(Migration migration, MigrationsSqlGenerationOptions options)
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.<>c__DisplayClass16_2.<GetMigrationCommandLists>b__2()
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String connectionString, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String connectionString, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Value cannot be null. (Parameter 'o')
I am using the 5.0.13 version of the entity-framework core. I upgraded the version but still getting the error. Can someone help me to fix this?
I have a Asp.net Core 2.2 Odata Controller where I need to filter the name of persons with the "like" functionality. This errors out. Is this query support by MongoDB driver (ver 2.8.1) ?
http://192.168.1.151:5000/v2/odata/users?$filter=contains(Name, 'Smith')&$top=1&$count=true
If I I use exact or eq filter it works
http://192.168.1.151:5000/v2/odata/users?$filter=Name eq 'Smith Alan')&$top=1&$count=true
[10:30:17.208 ERR][0HLO4RQ58RQQ9:00000001] Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware: An unhandled exception has occurred while executing the request.
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: IIF((({document}{name} == null) OrElse False), null, Convert({document}{name}.Contains("Loi"), Nullable`1)) is not supported.
at MongoDB.Driver.Linq.Translators.PredicateTranslator.GetFieldExpression(Expression expression)
at MongoDB.Driver.Linq.Translators.PredicateTranslator.TranslateComparison(Expression variableExpression, ExpressionType operatorType, ConstantExpression constantExpression)
at MongoDB.Driver.Linq.Translators.PredicateTranslator.Translate(Expression node)
at MongoDB.Driver.Linq.Translators.PredicateTranslator.Translate(Expression node, IBsonSerializerRegistry serializerRegistry)
at MongoDB.Driver.Linq.Translators.QueryableTranslator.TranslateWhere(WhereExpression node)
at MongoDB.Driver.Linq.Translators.QueryableTranslator.TranslateOrderBy(OrderByExpression node)
at MongoDB.Driver.Linq.Translators.QueryableTranslator.TranslateTake(TakeExpression node)
at MongoDB.Driver.Linq.Translators.QueryableTranslator.TranslateTake(TakeExpression node)
at MongoDB.Driver.Linq.Translators.QueryableTranslator.TranslatePipeline(PipelineExpression node)
at MongoDB.Driver.Linq.Translators.QueryableTranslator.Translate(Expression node, IBsonSerializerRegistry serializerRegistry, ExpressionTranslationOptions translationOptions)
at MongoDB.Driver.Linq.MongoQueryProviderImpl`1.Execute(Expression expression)
at MongoDB.Driver.Linq.MongoQueryableImpl`2.GetEnumerator()
at System.Collections.Generic.List`1.AddEnumerable(IEnumerable`1 enumerable)
at Microsoft.AspNet.OData.Query.TruncatedCollection`1..ctor(IQueryable`1 source, Int32 pageSize)
at Microsoft.AspNet.OData.Query.ODataQueryOptions.LimitResults[T](IQueryable`1 queryable, Int32 limit, Boolean& resultsLimited)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNet.OData.Query.ODataQueryOptions.LimitResults(IQueryable queryable, Int32 limit, Boolean& resultsLimited)
at Microsoft.AspNet.OData.Query.ODataQueryOptions.ApplyTo(IQueryable query, ODataQuerySettings querySettings)
at Microsoft.AspNet.OData.EnableQueryAttribute.ExecuteQuery(Object responseValue, IQueryable singleResultCollection, IWebApiActionDescriptor actionDescriptor, Func`2 modelFunction, IWebApiRequestMessage request, Func`2 createQueryOptionFunction)
The fix for the problem is to add HandleNullPropagation to false.
[EnableQuery( HandleNullPropagation = HandleNullPropagationOption.False)]
public IActionResult Get()
{
return Ok(_db.MyMongoDataCollection().AsQueryable());
}
Background is ASP.NET WebForms application using Entity Framework with Repository and UnitOfWork pattern. Note that the application is also configured to use the out-of-proc StateServer for Session mgt which I understand means that anything I store in session must be serializable.
I also have an HttpModule configured to create a UnitOfWork object (which contains my entity context object) upon each HttpRequest, store it in HttpContext.Current.Items, and of course dispose it at the end of each request.
My UnitOfWork class itself contains properties for each of my repositories as well as the entity context itself.
In an effort to allow more flexible testing in the future, I created an IObjectContext interface with signatures for the methods and properties on my entity context, and I created a partial class for my entity context and inherited from it.
public class UnitOfWork : IUnitOfWork
{
private IObjectContext context;
}
public UnitOfWork(IObjectContext context)
{
this.context = context;
}
public partial class MyEntities : IObjectContext
{
}
private static void ApplicationBeginRequest(Object source, EventArgs e)
{
if (!HttpContext.Current.Items.Contains("UnitOfWork"))
{
IUnitOfWork unitOfWork = new UnitOfWork();
HttpContext.Current.Items.Add("UnitOfWork", unitOfWork);
}
}
private void ApplicationEndRequest(object sender, EventArgs e)
{
if (HttpContext.Current.Items["UnitOfWork"] != null)
((IUnitOfWork)HttpContext.Current.Items["UnitOfWork"]).Dispose();
}
The goal here is ultimately to allow me to fake my entity context object to create for example, an in-memory context for testing purposes.
Everything was going fine until I started getting "not marked as serializable" exceptions on my entity context object. Obviously my first thought was to just add [Serializable] to my partial entity context class, but then it started complaining that System.Data.Objects.ObjectContext in Assembly System.Data.Entity was not marked as serializable (which I obviously don't have any control over).
What am I missing here? It seems like I can't store my entity context object in HttpContext.Current.Items, which I must do for my unit of work pattern implementation.
Is this because I'm using the ASP.NET State Server instead of in-proc session mgt? Surely there's a way to store the context for the life of the HTTP request if you're using the State Server?
Just feel like I'm missing something obvious here. I've added [Serializable] to everything from the UnitOfWork to the MyEntities context to each repository class. Still can't get past the entity context itself.
Any ideas?
UPDATE (Adding Stack Trace):
[SerializationException: Type 'myDAL.Model.myEntities' in Assembly 'myDAL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.]
System.Runtime.Serialization.FormatterServices.InternalGetSerializableMembers(RuntimeType type) +14324629
System.Runtime.Serialization.FormatterServices.GetSerializableMembers(Type type, StreamingContext context) +408
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitMemberInfo() +420
System.Runtime.Serialization.Formatters.Binary.WriteObjectInfo.InitSerialize(Object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder) +532
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Write(WriteObjectInfo objectInfo, NameInfo memberNameInfo, NameInfo typeNameInfo) +969
System.Runtime.Serialization.Formatters.Binary.ObjectWriter.Serialize(Object graph, Header[] inHeaders, __BinaryWriter serWriter, Boolean fCheck) +633
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Serialize(Stream serializationStream, Object graph, Header[] headers, Boolean fCheck) +322
System.Web.Util.AltSerialization.WriteValueToStream(Object value, BinaryWriter writer) +1487
[HttpException (0x80004005): Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.]
System.Web.Util.AltSerialization.WriteValueToStream(Object value, BinaryWriter writer) +2485899
System.Web.SessionState.SessionStateItemCollection.WriteValueToStreamWithAssert(Object value, BinaryWriter writer) +49
System.Web.SessionState.SessionStateItemCollection.Serialize(BinaryWriter writer) +746
System.Web.SessionState.SessionStateUtility.Serialize(SessionStateStoreData item, Stream stream) +336
System.Web.SessionState.SessionStateUtility.SerializeStoreData(SessionStateStoreData item, Int32 initialStreamSize, Byte[]& buf, Int32& length, Boolean compressionEnabled) +99
System.Web.SessionState.OutOfProcSessionStateStore.SetAndReleaseItemExclusive(HttpContext context, String id, SessionStateStoreData item, Object lockId, Boolean newItem) +3828904
System.Web.SessionState.SessionStateModule.OnReleaseState(Object source, EventArgs eventArgs) +1021
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +165
The stack trace indicates that there is a non-serializable object in the session, not in the context. Double check that you did not put your data object in session by mistake.
Putting it into the context request should not be giving this error.
I wonder if it's possible to assign a default value for web service request input parameter. Here's my input parameter in the wsdl:
<element name="pensionType" default="0" type="int">
In the code side I check for the value of pensionType like this:
if (pensionType!=0)
{ TODO code here}
else
{ return warning that no data found}
I tested this in Mozilla Poster. So from this I expected that if I didn't supply any value to pensionType I'd get that warning. I get a long error:
System.Web.Services.Protocols.SoapException: Server was unable to read request. --->
System.InvalidOperationException: There is an error in XML document (13, 39). ---> System.FormatException: Input string was not in a correct format. at
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.Xml.XmlConvert.ToInt32(String s) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read44_getFileTypesRequest(Boolean isNullable, Boolean checkType) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read45_getFileTypes(Boolean isNullable, Boolean checkType) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read62_getFileTypes() at
Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer24.Deserialize(XmlSerializationReader reader) at
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
--- End of inner exception stack trace --- at
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events) at
System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle) at
System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()
--- End of inner exception stack trace --- at
System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() at
System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest(
You can do like this:
if(pensionType != null)
{
if (pensionType!=0)
{ TODO code here}
else
{ return warning that no data found}
}
This may help you..!!
I have an application that is making SOAP web service calls to another application (no JSON possibility here). Some of the responses come back fine. The issue is that one of the calls is made OK but the response brings back a System.DateTime.ParseExact error. I checked the date format in SOAPUI and it came back as: 2012-02-05-05:00
The error message is:
at System.DateTime.ParseExact (System.String s, System.String[] formats, IFormatProvider provider, DateTimeStyles style) [0x0005c] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/DateTime.cs:1761
at System.DateTime.ParseExact (System.String s, System.String format, IFormatProvider provider, DateTimeStyles style) [0x0001c] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/DateTime.cs:1741
at System.DateTime.ParseExact (System.String s, System.String format, IFormatProvider provider) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System/DateTime.cs:927
at System.Xml.Serialization.XmlCustomFormatter.FromXmlString (System.Xml.Serialization.TypeData type, System.String value) [0x001d4] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlCustomFormatter.cs:275
at System.Xml.Serialization.XmlSerializationReaderInterpreter.GetValueFromXmlString (System.String value, System.Xml.Serialization.TypeData typeData, System.Xml.Serialization.XmlTypeMapping typeMap) [0x00047] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:652
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadPrimitiveValue (System.Xml.Serialization.XmlTypeMapElementInfo elem) [0x0003e] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:638
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObjectElement (System.Xml.Serialization.XmlTypeMapElementInfo elem) [0x0003f] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:614
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList, Boolean readBySoapOrder) [0x0082c] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:464
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanceMembers (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:240
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstance (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x000d5] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:230
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x00031] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:193
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstance (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x00076] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:220
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x00031] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:193
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObjectElement (System.Xml.Serialization.XmlTypeMapElementInfo elem) [0x0005c] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:620
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList, Boolean readBySoapOrder) [0x005fb] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:434
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstanceMembers (System.Xml.Serialization.XmlTypeMapping typeMap, System.Object ob) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:240
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadClassInstance (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x000d5] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:230
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObject (System.Xml.Serialization.XmlTypeMapping typeMap, Boolean isNullable, Boolean checkType) [0x00031] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:193
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadObjectElement (System.Xml.Serialization.XmlTypeMapElementInfo elem) [0x0005c] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:620
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMembers (System.Xml.Serialization.ClassMap map, System.Object ob, Boolean isValueList, Boolean readBySoapOrder) [0x005fb] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:434
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadMessage (System.Xml.Serialization.XmlMembersMapping typeMap) [0x0015a] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:154
at System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot () [0x0004c] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializationReaderInterpreter.cs:92
at System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.Serialization.XmlSerializationReader reader) [0x0001c] in /Developer/MonoTouch/Source/mono/mcs/class/System.XML/System.Xml.Serialization/XmlSerializer.cs:361
This does not look like a question (see note) but, in case I'm mistaken, here why...
case "date": return DateTime.ParseExact (value, "yyyy-MM-dd", null);
That's line #275 from XmlCustomFormatter.cs (source available on github) that shows the format (right or wrong) that Mono expect the date to be.
This does not match the 2012-02-05-05:00 string you provided in your question and this leads to the exception you're now experiencing. This could be a bug in Mono or, if Microsoft implementation behave the same, an issue with the web service you're calling.
note: bug reports be filled at http://bugzilla.xamarin.com
I've seen the this before a couple years back, it has stopped me porting several web service projects to Mono. I can confirm Mono behaves differently than than Microsoft .Net. I am not clear if it is a bug, but many web services return the date in formats other than 'yyyy-mm-dd', some add a 'Z' or other timezone spec, some have the time. You could patch Mono to use System.DateTime.Parse, but that a pain to have to use a custom Mono build just for this.