System.DateTime.ParseExact error in SOAP response in Monotouch iOS - datetime

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.

Related

Asp.net Core Odata on Mongodb like filter

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());
}

Azure websites - The configuration file has been changed by another program

Last 2 days I've been plagued on my azure websites app with following exception:
Exception information:
Exception type: ConfigurationErrorsException
Exception message: The configuration file has been changed by another program. (D:\home\site\wwwroot\web.config)
It comes periodically each 5 minutes [or so], after app restart it goes ok for a while then it does again.
Is there a way how to debug what's causing the config file change? I have went through the whole code and have not found any reference for config file edition
Stack trace:
at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Web.Configuration.RuntimeConfig.GetSectionObject(String sectionName)
at System.Web.Configuration.RuntimeConfig.GetSection(String sectionName, Type type, ResultsIndex index)
at System.Web.Configuration.RuntimeConfig.get_HttpRuntime()
at System.Web.HttpContext.EnsureTimeout()
at System.Web.HttpApplication.OnThreadEnterPrivate(Boolean setImpersonationContext)
at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)
at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)
at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)
We have experienced the same problem but only at a specific time each day, starting three days ago.
It seems to be a global Azure issue, for more info take a look here

SignalR returns error - Unexpected end when deserializing object

I have simple project, where I'm using signalR, When page loads, signalR scripts are loaded succefully, however right after that, call to
http://localhost:24634/signalr/signalr/connect?transport=foreverFrame&connectionId=dca2db9c-b16a-4b96-96dc-9a6b187b6d9e&connectionData=[{"name":"notifier"}]&tid=5&frameId=1
returns 500 Internal Server Error, I checked this request in fiddler, error message says
Unexpected end when deserializing object.
Here's my Hub Definitin
[HubName("notifier")]
public class PublishingNotifier: Hub
{
[HubMethodName("send")]
public void SendMessage(string message)
{
Clients.getNotification(message);
}
}
and here's my client code
$(function () {
var publishingNotifier = $.connection.notifier;
publishingNotifier.getNotification = function (message) {
// do something
};
$('input[type=submit][id*=cmsB_ChangeStatusToPublishedTop]').on('click', function (e) {
// do something else
});
$.connection.hub.start();
});
Any ideas what can be cause of this error ?
EDIT
Here is Stack Trace information
[JsonSerializationException: Unexpected end when deserializing object.
Line 1, position 2.]
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CheckedRead(JsonReader
reader) +75
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader
reader, Type objectType, JsonContract contract, JsonProperty member,
Object existingValue) +48
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader
reader, Type objectType, JsonContract contract, JsonProperty member,
Object existingValue) +86
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IWrappedCollection
wrappedList, JsonReader reader, String reference, JsonArrayContract
contract) +635
Newtonsoft.Json.Serialization.<>c_DisplayClass1.<CreateAndPopulateList>b_0(IList
l, Boolean isTemporaryListReference) +124
Newtonsoft.Json.Utilities.CollectionUtils.CreateAndPopulateList(Type
listType, Action2 populateList) +546
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateAndPopulateList(JsonReader
reader, String reference, JsonArrayContract contract) +101
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader
reader, Type objectType, JsonContract contract, JsonProperty member,
Object existingValue, String reference) +62
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader
reader, Type objectType, JsonContract contract, JsonProperty member,
Object existingValue) +113
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueNonProperty(JsonReader
reader, Type objectType, JsonContract contract, JsonConverter
converter) +118
Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader
reader, Type objectType) +125
Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader,
Type objectType) +311
Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type,
JsonSerializerSettings settings) +107
Newtonsoft.Json.JsonConvert.DeserializeObject(String value,
JsonSerializerSettings settings) +66
SignalR.JsonNetSerializer.Parse(String json) +57
SignalR.Hubs.HubDispatcher.CreateConnection(String connectionId,
IEnumerable1 groups, IRequest request) +140
SignalR.PersistentConnection.ProcessRequestAsync(HostContext context)
+227 SignalR.Hubs.HubDispatcher.ProcessRequestAsync(HostContext context) +120
SignalR.Hosting.AspNet.AspNetHandler.ProcessRequestAsync(HttpContextBase
context) +463
SignalR.Hosting.AspNet.HttpTaskAsyncHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext
context, AsyncCallback cb, Object extraData) +68
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+301 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
EDIT2:
One more note - from the page that runs without any errors, requested url looks like this
localhost:24634/signalr/signalr/connect?transport=foreverFrame&connectionId=98e6d5b3-b164-4013-92c2-418aa6254f9e&connectionData=%5B%7B%22name%22%3A%22notifier%22%7D%5D&tid=7&frameId=1
and the failing request url looks like this
localhost:24634/signalr/signalr/connect?transport=foreverFrame&connectionId=9b398750-99d6-4188-88b5-b41ad9eb82d5&connectionData=[{"name":"notifier"}]&tid=1&frameId=1
As you may notice, the ways connectionData query string parameter is defined in urls are different, in particular, for the first url, connectionData has been url encoded the query string value, and the second query string parameter has been html encoded. I've looked into request headers, failing request Content-Type is text/html, and the second request's Content-Type: application/json.
EDIT 3:
I've found where connectionData get's parsed, in jquery.signalR-0.5.3.js file, here's code that actually encodes connectionData value
if (connection.data) {
qs += "&connectionData=" + window.escape(connection.data);
}
as you can see, window.escape() is responsible for encoding connectionData, but, if I debug this code, I can see that window.escape(connection.data) indeed html encodes connection.data instead of url encoding. But this is happening only on one page, on anothers, it works as expected.
To sum up, the problem turned out to be that window.escape was overridden by a third party JS library. This caused window.escape to behave differently than "normal" causing SignalR to fail as a side-effect.
So basically - when these "weird" issues occur - check if you have included libraries that "interfere" and make sure to use proper namespacing ( e.g. using the module pattern ) to avoid this issue.
BUG
I do not know if this could help, but I had the error "unexpected end when deserializing object message c #", when I was trying to deserialize my json.
It happened to me sometimes, sometimes not. I do not know what it depends on.
My json was like that:
https://api.myjson.com/bins/l83m8
Debugging the Xamarin App on visual studio 2019 gives me the following:
var content = await _client.GetStringAsync(Connection.URL);
invitaciones = JsonConvert.DeserializeObject<RootObject>(content);
The variable "content" sometimes gives me https://textsaver.flap.tv/lists/2lss and sometimes gives me https://textsaver.flap.tv/lists/2lsu.
If you look very carefully, you are gonna release that both are different, only because, the first one is missing a } just in the end.
If you deserialize both with https://www.unserialize.me/ tool, and then validate the result on https://jsonformatter.curiousconcept.com/ (default options), you are gonna see that the first one isn't valid, and the second is valid.
Solution:
Add a validation: if the string content (json) don't ends with }, put a } on the end.I know it's pretty silly, but solves my problem.
var content = await _client.GetStringAsync(Connection.URL);
if (!content.EndsWith("}"))
content = content + "}";
invitaciones = JsonConvert.DeserializeObject<RootObject>(content);
Packages: Newtonsoft.Json 12.0.2, Xamarin.Forms 3.6.0.344457 .

Is it possible to assign a default value to web service request input parameter

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..!!

Circular reference in web service

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

Resources