Genesys CTI User Forum

Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: vino.sd08 on October 14, 2016, 12:28:46 PM

Title: PSDK error on using Tostring() method on eventringing event object
Post by: vino.sd08 on October 14, 2016, 12:28:46 PM
Hi all, i think it might be a PSDK error for .Net.
We are getting below error while printing the EventRinging Event by .Tostring().
We tried this with java based application and dotnet  based application at the same time with same agent login id and place. In java it working fine.

actually it printing all attributes but when tries to get data from Userdata it shows the error

[quote]can't process DataSupport class cause exception: [ArgumentException] An entry with the same key already exists.
at:    at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
  at System.Collections.Generic.TreeSet`1.AddIfNotPresent(T item)
  at System.Collections.Generic.SortedDictionary`2.Add(TKey key, TValue value)
  at Genesyslab.Platform.Commons.Collections.Internal.OrderedHashmapImpl.GetAllKeys()
  at Genesyslab.Platform.Commons.Collections.Internal.OrderedHashmapImpl.OrderedHashmapImplEnumerator..ctor(OrderedHashmapImpl hm)
  at Genesyslab.Platform.Commons.Collections.Internal.OrderedHashmapImpl.GetEnumerator()
  at Genesyslab.Platform.Commons.Collections.Filters.KeyValueFilterSet.FilterList[T](StringBuilder buf, KeyValueCollectionBase`1 col, Int32 indent)
  at Genesyslab.Platform.Commons.Protocols.Internal.KeyValueCodec.Genesyslab.Platform.Commons.Protocols.Internal.IPrintable.AppendLogValue(StringBuilder buf, Object customTypeObject, Int32 ident, Boolean truncate, Boolean hide)
  at Genesyslab.Platform.Commons.Protocols.Internal.ToStringHelper.AppendLogValue(StringBuilder buffer, IDataSupport data, Int32 indent, Boolean hide, Boolean truncate)[/quote]

??? ??? ??? ???

Any body out there can help us in this.
Title: Re: PSDK error on using Tostring() method on eventringing event object
Post by: bhuvanesh on December 16, 2016, 10:56:58 AM
I am also having same issue
Title: Re: PSDK error on using Tostring() method on eventringing event object
Post by: daniel_san on December 16, 2016, 11:46:13 AM
Can you past the code wich is launching this execption?
Title: Re: PSDK error on using Tostring() method on eventringing event object
Post by: bhuvanesh on December 16, 2016, 11:56:12 AM
[code]  public void ReceiveCalls(IMessage events)
        {
if (events != null)
                    {
                        try
                        {
                            this.logger.Info("ReceiveCalls: Voice Event Received : " + events.ToString());
                        }
                        catch (Exception generalException)
            {
                this.logger.Error(generalException.ToString());
            }
}
}[/code]
Title: Re: PSDK error on using Tostring() method on eventringing event object
Post by: daniel_san on December 16, 2016, 01:13:43 PM
Try

generalException.Message.ToString()

instead

generalException.ToString()
Title: Re: PSDK error on using Tostring() method on eventringing event object
Post by: bhuvanesh on December 19, 2016, 09:48:08 AM
Sure but problem is not in catch block
Title: Re: PSDK error on using Tostring() method on eventringing event object
Post by: Kubig on December 19, 2016, 09:53:13 AM
General advice : Do not use ToString() method in .Net
Title: Re: PSDK error on using Tostring() method on eventringing event object
Post by: daniel_san on December 19, 2016, 10:23:27 AM
[quote author=bhuvanesh link=topic=9898.msg45487#msg45487 date=1482140888]
Sure but problem is not in catch block
[/quote]

I had this problem too, and it was because i tried to parse tostring directly generalException. Instead of that you have to parse the Message or InnerException and you will see the error that is launching your catch block. Now you are having exception inside the cath.