ScaleValue分配无效

时间:2017-04-27 17:42:57

标签: c# docusignapi

在最新的DocuSign SDK中,我注意到成员“ScaleValue”类型已从string更改为Number。 我以前的代码曾经是:

SignHere signHere = new SignHere
{
    DocumentId = ....,
    ScaleValue = "0.6",
    XPosition = "150",
    YPosition = "150",
};

我已将其改编为以下内容:

SignHere signHere = new SignHere
{
    DocumentId = ....,
    ScaleValue = new Number { OriginalValue = "0.6" },
    XPosition = "150",
    YPosition = "150",
};

但是,这似乎是提交我的包进行创建时出现问题的原因。以下是我收到的错误消息:

Error calling CreateEnvelope: {
  "errorCode": "INVALID_REQUEST_BODY",
  "message": "The request body is missing or improperly formatted. Cannot deserialize the current JSON object (e.g. {\"name\":\"value\"}) into type 'System.Nullable`1[System.Single]' because the type requires a JSON primitive value (e.g. string, number, boolean, null) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON primitive value (e.g. string, number, boolean, null) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.\r\nPath 'recipients.signers[0].tabs.signHereTabs[0].scaleValue.originalValue', line 1, position 28730."
}

1 个答案:

答案 0 :(得分:1)

这看起来是Docusign.eSign Nuget Package的版本2.1.42.1.3的错误

好消息是它已在SDK here中得到修复。

在发布新的nuget包之前,您可以回退到Nuget包的旧版本(2.1.2)或自己构建SDK

Install-Package DocuSign.eSign.dll -Version 2.1.2

另请参阅此answer了解详情。