Professional OPC
Development Tools

logos

Help with code crashing

More
09 Nov 2016 14:24 #4551 by support
Replied by support on topic Help with code crashing
Good observation with the threading. It *can* be a threading issue. I have checked the source code. In version 5.35 the access to _parseFormatCache isn't guarded by a critical section. In version 5.40 (the current version as of today), it is guarded.

This said, it appears that your code (indirectly - through the Newtonsoft.Json... code) is attempting to do some kind of JSON serialization/deserialization of our objects - and they have never been specifically designed for that or tested with that; it is possible that more issues can show up.

Please Log in or Create an account to join the conversation.

More
09 Nov 2016 13:54 #4550 by giles
Replied by giles on topic Help with code crashing
trying to decompile I get to

if (!this._parseFormatCache.TryGetValue(format, out formatElements))
{
formatElements = this.FormatParser.Parse(format);
this._parseFormatCache.AddNew<string, IEnumerable<IEnumerable<FormatElement>>>(format, formatElements);
}

is this some kind of threading issue?

Please Log in or Create an account to join the conversation.

More
09 Nov 2016 11:24 #4549 by giles
Hi - I'm looking at a bug. It seems to happen when we have been monitoring an item for a long time (over the weekend) Thereafter it just keeps coming back until I restart the application (ASP.NET App)

just sending stack trace and error message for now just in case it is somethiung you recognise..

at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IDictionaryExtension.AddWithContract[TKey,TValue](IDictionary`2 dictionary, TKey key, TValue value)
at OpcLabs.BaseLib.Collections.Generic.Extensions.IDictionaryExtension.AddNew[TKey,TValue](IDictionary`2 dictionary, TKey key, TValue value)
at OpcLabs.BaseLib.Formatting.CommonFormatter`1.ParseFormat(String format, IFormatProvider formatProvider)
at OpcLabs.BaseLib.Formatting.CommonFormatter`1.Format(String format, TArg arg, IFormatProvider formatProvider)
at System.ComponentModel.TypeConverter.ConvertTo(ITypeDescriptorContext context, CultureInfo culture, Object value, Type destinationType)
at System.ComponentModel.TypeConverter.ConvertToString(ITypeDescriptorContext context, CultureInfo culture, Object value)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.TryConvertToString(Object value, Type type, String& s)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeString(JsonWriter writer, Object value, JsonStringContract contract)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeList(JsonWriter writer, IEnumerable values, JsonArrayContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)
at Microsoft.AspNet.SignalR.Infrastructure.Connection.SerializeMessageValue(Object value)
at Microsoft.AspNet.SignalR.Infrastructure.Connection.GetMessageBuffer(Object value)
at Microsoft.AspNet.SignalR.Infrastructure.Connection.Send(ConnectionMessage message)
at Microsoft.AspNet.SignalR.Hubs.HubDispatcher.Outgoing(IHubOutgoingInvokerContext context)
at Microsoft.AspNet.SignalR.Hubs.HubPipelineModule.<>c__DisplayClass1b.<BuildOutgoing>b__19(IHubOutgoingInvokerContext context)
at Microsoft.AspNet.SignalR.Hubs.HubPipeline.Send(IHubOutgoingInvokerContext context)
at Microsoft.AspNet.SignalR.Hubs.SignalProxy.TryInvokeMember(InvokeMemberBinder binder, Object[] args, Object& result)
at CallSite.Target(Closure , CallSite , Object , Item`1 )
at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1)
at SiGyl.Startup.<>c__DisplayClass1_0.<<PreStart>b__1>d.MoveNext() in C:\\Temp\\batch-and-scada\\Scada\\App_Start\\Startup.cs:line 199"

"An item with the same key has already been added."

product version of opclabs.baselib.dll is 5.35.442.1

Please Log in or Create an account to join the conversation.

Moderators: support
Time to create page: 0.173 seconds

      

 Recommend this on Google