1
votes

I Use .NET 4.0 and using a class with ChannelSink, ServerSink and ClientSink. The program was created to deliver messages between 2 interfaces (remote and local). I have 4 kinds of messages.

3 of the Messages works fine (they dont contain DateTime data members).

I got a problem: In a specific kind of message (which DOES contain DateTime data members), whenever I try to deliver the message, the sink tries to deserialize the message - but fail with the following message:

ERROR:

Managed Debugging Assistant 'DateTimeInvalidLocalFormat' has detected a problem in 'C:\Program Files\IIS Express\iisexpress.exe'.

Additional information: A UTC DateTime is being converted to text in a format that is only correct for local times. This can happen when calling DateTime.ToString using the 'z' format specifier, which will include a local time zone offset in the output. In that case, either use the 'Z' format specifier, which designates a UTC time, or use the 'o' format string, which is the recommended way to persist a DateTime in text. This can also occur when passing a DateTime to be serialized by XmlConvert or DataSet. If using XmlConvert.ToString, pass in XmlDateTimeSerializationMode.RoundtripKind to serialize correctly. If using DataSet, set the DateTimeMode on the DataColumn object to DataSetDateTime.Utc.

Whenever I disable the Managed Debugging Assistant I receive this message:

System.Security.SecurityException: Request failed

Server stack trace: at System.Array.InternalCreate(Void* elementType, Int32 rank, Int32* pLengths, Int32*

pLowerBounds) at System.Array.CreateInstance(Type elementType, Int32 Length) at System.Runtime.Serialization.Formatters.Soap.ObjectReader.ParseArray(ParseRecord pr) at System.Runtime.Serialization.Formatters.Soap.ObjectReader.ParseObject(ParseRecord pr) at System.Runtime.Serialization.Formatters.Soap.ObjectReader.Parse(ParseRecord pr) System.Runtime.Serialization.Formatters.Soap.SoapHandler.StartChildren() at System.Runtime.Serialization.Formatters.Soap.SoapParser.ParseXML() System.Runtime.Serialization.Formatters.Soap.ObjectReader.Run() System.Runtime.Serialization.Formatters.Soap.ObjectReader.Deserialize(HeaderHandler, ISerParser

serParser) System.Runtime.Serialization.Formatters.Soap.SoapFormatter.Deserialize(Stream serializationStream,

HeaderHandler handler) at System.Runtime.Remoting.Channels.CoreChannel.DeserializeSoapRequestMessage(Stream

inputStream, Header[] h, Boolean bStrictBinding) at System.Runtime.Remoting.Chanels.SoapServerFormatterSink.ProcessMessage

(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream

requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)

Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage (IMessage reqMsg, IMessage

retMSg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) . . (some of my files) . The action that failed was: Demand The type of the first permission that failed was: System.Security.PermissionSet The demand was for:

The only permitted permissions were:

The method that caused that failure was: System.Runtime.Remoting.Channels.ServerProcessing ProcessMessage(System.Runtime.Remoting.Channels.IServerChannelSinkStack, System.Runtime.Remoting.Messaging.IMessage, System.Runtime.Remoting.Channels.ITransportHeaders, System.IO.Stream, System.Runtime.Remoting.Messaging.IMessage ByRef, System.Runtime.Remoting.Channels.ITransportHeaders ByRef, System.IO.Stream ByRef)

Which I guess has nothing to do with it, because the other 3 kinds of Messages work perfectly. Moreover, whenever I call the sink without delivering the message (just for a stub method) - it works. My question is, what to do? I try to add to the [XmlAttribute] tag the DataType="date" - but it didnt work.

help will be appreciated.

1
Did you get anywhere with this issue? I'm facing a similar problem calling into a Java webservice with .net code, and the issue is around converting a datetime into a UTC datetime.Carl Sargunar

1 Answers

0
votes

In my case, I was using a StringBuilder object to store an XML file. the AppendLine property seemed to have issues parsing through the date mask. After some digging, I found this article that suggests updating the mask https://msdn.microsoft.com/en-us/library/ms172213(v=vs.110).aspx

The only problem is that this XML file was meant to have that specific date format (mask), so we ended up ignoring the issue. This didn't seem to be an issue in our "release" build, but whenever we tried to "debug", it would show up. We just clicked "Continue" to force it and it went through.

If you are able to update the mask, that may fix your issue, if you aren't able, then try your code in "release" mode, with no breakpoints and see if it hangs.