Gcobani Mkontwana

Gcobani Mkontwana

  • 1k
  • 1.4k
  • 166.7k

System.ArgumentNullException: 'Value cannot be null. Paramet

Sep 9 2019 7:51 AM
Hi Team
 
I have this error System.ArgumentNullException:Value cannot be null, Parameter name:connectionString.
 
 
private static string s_deviceConnectionString = Environment.GetEnvironmentVariable("IOTHUB_DEVICE-CONN_STRING"); 
 
launchSetting.json
 
{
"profiles": {
"TwinDeviceApplication": {
"commandName": "eNtsaIOTHubs",
"environmentVariables": {
"IOTHUB_DEVICE-CONN_STRING": "HostName=eNtsaIOTHubs.azure-devices.net;DeviceId=eNtsaDeviceId;SharedAccessKey=***
}
}
}
}
 
DeviceClient deviceClient = DeviceClient.CreateFromConnectionString(s_deviceClientConnectionString, s_ transportType);
 
 What am i missing? Isnt my deviceClient object has to launch this setting.json file to createConnectionString? Please assist me, thanks.

Answers (4)