" /> PSDK error on using Tostring() method on eventringing event object - Genesys CTI User Forum

Author Topic: PSDK error on using Tostring() method on eventringing event object  (Read 2976 times)

Offline vino.sd08

  • Newbie
  • *
  • Posts: 3
  • Karma: 0
Advertisement
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.

Offline bhuvanesh

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: PSDK error on using Tostring() method on eventringing event object
« Reply #1 on: December 16, 2016, 10:56:58 AM »
I am also having same issue

Offline daniel_san

  • Jr. Member
  • **
  • Posts: 84
  • Karma: 1
Re: PSDK error on using Tostring() method on eventringing event object
« Reply #2 on: December 16, 2016, 11:46:13 AM »
Can you past the code wich is launching this execption?

Offline bhuvanesh

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: PSDK error on using Tostring() method on eventringing event object
« Reply #3 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]

Offline daniel_san

  • Jr. Member
  • **
  • Posts: 84
  • Karma: 1
Re: PSDK error on using Tostring() method on eventringing event object
« Reply #4 on: December 16, 2016, 01:13:43 PM »
Try

generalException.Message.ToString()

instead

generalException.ToString()

Offline bhuvanesh

  • Newbie
  • *
  • Posts: 13
  • Karma: 0
Re: PSDK error on using Tostring() method on eventringing event object
« Reply #5 on: December 19, 2016, 09:48:08 AM »
Sure but problem is not in catch block

Offline Kubig

  • Hero Member
  • *****
  • Posts: 2755
  • Karma: 44
Re: PSDK error on using Tostring() method on eventringing event object
« Reply #6 on: December 19, 2016, 09:53:13 AM »
General advice : Do not use ToString() method in .Net

Offline daniel_san

  • Jr. Member
  • **
  • Posts: 84
  • Karma: 1
Re: PSDK error on using Tostring() method on eventringing event object
« Reply #7 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.