Open
Description
Context
- **OS, version, SKU and CPU architecture used:Windows 10 Desktop x64
- **Application's .NET Target Framework : .NET8.0-RC2
- **Device: Laptop
- **SDK version used: 2.0.0-preview007
- IoT Edge version: 1.4.23
Description of the issue
Cannot invoke direct methods with payload in IotEdge devices.
Code sample exhibiting the issue
var serviceClient = new IotHubServiceClient("HostName=***");
string json =
"{\"schemaVersion\": \"1.0\",\"items\": [{\"id\": \"module\",\"filter\": {\"tail\": 3,\"since\": \"10m\"}}],\"encoding\": \"none\",\"contentType\": \"text\"}";
DirectMethodServiceRequest request = new("GetModuleLogs")
{
Payload = Encoding.UTF8.GetBytes(json)
};
var result = await serviceClient.DirectMethods.InvokeAsync("deviceId", "$edgeAgent", request);
Console log of the issue
{"message":"Error parsing command payload because of error - Error converting value "eyJzY2hlbWFWZXJzaW9uIjogIjEuMCIsIml0ZW1zIjogW3siaWQiOiAiaW90ZWRnZWdhdGV3YXkiLCJmaWx0ZXIiOiB7InRhaWwiOiAzLCJzaW5jZSI6ICIxMG0ifX1dLCJlbmNvZGluZyI6ICJub25lIiwiY29udGVudFR5cGUiOiAidGV4dCJ9" to type 'Microsoft.Azure.Devices.Edge.Agent.Core.Requests.ModuleLogsRequest'. Path '', line 1, position 186."}