Announcement

Collapse
No announcement yet.

JsonReaderException when trying to read string from PlugExtraData

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    JsonReaderException when trying to read string from PlugExtraData

    With the code from this thread, I get a JsonReaderException when trying to retrieve a Named PlugExtra Property:
    Code:
    HsDevice hsDevice = null;
    foreach (var devRef in HomeSeerSystem.GetRefsByInterface(Id, true))
    {
        var device = HomeSeerSystem.GetDeviceWithFeaturesByRef(devRef);
        try
        {
    [COLOR=#FF0000][B]// CRASHES HERE[/B][/COLOR]
            if (e.NodeId == device.PlugExtraData.GetNamed<string>("id"))
            {
                hsDevice = device;
                break;
            }
        }
        catch (KeyNotFoundException)
        {
            //TODO: proper exception logging
        }
    }
    Click image for larger version  Name:	exception.png Views:	0 Size:	144.1 KB ID:	1355172

    Help would be very welcome over here. Trying to add features AFTER the device has been created (features become known quite a few seconds after the device is created).

    #2
    Workaround:
    Code:
    device.PlugExtraData["id"]

    Comment

    Working...
    X