Giter VIP home page Giter VIP logo

azure-iot-samples-csharp's Introduction

azure-iot-samples-csharp's People

Contributors

abhipsamisra avatar aftab-hassan avatar andyk-ms avatar azabbasi avatar baanders avatar bikamani avatar brycewang-microsoft avatar cipop avatar dependabot[bot] avatar dominicbetts avatar drwill-ms avatar ewertons avatar jamdavi avatar jenoola avatar kgremban avatar massand avatar microsoftopensource avatar ngastelum-ms avatar patilsnr avatar prmathur-microsoft avatar rezasherafat avatar rido-min avatar rloutlaw avatar robinsh avatar supernova-eng avatar timtay-microsoft avatar v-steveadams avatar vinagesh avatar wickste avatar yzhong94 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure-iot-samples-csharp's Issues

TargetFramework mismatch between EnvironmentalSensor sample and tutorial

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Follow this tutorial on a clean machine: https://docs.microsoft.com/en-us/azure/iot-pnp/quickstart-connect-pnp-device-csharp

Result: sample won't compile because .NET Core 2.2 is not installed

The issue is because EnvironmentalSensorSample.csproj sets TargetFramework to netcoreapp2.2, but the tutorial instructs to install .NET Core 3.0. Need to resolve this mismatch one way or another.

Expected/desired behavior

I can follow the tutorial on a clean machine and end up with a working sample

For that the TargetFramework and the instructions need to match up. Unless there is a strong reason to do something else, I would suggest to stick with 2.1 as it's used on all other samples.

OS and Version?

Windows 10

Direct method for DM Client

Hi
I wire direct method for dm client to get install app in device but i get below output
Response status: 400, payload:

Response status: {"code":-1,"context":"GetInstalledUwpAppsCmd","message":"in Json::Value::find(key, end, found): requires objectValue or nullValue","parameters":{},"subsystem":"unknown"}
Press Enter to exit.

From portal i give
GetInstalledUwpAppsCmd
{
"__meta": {
"serviceInterfaceVersion": "1.0.0"
}
}
and the result is give me list of install application

my c# code is
private static async Task InvokeMethod()
{

        var methodInvocation = new CloudToDeviceMethod("GetInstalledUwpAppsCmd") { ResponseTimeout = TimeSpan.FromSeconds(30), ConnectionTimeout = TimeSpan.FromSeconds(30) };
                            
       string paylod = JsonConvert.SerializeObject("{__meta:{serviceInterfaceVersion:1.0.0}}");

        methodInvocation.SetPayloadJson(paylod);

        // Invoke the direct method asynchronously and get the response from the simulated device.
        var response = await s_serviceClient.InvokeDeviceMethodAsync("Station2", methodInvocation);


        Console.WriteLine("\n Response status: {0}, payload:", response.Status);
        Console.WriteLine("\n Response status: {0}", response.GetPayloadAsJson());

       // Console.WriteLine(response.GetPayloadAsJson());
       }

please guide me 

nainesh

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

C runtime missing from C#-based TPM sample

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [x] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

On a new Windows installation (VM or device), clone the repo, install .NET Core 2.2 SDK, and then attempt to run Simulator.exe (from any of 3 folders) and you'll receive an error that vcruntime140.dll can't be found.

Any log messages given by the failure

Expected/desired behavior

The simulator to run without issues.

OS and Version?

Windows 10 Pro

Versions

Mention any other details that might be useful

Obviously, copying the runtime to the same folder as the EXE avoids the problem.


Thanks! We'll be in touch soon.

Device local proxy exiting after first stream is terminated

Device local proxy exits after the first stream is terminated - desired behavior is that it must continue to listen on the port.

dotnet run %connectionstring% %IPAddress% 3389
Starting streaming
Done.
<<Process exited after first stream terminated>>

This is observed in mac 100% of the time but seems to happen in Windows as well from time to time

Device local proxy existing will null pointer exception

Error reported on behalf of the customer (TS.) trying a VNC scenario using the proxy setup.

  • Windows 10 LTSB
  • Usage: TightVNC process (5901)
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Azure.Devices.Client.Transport.AmqpTransportHandler.WaitForDeviceStreamRequestAsync(CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler.ExecuteWithErrorHandlingAsync[T](Func`1 asyncOperation)
   at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.<>c__DisplayClass25_0.<<WaitForDeviceStreamRequestAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.WaitForDeviceStreamRequestAsync(CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.InternalClient.WaitForDeviceStreamRequestAsync(CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.Samples.DeviceStreamSample.RunSampleAsync(Boolean acceptDeviceStreamingRequest) in C:\Temp\azure-iot-samples-csharp-master_stream\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-proxy\device\DeviceStreamSample.cs:line 61
   at Microsoft.Azure.Devices.Client.Samples.DeviceStreamSample.RunSampleAsync() in C:\Temp\azure-iot-samples-csharp-master_stream\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-proxy\device\DeviceStreamSample.cs:line 54
   at Microsoft.Azure.Devices.Client.Samples.Program.Main(String[] args) in C:\Temp\azure-iot-samples-csharp-master_stream\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-proxy\device\Program.cs:line 76

Device streams ServiceClient webproxy problem

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

here

Any log messages given by the failure

Some connections are not via webproxy.
Depending on the network configuration, an error occurs in the connection.

Expected/desired behavior

All connections(Http/WebSocket) are via webproxy.

OS and Version?

Windows 10

Versions

Microsoft.Azure.Devices 1.27.0-preview-002

Mention any other details that might be useful

Hi,
I'm trying a device stream proxy with a quick start program.

If both the device client and the service client are inside webproxy,
I was checking how it would work.

I set up a webproxy for the service client,
A connection error occurred at Microsoft.Azure.Devices.ServiceClient.CreateStreamAsync.

After setting webproxy to httpClientObjWithPerRequestTimeout of Microsoft.Azure.Devices.HttpClientHelper using reflection,
It worked correctly.
https://github.com/HiroyukiSakoh/DeviceStream/blob/7de77c0ba6b8e48000eb108e59285e65dbfbab83/device-streams-proxy/service/Program.cs#L80-L89

In Microsoft.Azure.Devices.HttpClientHelper,
Webproxy is set to httpClientObj, but it is not set to httpClientObjWithPerRequestTimeout.
Is that's bug?
https://github.com/Azure/azure-iot-sdk-csharp/blob/7f37ee1b4526bd6bcaf3b887b6ed7048777c10b4/common/src/service/HttpClientHelper.cs#L52-L73


Minimal steps to reproduce

here and here

Working with 64KB device stream frame limit

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ X ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Using the sample and attempting to send larger than 64KB of sample fails.

Use modified code below (originally from echo sample below).

using (ClientWebSocket webSocket = await DeviceStreamingCommon.GetStreamingClientAsync(streamRequest.Url, streamRequest.AuthorizationToken, cancellationTokenSource.Token).ConfigureAwait(false))
{
                WebSocketReceiveResult receiveResult = await webSocket.ReceiveAsync(new ArraySegment<byte>(buffer, 0, buffer.Length), cancellationTokenSource.Token).ConfigureAwait(false);
                Console.WriteLine("Received stream data: {0}", Encoding.UTF8.GetString(buffer, 0, receiveResult.Count));

// await webSocket.SendAsync(new ArraySegment<byte>(buffer, 0, receiveResult.Count), WebSocketMessageType.Binary, true, cancellationTokenSource.Token).ConfigureAwait(false);
// Console.WriteLine("Sent stream data: {0}", Encoding.UTF8.GetString(buffer, 0, receiveResult.Count));

                byte[] data = Encoding.UTF8.GetBytes(new String('X', 100000));
                await webSocket.SendAsync(new ArraySegment<byte>(data, 0, data.Count), WebSocketMessageType.Binary, true, cancellationTokenSource.Token).ConfigureAwait(false);
                Console.WriteLine("Sent stream data: {0}", Encoding.UTF8.GetString(data, 0, data.Count));

                await webSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, String.Empty, cancellationTokenSource.Token).ConfigureAwait(false);
}

Any log messages given by the failure

Expected/desired behavior

Customer can send large chunks of data over a device stream.

OS and Version?

All

Versions

Current

Mention any other details that might be useful

Customer: Axel Dittmann


Thanks! We'll be in touch soon.

Add Module connection strings in Jenkins

The module sample requires the IOTHUB_MODULE_CONN_STRING environment variable.
This item is tracking the addition of this variable to our internal Jenkins config and enabling CI execution of the module samples.

Is it possible to have multiple device streams in parallel?

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
- [x] question

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Versions

Mention any other details that might be useful

(On behalf of @HariharanAnantharaman)

This is regarding the Device Streaming proxy example in Quickstarts.

Would it be possible to stream two different processes from device?

For example can I stream SSH and other process at the same time (e.g VNC)? In our scenario, we would need to support remote desktop viewing along with intergated file transfer.
The web wrappers require SFTP server to be running in the end device and it enables remote desktop viewing and file transfer in a single window.
Currently I need to open up both SSH and VNC ports to achieve this. I would like to know if this would be possible with device streaming.


Thanks! We'll be in touch soon.

Device Streaming Echo C# Example, can't use AMQP with UWP

Please provide us with the following information:

This issue is for a: (mark with an x)

- [X] bug report -> please search issues before submitting
- [] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Sample is to do with Azure Device Streaming Echo sample C#
https://github.com/Azure-Samples/azure-iot-samples-csharp/tree/master/iot-hub/Quickstarts/device-streams-echo
After refactoring into a .NetCore library and attempt to port to UWP find that when run as UWP
It is found that the Device when run as a UWP app does not connect with AMQP but does with MQTT transport for the device. Note need to set up as per the Pull Request
Pull Request but run the UWP apps.

My repository: djaus2/AziothubDeviceStreaming
My detailed blog post on this issue

Any log messages given by the failure

Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.IotHubCommunicationException' in System.Private.CoreLib.dll
1 Error RunDeviceAsync(): Hub connection failure
Exception thrown: 'Microsoft.Azure.Devices.Common.Exceptions.DeviceNotFoundException' in System.Private.CoreLib.dll
2 Error RunSvcAsync(): Device not found

Expected/desired behaviour

Both apps to report message:

  • Sent by service, received by device, sent by device then received by service

OS and Version?

Windows10 Pro

Versions

1809

Mention any other details that might be useful

It is desirable for the Az IoT Hub Device Streaming to work with UWP. In my repository I have built a .Net Standard version of the library which works OK with the .Net Core apps but also only works with UWO when MQTT transport is used.


Thanks! We'll be in touch soon.

"Unauthorized" error connecting device to DPS with Enrollment Group


This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

  • Create Certificates

Follow this instruction to create required certificates. Below are all my steps

chmod 700 certGen.sh

# Create Root and Intermediate CA
./certGen.sh create_root_and_intermediate

# Upload Root CA to IoT DPS
az iot dps certificate create --dps-name michi-dps-20190723 --resource-group michi-dps-rg --name dps20190725root --path ./certs/azure-iot-test-only.root.ca.cert.pem

# Get ETAG
az iot dps certificate list --dps-name michi-dps-20190723 -g michi-dps-rg

# Generate Validation Code for Root CA
az iot dps certificate generate-verification-code -g michi-dps-rg --dps-name michi-dps-20190723 -n dps20190725root -e AAAAAAD6w0Y=

# Generate validation CA for Root CA
./certGen.sh create_verification_certificate <VALIDATION_CODE>

# Get latest ETAG again
az iot dps certificate list --dps-name michi-dps-20190723 -g michi-dps-rg

# Verify Root CA
az iot dps certificate verify --dps-name michi-dps-20190723 -g michi-dps-rg --name dps20190725root --path ./certs/verification-code.cert.pem -e AAAAAAD7qnQ==

# Verify was successful, this can be confirmed via portal as well.
  • Once verified, generate device certificate
# Create Device CA
rm ./certs/new-device.cert.pem
./certGen.sh create_device_certificate deviceid001
  • Create Enrollment Group via Portal

I use portal to create an Enrollment Group and choose the root certificate I uploaded. with "CA Certificate" as Certificate Type.

  • I download X509Sample code from here

  • Copy generated new-device.cert.pfx to project folder then

  • Modify Program.cs to read my pfx file

private static string s_certificateFileName = "new-device.cert.pfx";
  • According to project readme.md, I change my codes as below
#if false
    X509Certificate2 certificate = LoadProvisioningCertificate();
    using (var security = new SecurityProviderX509Certificate(certificate))
#else
    var myCertificate = new X509Certificate2(s_certificateFileName, "1234");
    var myChain = new X509Certificate2Collection();
    
    // Comment out the below line if you do not have a .p7b file (e.g. if you generated certificates using the tool below)
    //myChain.Import("myChain.p7b");
    
    using (var security = new SecurityProviderX509Certificate(myCertificate, myChain))
#endif
  • Compile and Run will result in "Unauthorized" error
dotnet restore
dotnet build
dotnet run

Any log messages given by the failure

RegistrationID = deviceid001
ProvisioningClient RegisterAsync . . .
Unhandled Exception: Microsoft.Azure.Devices.Provisioning.Client.ProvisioningTransportException: {"errorCode":401002,"trackingId":"4fdd0060-3b0a-42e7-9066-5badf3bef16c","message":"Unauthorized","timestampUtc":"2019-07-25T09:15:03.0636061Z"}
   at Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportHandlerAmqp.ValidateOutcome(Outcome outcome)
   at Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportHandlerAmqp.RegisterDeviceAsync(AmqpClientConnection client, String correlationId, DeviceRegistration deviceRegistration)
   at Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportHandlerAmqp.RegisterAsync(ProvisioningTransportRegisterMessage message, CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Provisioning.Client.Samples.ProvisioningDeviceClientSample.RunSampleAsync() in /home/azureuser/dps/x509sample/Common/ProvisioningDeviceClientSample.cs:line 31
   at Microsoft.Azure.Devices.Provisioning.Client.Samples.Program.Main(String[] args) in /home/azureuser/dps/x509sample/Program.cs:line 82

Expected/desired behavior

Should successfully provisioned

OS and Version?

  • OS, version, SKU and CPU architecture used: Ubuntu 18.04
  • Application's .NET Target Framework : netcoreapp2.2
  • Device: Desktop
  • SDK version used:
    Microsoft.Azure.Devices.Client - 1.20.3
    Microsoft.Azure.Devices.Provisioning.Client - 1.4.0
    Microsoft.Azure.Devices.Provisioning.Transport.Amqp - 1.1.9

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Is it possible to create Individual Enrollments programmatically?

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
- [x] question

Minimal steps to reproduce

Any log messages given by the failure

Expected/desired behavior

OS and Version?

Windows 10.

Versions

Microsoft.Azure.Devices.Provisioning.Client, Version=1.2.2.0

Mention any other details that might be useful

I followed instructions here https://github.com/Azure-Samples/azure-iot-samples-csharp/tree/master/provisioning/Samples/device/X509Sample (How to run the sample) and everything works fine for me. But I have question how to create Individual Enrollments using C# SDK.

Here is my example of how I'm creating the Individual Enrollments using certificate from example(this sample works well when I'm using C SDK in this guide https://docs.microsoft.com/en-us/azure/iot-dps/tutorial-set-up-device):

public static async Task SetRegistrationDataPassAsync()
        {
            Console.WriteLine("Starting SetRegistrationData");

            var certificate = new X509Certificate2(s_certificateFileName);

            Attestation attestation = X509Attestation.CreateFromClientCertificates(certificate);

            IndividualEnrollment individualEnrollment = new IndividualEnrollment(SampleRegistrationId, attestation);

            individualEnrollment.DeviceId = OptionalDeviceId;
            individualEnrollment.ProvisioningStatus = OptionalProvisioningStatus;

            Console.WriteLine("\nAdding new individualEnrollment...");
            var serviceClient = ProvisioningServiceClient.CreateFromConnectionString(ServiceConnectionString);

            IndividualEnrollment individualEnrollmentResult =
                await serviceClient.CreateOrUpdateIndividualEnrollmentAsync(individualEnrollment).ConfigureAwait(false);

            Console.WriteLine("\nIndividualEnrollment created with success.");
            Console.WriteLine(individualEnrollmentResult);
        }

And then when I run the sample I get the following issue:

Enter the PFX password for certificate.pfx:
***
Found certificate: 7189BE660A68FDFD3BDD14565F06C2F6C78553E8 CN=iothubx509device1, O=TEST, C=US; PrivateKey: True
Using certificate 7189BE660A68FDFD3BDD14565F06C2F6C78553E8 CN=iothubx509device1, O=TEST, C=US
RegistrationID = iothubx509device1
ProvisioningClient RegisterAsync . . .
Unhandled Exception: Microsoft.Azure.Devices.Provisioning.Client.ProvisioningTransportException: AMQP transport exception: service error.
Service Error: 401002 - Invalid certificate (TrackingID: 3ac7e085-1915-46d9-a8fc-da4fd4f3b3ca Time: 2019-03-07T11:58:02.9296675Z)

   at Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportHandlerAmqp.ValidateOutcome(Outcome outcome)
   at Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportHandlerAmqp.RegisterDeviceAsync(AmqpClientConnection client, String correlationId)
   at Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportHandlerAmqp.RegisterAsync(ProvisioningTransportRegisterMessage message, CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Provisioning.Client.Samples.ProvisioningDeviceClientSample.RunSampleAsync() in D:\Work\IoT\AzureDPSSDK\azure-iot-samples-csharp\provisioning\Samples\device\Common\ProvisioningDeviceClientSample.cs:line 31
   at Microsoft.Azure.Devices.Provisioning.Client.Samples.Program.Main(String[] args) in D:\Work\IoT\AzureDPSSDK\azure-iot-samples-csharp\provisioning\Samples\device\X509Sample\Program.cs:line 74 

So, it works ok when I'm following the instruction but when I try to automate step with creating Individual Enrollment I get the error.
What I'm doing wrong?

Also, can I do similar (Group enrolment) as in this article https://docs.microsoft.com/en-us/azure/iot-dps/tutorial-group-enrollments but using C# SDK?
As far as I understand I can do it using the following steps:

  • generate root certificate
  • add it to DPS
  • do verification
  • create new Group Enrollment
  • using my certificate in SDK sample
    Am I right?

Thanks in advance


Thanks! We'll be in touch soon.

OpenSslCryptographicException exception in device-streams-proxy sample

This issue is for a: (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

There are similar issues raised in Feb/2019. But I could not find an exact match.

Minimal steps to reproduce

I followed SSH/RDP using streams quickstart documentation at microsoft docs[1]

Any log messages given by the failure

An exception is thrown from: DeviceClient::WaitForDeviceStreamRequestAsync method.

xxxxxxxxxx@xxxxxxxx:~/azure-iot-samples-csharp-master/iot-hub/Quickstarts/device-streams-proxy/device$ dotnet run "HostName=xxxxxxxxx.azure-devices.net;DeviceId=xxxxxxx;SharedAccessKey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" localhost 22
Got an exception: System.AggregateException: One or more errors occurred. (error:2006D080:BIO routines:BIO_new_file:no such file) ---> Interop+Crypto+OpenSslCryptographicException: error:2006D080:BIO routines:BIO_new_file:no such file
at Interop.Crypto.CheckValidOpenSslHandle(SafeHandle handle)
at Internal.Cryptography.Pal.StorePal.LoadMachineStores()
at Internal.Cryptography.Pal.StorePal.FromSystemStore(String storeName, StoreLocation storeLocation, OpenFlags openFlags)
at System.Security.Cryptography.X509Certificates.X509Store.Open(OpenFlags flags)
at Internal.Cryptography.Pal.OpenSslX509ChainProcessor.FindCandidates(X509Certificate2 leaf, X509Certificate2Collection extraStore, HashSet1 downloaded, HashSet1 systemTrusted, TimeSpan& remainingDownloadTime)
at Internal.Cryptography.Pal.ChainPal.BuildChain(Boolean useMachineContext, ICertificatePal cert, X509Certificate2Collection extraStore, OidCollection applicationPolicy, OidCollection certificatePolicy, X509RevocationMode revocationMode, X509RevocationFlag revocationFlag, DateTime verificationTime, TimeSpan timeout)
at System.Security.Cryptography.X509Certificates.X509Chain.Build(X509Certificate2 certificate, Boolean throwOnException)
at System.Security.Cryptography.X509Certificates.X509Chain.Build(X509Certificate2 certificate)
at System.Net.Security.CertificateValidation.BuildChainAndVerifyProperties(X509Chain chain, X509Certificate2 remoteCertificate, Boolean checkCertName, String hostName)
at System.Net.Security.SecureChannel.VerifyRemoteCertificate(RemoteCertValidationCallback remoteCertValidationCallback, ProtocolToken& alertToken)
at System.Net.Security.SslState.CompleteHandshake(ProtocolToken& alertToken)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Security.SslState.ThrowIfExceptional()
at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
at System.Net.Security.SslStream.<>c.b__46_2(IAsyncResult iar)
at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization)
--- End of inner exception stack trace ---
at Microsoft.Azure.Devices.Client.Transport.Mqtt.MqttTransportHandler.OpenAsyncInternal(CancellationToken cancellationToken)
at Microsoft.Azure.Devices.Client.Transport.Mqtt.MqttTransportHandler.OpenAsync(CancellationToken cancellationToken)
at Microsoft.Azure.Devices.Client.Transport.ProtocolRoutingDelegatingHandler.OpenAsync(CancellationToken cancellationToken)
at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler.<>c__DisplayClass27_0.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler.ExecuteWithErrorHandlingAsync[T](Func1 asyncOperation) at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.<>c__DisplayClass41_0.<<OpenAsyncInternal>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.EnsureOpenedAsync(CancellationToken cancellationToken) at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.<>c__DisplayClass23_0.<<EnableStreamsAsync>b__0>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.EnableStreamsAsync(CancellationToken cancellationToken) at Microsoft.Azure.Devices.Client.InternalClient.EnableStreamAsync(CancellationToken cancellationToken) at Microsoft.Azure.Devices.Client.InternalClient.WaitForDeviceStreamRequestAsync(CancellationToken cancellationToken) at Microsoft.Azure.Devices.Client.Samples.DeviceStreamSample.RunSampleAsync(Boolean acceptDeviceStreamingRequest, CancellationTokenSource cancellationTokenSource) in /home/roots/src/try/azure-iot-samples-csharp-master/iot-hub/Quickstarts/device-streams-proxy/device/DeviceStreamSample.cs:line 70 at Microsoft.Azure.Devices.Client.Samples.DeviceStreamSample.RunSampleAsync(CancellationTokenSource cancellationTokenSource) in /home/roots/src/try/azure-iot-samples-csharp-master/iot-hub/Quickstarts/device-streams-proxy/device/DeviceStreamSample.cs:line 58 at Microsoft.Azure.Devices.Client.Transport.Mqtt.MqttIotHubAdapter.WriteMessageAsync(IChannelHandlerContext context, Object message, Func3 exceptionHandler)
---> (Inner Exception #0) Interop+Crypto+OpenSslCryptographicException: error:2006D080:BIO routines:BIO_new_file:no such file
at Interop.Crypto.CheckValidOpenSslHandle(SafeHandle handle)
at Internal.Cryptography.Pal.StorePal.LoadMachineStores()
at Internal.Cryptography.Pal.StorePal.FromSystemStore(String storeName, StoreLocation storeLocation, OpenFlags openFlags)
at System.Security.Cryptography.X509Certificates.X509Store.Open(OpenFlags flags)
at Internal.Cryptography.Pal.OpenSslX509ChainProcessor.FindCandidates(X509Certificate2 leaf, X509Certificate2Collection extraStore, HashSet1 downloaded, HashSet1 systemTrusted, TimeSpan& remainingDownloadTime)
at Internal.Cryptography.Pal.ChainPal.BuildChain(Boolean useMachineContext, ICertificatePal cert, X509Certificate2Collection extraStore, OidCollection applicationPolicy, OidCollection certificatePolicy, X509RevocationMode revocationMode, X509RevocationFlag revocationFlag, DateTime verificationTime, TimeSpan timeout)
at System.Security.Cryptography.X509Certificates.X509Chain.Build(X509Certificate2 certificate, Boolean throwOnException)
at System.Security.Cryptography.X509Certificates.X509Chain.Build(X509Certificate2 certificate)
at System.Net.Security.CertificateValidation.BuildChainAndVerifyProperties(X509Chain chain, X509Certificate2 remoteCertificate, Boolean checkCertName, String hostName)
at System.Net.Security.SecureChannel.VerifyRemoteCertificate(RemoteCertValidationCallback remoteCertValidationCallback, ProtocolToken& alertToken)
at System.Net.Security.SslState.CompleteHandshake(ProtocolToken& alertToken)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartReadFrame(Byte[] buffer, Int32 readBytes, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.PartialFrameCallback(AsyncProtocolRequest asyncRequest)
--- End of stack trace from previous location where exception was thrown ---
at System.Net.Security.SslState.ThrowIfExceptional()
at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
at System.Net.Security.SslStream.EndAuthenticateAsClient(IAsyncResult asyncResult)
at System.Net.Security.SslStream.<>c.b__46_2(IAsyncResult iar)
at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization)<---

Waiting again...

Expected/desired behavior

It should wait for a stream request from service side

OS and Version?

Ubuntu 18.04 LTS

Versions

dotnet core - 2.2.100
OpenSSL - OpenSSL 1.1.0g 2 Nov 2017

Mention any other details that might be useful

  • An F1 tier IoTHub was created in Central US region.
  • I used openssl s_client to verify if my machine had appropriate root certificates installed. openssl s_client -connect centralus002.centralus-001.streams.azure-devices.net:443 was successful with return code 0.
  • openssl s_client -connect xxxxxxxxxx.azure-devices.net:5671 was also successful.
  • This error is quickly and consistently reproducible. On running the sample on an Ubuntu 18.04 LTS and I feel you will hit this error.

Latest Version of Microsoft.Azure.Devices.Client not pulling in latest version of Amqp

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Just looking at the Echo Sample.
I just downloaded the current version on GitHub and rebuilt it
In device-streams-echo\device\bin\Debug\netcoreapp2.0\DeviceClientStreamingSample.deps.json there is a reference to Microsoft.Azure.Amqp Version 2.3.7:
"Microsoft.Azure.Amqp/2.3.7": {
"dependencies": {
"System.Net.WebSockets.Client": "4.3.2",
"System.Runtime.Serialization.Primitives": "4.3.0"
},
"runtime": {
"lib/netstandard1.3/Microsoft.Azure.Amqp.dll": {
"assemblyVersion": "2.3.0.0",
"fileVersion": "2.2.0.0"
}
}
},
In Nuget, the Device app has 1.29.0-preview- version of Microsoft.Azure.Devices.Client installed.
If I update to 1.29.0-preview-002 (the latest) the .json file still refers to the V 2.3.7

I note in Nuget in the Dependencies for Microsoft.Azure.Devices.Client V 1.29.0-preview-002 that it refers to Microsoft.Azure.Amqp (>= 2.4.1)
I would have thought that would mean that it would pull in the later version of Microsoft.Azure.Amqp.

I did a complete clean (bin and obj) of the project and removed the Microsoft.Azure.Devices.Client reference from the project
I then reinstalled Microsoft.Azure.Devices.Client V 1.29.0-preview-002 via Nuget:
Successfully installed 'DotNetty.Buffers 0.6.0' to DeviceClientStreamingSample
Successfully installed 'DotNetty.Codecs 0.6.0' to DeviceClientStreamingSample
Successfully installed 'DotNetty.Codecs.Mqtt 0.6.0' to DeviceClientStreamingSample
Successfully installed 'DotNetty.Common 0.6.0' to DeviceClientStreamingSample
Successfully installed 'DotNetty.Handlers 0.6.0' to DeviceClientStreamingSample
Successfully installed 'DotNetty.Transport 0.6.0' to DeviceClientStreamingSample
Successfully installed 'Microsoft.Azure.Amqp 2.3.7' to DeviceClientStreamingSample
Successfully installed 'Microsoft.Azure.Devices.Client 1.29.0-preview-002' to DeviceClientStreamingSample
Successfully installed 'Microsoft.Azure.Devices.Shared 1.25.0-preview-002' to DeviceClientStreamingSample

Clearly V 1.29.0-preview-002 is pulling in V 2.3.7 of Microsoft.Azure.Amqp

Any log messages given by the failure

This is the packages I have for my library, with Amqp version 2.4.2 manually added





If I donโ€™t assert Amqp version 2.4.2 I get 2.3.7

If I wind back to:




I get V 2.4.1 of Amqp
Successfully installed 'Microsoft.Azure.Amqp 2.4.1' to AzDeviceStreaming
Successfully installed 'Microsoft.Azure.Devices.Client 1.20.2' to AzDeviceStreaming

Then re-update back to





Successfully installed 'Microsoft.Azure.Amqp 2.3.7' to AzDeviceStreaming
Successfully installed 'Microsoft.Azure.Devices.Client 1.29.0-preview-002' to AzDeviceStreaming

So I have to again manually assert Amqp version 2.4.2

Expected/desired behavior

Expect to get V 2.42 of Microsoft.Azure.Amqp

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
Windows 10

Versions

1809

Mention any other details that might be useful

This came to notice when trying to use the SDK with UWP: Need this update for Amqp to be able to use AMQP with UWP, but not in other contexts. MQTT is OK.
I picked up this hint from: Azure/azure-iot-sdk-csharp#784


Thanks! We'll be in touch soon.

Warning CS1998 in ModelDefinitionInterface.cs should be addressed/surpressed

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Follow this tutorial on a clean machine: https://docs.microsoft.com/en-us/azure/iot-pnp/quickstart-connect-pnp-device-csharp

Result: sample code compilation shows warning CS1998.

Any log messages given by the failure

ModelDefinitionInterface.cs(32,67): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. [C:\temp\pnp\azure-iot-samples-csharp\digitaltwin\Samples\device\EnvironmentalSensorSample\EnvironmentalSensorSample.csproj]

Expected/desired behavior

We should not have warnings in our code sample as they need to demonstrate best practices to our customers

OS and Version?

Windows 10

ModuleClientMqttSample project needs NewtonSoft.JSON package update

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Run azure-iot-samples-csharp\build.ps1

Any log messages given by the failure

PS E:\Source\RefRepos\azure-iot-samples-csharp> E:\Source\RefRepos\azure-iot-samples-csharp\build.ps1

BUILD: --- IoTHub Module Samples Debug ---
Microsoft (R) Build Engine version 16.4.0+e901037fe for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

Build FAILED.

E:\Source\RefRepos\azure-iot-samples-csharp\iot-hub\Samples\module\MessageSample\ModuleClientMqttSample.csproj : error NU1605: Detected package downgrade: Newtonsoft.Json
from 12.0.3 to 11.0.2. Reference the package directly from the project to select a different version. [E:\Source\RefRepos\azure-iot-samples-csharp\iot-hub\Samples\modul
e\IoTHubModuleSamples.sln]

E:\Source\RefRepos\azure-iot-samples-csharp\iot-hub\Samples\module\MessageSample\ModuleClientMqttSample.csproj : error NU1605: ModuleClientMqttSample -> Microsoft.Azure.
Devices.Client 1.21.4 -> Newtonsoft.Json (>= 12.0.3) [E:\Source\RefRepos\azure-iot-samples-csharp\iot-hub\Samples\module\IoTHubModuleSamples.sln]

E:\Source\RefRepos\azure-iot-samples-csharp\iot-hub\Samples\module\MessageSample\ModuleClientMqttSample.csproj : error NU1605: ModuleClientMqttSample -> Newtonsoft.Json
(>= 11.0.2) [E:\Source\RefRepos\azure-iot-samples-csharp\iot-hub\Samples\module\IoTHubModuleSamples.sln]
0 Warning(s)
1 Error(s)

Time Elapsed 00:00:03.0513310
Build failed (Build failed: BUILD: --- IoTHub Module Samples Debug ---)

Expected/desired behavior

cloned git repository should compile with required tool sets installed

OS and Version?

Windows 10. (Version 10.0.18363 Build 18363)

Versions

Mention any other details that might be useful

User needs to upgrade to Newtonsoft.Json (12.0.3) in the project.


Thanks! We'll be in touch soon.

'DeviceStreamRequest' could not be found following Quickstart: Communicate to a device application in C# via IoT Hub device streams (preview)

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [x] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Go to https://docs.microsoft.com/en-us/azure/iot-hub/quickstart-device-streams-echo-csharp Follow the steps and "Download the Azure IoT C# samples" and extract the ZIP archive.
cd ./iot-hub/Quickstarts/device-streams-echo/service/
Build the application - dotnet build

Any log messages given by the failure

PS E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service> dotnet build                                                                                                                                          Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
C:\Program Files\dotnet\sdk\5.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
C:\Program Files\dotnet\sdk\5.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
  All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\5.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(29,17): error CS0246: The type or namespace name 'DeviceStreamRequest' could not be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(29,63): error CS0246: The type or namespace name 'DeviceStreamRequest' could not be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(33,17): error CS0246: The type or namespace name 'DeviceStreamResponse' could not be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(33,68): error CS1061: 'ServiceClient' does not contain a definition for 'CreateStreamAsync' and no accessible extension method 'CreateStreamAsync' accepting a first argument of type 'ServiceClient' could be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]

Build FAILED.

C:\Program Files\dotnet\sdk\5.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
C:\Program Files\dotnet\sdk\5.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
C:\Program Files\dotnet\sdk\5.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(29,17): error CS0246: The type or namespace name 'DeviceStreamRequest' could not be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(29,63): error CS0246: The type or namespace name 'DeviceStreamRequest' could not be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(33,17): error CS0246: The type or namespace name 'DeviceStreamResponse' could not be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(33,68): error CS1061: 'ServiceClient' does not contain a definition for 'CreateStreamAsync' and no accessible extension method 'CreateStreamAsync' accepting a first argument of type 'ServiceClient' could be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
    3 Warning(s)
    4 Error(s)

Time Elapsed 00:00:02.27 

Expected/desired behavior

The solution to build properly

OS and Version?

Microsoft Windows 10 Enterprise

Versions

dotnet --version 5.0.203

Mention any other details that might be useful

Checked this issue and followed the instructions. Updated the nuget package to Microsoft.Azure.Devices.Client 1.32.0-preview-001.
After doing that, there are other errors as below.

Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
C:\Program Files\dotnet\sdk\5.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
C:\Program Files\dotnet\sdk\5.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
  All projects are up-to-date for restore.
C:\Program Files\dotnet\sdk\5.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(31,21): error CS1739: The best overload for 'DeviceStreamRequest' does not have a parameter named 'streamName' [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(34,68): error CS1061: 'ServiceClient' does not contain a definition for 'CreateStreamAsync' and no accessible extension method 'CreateStreamAsync' accepting a first argument of type 'ServiceClient' could be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(36,108): error CS1061: 'DeviceStreamRequest' does not contain a definition for 'StreamName' and no accessible extension method 'StreamName' accepting a first argument of type 'DeviceStreamRequest' could be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(36,127): error CS1061: 'DeviceStreamResponse' does not contain a definition for 'IsAccepted' and no accessible extension method 'IsAccepted' accepting a first argument of type 'DeviceStreamResponse' could be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(38,28): error CS1061: 'DeviceStreamResponse' does not contain a definition for 'IsAccepted' and no accessible extension method 'IsAccepted' accepting a first argument of type 'DeviceStreamResponse' could be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(41,100): error CS1061: 'DeviceStreamResponse' does not contain a definition for 'Url' and no accessible extension method 'Url' accepting a first argument of type 'DeviceStreamResponse' could be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(41,112): error CS1061: 'DeviceStreamResponse' does not contain a definition for 'AuthorizationToken' and no accessible extension method 'AuthorizationToken' accepting a first argument of type 'DeviceStreamResponse' could be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]

Build FAILED.

C:\Program Files\dotnet\sdk\5.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
C:\Program Files\dotnet\sdk\5.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
C:\Program Files\dotnet\sdk\5.0.203\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.EolTargetFrameworks.targets(28,5): warning NETSDK1138: The target framework 'netcoreapp2.0' is out of support and will not receive security updates in the future. Please refer to https://aka.ms/dotnet-core-support for more information about the support policy. [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(31,21): error CS1739: The best overload for 'DeviceStreamRequest' does not have a parameter named 'streamName' [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(34,68): error CS1061: 'ServiceClient' does not contain a definition for 'CreateStreamAsync' and no accessible extension method 'CreateStreamAsync' accepting a first argument of type 'ServiceClient' could be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(36,108): error CS1061: 'DeviceStreamRequest' does not contain a definition for 'StreamName' and no accessible extension method 'StreamName' accepting a first argument of type 'DeviceStreamRequest' could be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(36,127): error CS1061: 'DeviceStreamResponse' does not contain a definition for 'IsAccepted' and no accessible extension method 'IsAccepted' accepting a first argument of type 'DeviceStreamResponse' could be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(38,28): error CS1061: 'DeviceStreamResponse' does not contain a definition for 'IsAccepted' and no accessible extension method 'IsAccepted' accepting a first argument of type 'DeviceStreamResponse' could be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(41,100): error CS1061: 'DeviceStreamResponse' does not contain a definition for 'Url' and no accessible extension method 'Url' accepting a first argument of type 'DeviceStreamResponse' could be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\DeviceStreamSample.cs(41,112): error CS1061: 'DeviceStreamResponse' does not contain a definition for 'AuthorizationToken' and no accessible extension method 'AuthorizationToken' accepting a first argument of type 'DeviceStreamResponse' could be found (are you missing a using directive or an assembly reference?) [E:\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\service\ServiceClientStreamingSample.csproj]
    3 Warning(s)
    7 Error(s)

Time Elapsed 00:00:01.15 

Unhandled exception using device streams sample with MQTT

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ X ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

run device streaming SSH samples with MQTT protocol

Any log messages given by the failure

Unhandled Exception: Microsoft.Azure.Devices.Client.Exceptions.IotHubCommunicationException: Transient network error occurred, please retry. ---> System.OperationCanceledException: The operation was canceled.
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at System.Threading.SemaphoreSlim.WaitUntilCountOrTimeoutAsync(TaskNode asyncWaiter, Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.Transport.Mqtt.MqttTransportHandler.WaitForDeviceStreamRequestAsync(CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler.ExecuteWithErrorHandlingAsync[T](Func`1 asyncOperation)
   --- End of inner exception stack trace ---
   at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler.ExecuteWithErrorHandlingAsync[T](Func`1 asyncOperation)
   at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.<>c__DisplayClass25_0.<<WaitForDeviceStreamRequestAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.WaitForDeviceStreamRequestAsync(CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.InternalClient.WaitForDeviceStreamRequestAsync(CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.Samples.DeviceStreamSample.RunSampleAsync(Boolean acceptDeviceStreamingRequest) in C:\Techolution\IOTPractise\MicrosoftIotSuiteSolutions\DeviceStreaming\azure-iot-samples-csharp-master\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-proxy\device\DeviceStreamSample.cs:line 61
   at Microsoft.Azure.Devices.Client.Samples.DeviceStreamSample.RunSampleAsync() in C:\Techolution\IOTPractise\MicrosoftIotSuiteSolutions\DeviceStreaming\azure-iot-samples-csharp-master\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-proxy\device\DeviceStreamSample.cs:line 54
   at Microsoft.Azure.Devices.Client.Samples.Program.Main(String[] args) in C:\Techolution\IOTPractise\MicrosoftIotSuiteSolutions\DeviceStreaming\azure-iot-samples-csharp-master\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-proxy\device\Program.cs:line 76

Expected/desired behavior

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

c# DPS X.509 Edge device sample for individual enrollment

Please provide us with the following information:

Hi,
I followed this sample for individual enrollment ( powershell .\GenerateTestCertificate.ps1 'certificate.cer' + 'certificate.pfx' generated and it work perfectly by creating a device in Iot hub!), but I didn't find DPS X.509 EDGE device auto-provisioning sample.

https://docs.microsoft.com/en-us/azure/iot-dps/quick-create-simulated-device-x509-csharp

I follow this to create my edge certificate:
https://github.com/Azure/azure-iot-sdk-c/blob/master/tools/CACertificates/CACertificateOverview.md

New-CACertsCertChain rsa
New-CACertsEdgeDevice edgedevice
Write-CACertsCertificatesForEdgeDevice edgedevice

Added the generated file ./certs/new-edge-device.cert.pem in Azure Management Enrollment>Individual Enrollments (is the right file to use????)

When I run it I get this error by using the generated edgedevice.pfx

Unhandled Exception: Microsoft.Azure.Devices.Provisioning.Client.ProvisioningTransportException: AMQP transport exception ---> Microsoft.Azure.Amqp.AmqpException: {"errorCode":401002,"trackingId":"a91b2f04d09c48fa85676d7a7723c292-G:0-TimeStamp:09/14/2018 12:50:42","message":"IotHubUnauthorizedAccess","timestampUtc":"2018-09-14T12:50:42.7172995Z"}

Any idea how to auto-provision a edge device with x509 certificate?

Question : Quickstarts - SimulatedDevice - Message should use UTF8 Encoding?

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

  • Open the Quickstarts - SimulatedDevice Project
  • Open the Program.cs file
  • Navigate to the SendDeviceToCloudMessagesAsync method
  • Navigate to the line that includes new Message(...)
  • Observe that the Encoding used is ASCII
  • Observe that the ContentEncoding used is "utf-8"

Any log messages given by the failure

Expected/desired behavior

Encoding used is UTF8

OS and Version?

All

Versions

All

Mention any other details that might be useful


Thanks! We'll be in touch soon.

FileNotFoundException in EnvironmentalSensor sample

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Follow this tutorial on a clean machine: https://docs.microsoft.com/en-us/azure/iot-pnp/quickstart-connect-pnp-device-csharp

Result: sample crashes at startup with FileNotFoundException in ModelDefinitionInterface.cs

The relative path in this line is incorrect, as the file is actually in the current directory when following the instructions from the tutorial:

environmentalSensorModelDefinition = File.ReadAllText("../../../EnvironmentalSensor.interface.json");

Expected/desired behavior

sample runs without error out of the box

OS and Version?

Windows 10

RegisterAsync causes exit with code 0 with no exceptions or errors logged when using x.509 certificate

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

I managed to get the IOT DeviceClient to Register and SendEvents using Shared Access Signature. I am now attempting to use a x.509 certificate. I have successfully created a certificate and created a verified enrollment group in for this using the IOT Central Device Connection Screen. Now when I try to use the certificate it loads correctly and succeeds up until the point of trying to Register. Regardless of what I try the program always exists with an code of 0 with no exceptions at all logged or shown when the following line exits:

Microsoft.Azure.Devices.Provisioning.Client.DeviceRegistrationResult result = await provClient.RegisterAsync();

Nothing is logged to the Event log or anywhere else, it simply exits. I have tried adjusting parameters and also using deviceClient.SendEventAsync directly and it also crashes immediately with an exit code of 0.

How can I go about diagnosing the issue? Finding any error that may be occuring? There is nothing being logged to the event log or anywhere else I can find.

Any log messages given by the failure

Nothing is logged, it simply exits with a code of 0.

'LogParser.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.11\System.Net.Security.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'LogParser.exe' (CoreCLR: clrhost): Loaded 'C:\Localwork\Current\RemoteAdmin\LogParser\LogParser\bin\Debug\netcoreapp3.1\Newtonsoft.Json.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'LogParser.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.11\System.Linq.Expressions.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'LogParser.exe' (CoreCLR: clrhost): Loaded 'C:\Localwork\Current\RemoteAdmin\LogParser\LogParser\bin\Debug\netcoreapp3.1\Microsoft.Azure.Amqp.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'LogParser.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.11\System.Net.WebSockets.Client.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'LogParser.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.11\System.Net.WebSockets.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'LogParser.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.11\System.Net.Http.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'LogParser.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.11\Microsoft.Win32.Primitives.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'LogParser.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.11\System.Security.Cryptography.Algorithms.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'LogParser.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.11\System.Collections.Concurrent.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'LogParser.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.11\System.Threading.Timer.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'LogParser.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.11\System.Net.Sockets.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'LogParser.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.11\System.Threading.Overlapped.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'LogParser.exe' (CoreCLR: clrhost): Loaded 'C:\Program Files\dotnet\shared\Microsoft.NETCore.App\3.1.11\System.Net.NameResolution.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The program '[23948] LogParser.exe' has exited with code 0 (0x0).

Expected/desired behavior

An exception should be thrown or it should succeed.

OS and Version?

Windows 10

Versions

Microsoft.Azure.Devices.Client 1.35.0
Microsoft.Azure.Devices.Provisioning.Transport.Amqp 1.13.4

Mention any other details that might be useful

It worked perfects with Shared Access Signatures and the x.509 certificate created loads correctly and is verified using the Device connection screen.

Device stream sample with HTTP goes in while loop

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x ] feature request
- [x ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

run device streaming SSH samples with HTTP (http1) protocol

Any log messages given by the failure

Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...
Waiting again...

Expected/desired behavior

It should work same as MQTT or AMQP protocol

OS and Version?

Windows 10

Versions

Windows 10 pro

Mention any other details that might be useful

We need device & service stream to work with HTTP protocol. Our all Azure IoT Hub agent is written for HTTP protocol by default. After program device stream program modification for http protocol, it goes in while loop of RunSampleAsync. I am sure it is happening because of cancellation token. Is device stream not possible with Http protocol?


Thanks! We'll be in touch soon.

Customer report - exception due to connection handshake termination

Received stream data: SSH-2.0-OpenSSH_for_Windows_7.7

Sent stream data: SSH-2.0-OpenSSH_for_Windows_7.7

Unhandled Exception: System.Net.WebSockets.WebSocketException: The remote party closed the WebSocket connection without completing the close handshake. ---> System.Net.WebSockets.WebSocketException: The remote party closed the WebSocket connection without completing the close handshake.
   at System.Net.WebSockets.ManagedWebSocket.ThrowIfEOFUnexpected(Boolean throwOnPrematureClosure)
   at System.Net.WebSockets.ManagedWebSocket.EnsureBufferContainsAsync(Int32 minimumRequiredBytes, CancellationToken cancellationToken, Boolean throwOnPrematureClosure)
   at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TWebSocketReceiveResultGetter,TWebSocketReceiveResult](Memory`1 payloadBuffer, CancellationToken cancellationToken, TWebSocketReceiveResultGetter resultGetter)
   --- End of inner exception stack trace ---
   at System.Net.WebSockets.ManagedWebSocket.ReceiveAsyncPrivate[TWebSocketReceiveResultGetter,TWebSocketReceiveResult](Memory`1 payloadBuffer, CancellationToken cancellationToken, TWebSocketReceiveResultGetter resultGetter)
   at System.Net.WebSockets.ManagedWebSocket.CloseAsyncPrivate(WebSocketCloseStatus closeStatus, String statusDescription, CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.Samples.DeviceStreamSample.RunSampleAsync(Boolean acceptDeviceStreamingRequest) in C:\Users\Marko\Downloads\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\device\DeviceStreamSample.cs:line 49
   at Microsoft.Azure.Devices.Client.Samples.DeviceStreamSample.RunSampleAsync() in C:\Users\Marko\Downloads\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\device\DeviceStreamSample.cs:line 24
   at Microsoft.Azure.Devices.Client.Samples.Program.Main(String[] args) in C:\Users\Marko\Downloads\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-echo\device\Program.cs:line 49

ProvisioningServiceClientException: Primary CA reference cannot be null or empty

This issue is for a:

- [x] bug report
- [ ] feature request
- [x] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

There isn't enough documentation available for using EnrollmentGroupSample. I am following this sample and I don't see that we require an x509 attestation anywhere when querying for enrollment groups but it still fails with a message - "Unhandled exception. Microsoft.Azure.Devices.Provisioning.Service.ProvisioningServiceClientException: Primary CA reference cannot be null or empty".

Any log messages given by the failure

Unhandled exception. Microsoft.Azure.Devices.Provisioning.Service.ProvisioningServiceClientException: Primary CA reference cannot be null or empty
   at Microsoft.Azure.Devices.Provisioning.Service.X509CAReferences..ctor(String primary, String secondary)
   at lambda_method10(Closure , Object[] )
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty 
member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty 
member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty 
member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ResolvePropertyAndCreatorValues(JsonObjectContract contract, JsonProperty containerProperty, JsonReader reader, Type objectType)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObjectUsingCreatorWithParameters(JsonReader reader, JsonObjectContract contract, JsonProperty containerProperty, ObjectConstructor`1 creator, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateNewObject(JsonReader reader, JsonObjectContract objectContract, JsonProperty containerMember, JsonProperty containerProperty, String id, Boolean& createdFromNonDefaultCreator)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty 
member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.PopulateList(IList list, JsonReader reader, JsonArrayContract contract, JsonProperty 
containerProperty, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateList(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, Object existingValue, String id)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateValueInternal(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
   at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)      
   at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType)
   at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)
   at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value)
   at Microsoft.Azure.Devices.Provisioning.Service.QueryResult..ctor(String typeString, String bodyString, String continuationToken)
   at Microsoft.Azure.Devices.Provisioning.Service.Query.NextAsync()
   at console_temp.Program.QueryEnrollmentGroupAsync() in E:\Source\console-temp\Program.cs:line 69
   at console_temp.Program.Main(String[] args) in E:\Source\console-temp\Program.cs:line 16
   at console_temp.Program.<Main>(String[] args)

Expected/desired behavior

Enrollment Groups should be returned without any error.

OS and Version?

Windows 10.

Versions

Provisioning SDK version - 1.17.2

Mention any other details that might be useful

Do we have to install the Root CA cert in the cert store?

Custom OpenSSL Engine sample

The flow is, essentially:

  1. Load the certificate into an X509Certificate2 object (ensures we have already loaded the OpenSSL libraries into the process, and have done the threading (and other initialization) setup we need (depends on which version we load)
  2. On .NET Core 3.0: Check that SafeEvpPKeyHandle.OpenSslVersion is equal to the version of OpenSSL that youโ€™re loading the engine into (OpenSSL_version_num() for 1.1+ and SSLeay() for 1.0.x)
    o On 2.1 this static property doesnโ€™t exist. Be careful that the versions are the same. 2.1 will bind to 1.0.x by preference, and 1.1.x as a fallback. (3.0 will bind to 1.1.x by preference, and 1.0.x as a fallback).
  3. Do engine and key loading stuff.
  4. Get the key object into an EVP_PKEY*
  5. Copy that pointer value into a SafeEvpPKeyHandle (e.g. new SafeEvpPKeyHandle(ptr, ownsHandle: true))
  6. X509Certificate2 certWithKey = cert.CopyWithPrivateKey(new RSAOpenSsl(keyHandle))

(Thanks @bartonjs!)

Problem while sending event with deviceclient

Hi,
The deviceclient s_deviceClient.SendEventAsync(message); giving CONNECT failed: RefusedNotAuthorized exception while sending event from SendEventAsync() method in Microsoft.Azure.Devices.Client DeviceClient class.The Sample code works fine in console Application
Sample Code Method

**private static async void SendMessages(string deviceID, string ReadingType, string Readingvalue)
{
Debug.WriteLine(deviceID + " " + ReadingType + " " + Readingvalue);
try
{
string s_connectionString = "''
s_deviceClient = DeviceClient.CreateFromConnectionString(s_connectionString, TransportType.Mqtt);
// Initial telemetry values

            // Create JSON message
            var telemetryDataPoint = new
            {
                EventType = ReadingType,
                EventValue = Readingvalue,
                EventOccurTime = DateTime.Now.ToString()

            };
            var messageString = JsonConvert.SerializeObject(telemetryDataPoint);
            var message = new Message(Encoding.ASCII.GetBytes(messageString));


            await s_deviceClient.OpenAsync();
            await s_deviceClient.SendEventAsync(message);
            Debug.WriteLine("Message ended");
            await s_deviceClient.CloseAsync();
            //Console.WriteLine("{0} > Sending message: {1}", DateTime.Now, messageString);

        }
        catch (Exception ex)
        {
            Debug.WriteLine(ex.Message);
        }
    }**

exceptions
Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.UnauthorizedException' in System.Private.CoreLib.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.UnauthorizedException' in Microsoft.Azure.Devices.Client.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.UnauthorizedException' in System.Private.CoreLib.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.UnauthorizedException' in System.Private.CoreLib.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.UnauthorizedException' in System.Private.CoreLib.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.IotHubClientException' in Microsoft.Azure.Devices.Client.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.IotHubClientException' in System.Private.CoreLib.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.UnauthorizedException' in System.Private.CoreLib.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.UnauthorizedException' in System.Private.CoreLib.dll The thread 0xe64 has exited with code 0 (0x0). Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.UnauthorizedException' in System.Private.CoreLib.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.UnauthorizedException' in System.Private.CoreLib.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.IotHubClientException' in Microsoft.Azure.Devices.Client.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.IotHubClientException' in System.Private.CoreLib.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.UnauthorizedException' in System.Private.CoreLib.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.UnauthorizedException' in System.Private.CoreLib.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.UnauthorizedException' in Microsoft.Azure.Devices.Client.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.UnauthorizedException' in System.Private.CoreLib.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.UnauthorizedException' in System.Private.CoreLib.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.UnauthorizedException' in Microsoft.Azure.Devices.Client.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.UnauthorizedException' in System.Private.CoreLib.dll Exception thrown: 'Microsoft.Azure.Devices.Client.Exceptions.UnauthorizedException' in System.Private.CoreLib.dll CONNECT failed: RefusedNotAuthorized

Giving Error While OpenAsync Method

Documentation and samples for AddConfigurationAsync

Copying over from Azure/azure-iot-sdk-csharp#649.

  • OS, version, SKU and CPU architecture used: Windows 10 x64
  • Application's .NET Target Framework : .Net core 2.0
  • Device: Laptop
  • SDK version used: Microsoft.Azure.Devices/1.17.0

Description of the issue:

Not enough details are provided for calling AddConfigurationAsync in regards to expected exceptions to catch. Details should be provided about failures in cases such as using the same configuration id, or an invalid target condition.

Code sample exhibiting the issue:

Samples

[Help] AMQP transport exception ---> System.TimeoutException

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

using Xamarin.Android
1. Generate the derived symmetric key for the provisioned device from the enrollment group symmetric key.
2. Create SecurityProviderSymmetricKey.
3. Create ProvisioningDeviceClient.
4. RegisterAsync() --> register done.
5. Time out.

Any log messages given by the failure

Unhandled Exception:
Microsoft.Azure.Devices.Provisioning.Client.ProvisioningTransportException: AMQP transport exception ---> System.TimeoutException: The operation did not complete within the allocated time 00:01:00 for object message.
at Microsoft.Azure.Amqp.ExceptionDispatcher.Throw (System.Exception exception) [0x00006] in <9cea9f83a18d449284cb86dea42f9d95>:0
at Microsoft.Azure.Amqp.AsyncResult.End[TAsyncResult] (System.IAsyncResult result) [0x000f5] in <9cea9f83a18d449284cb86dea42f9d95>:0
at Microsoft.Azure.Amqp.SendingAmqpLink+SendAsyncResult.End (System.IAsyncResult result) [0x00000] in <9cea9f83a18d449284cb86dea42f9d95>:0
at Microsoft.Azure.Amqp.SendingAmqpLink.EndSendMessage (System.IAsyncResult result) [0x00000] in <9cea9f83a18d449284cb86dea42f9d95>:0
at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in /Users/builder/jenkins/workspace/archive-mono/2019-10/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/FutureFactory.cs:534
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Azure.Devices.Provisioning.Client.Transport.AmqpClientLink.SendMessageAsync (Microsoft.Azure.Amqp.AmqpMessage message, System.ArraySegment1[T] deliveryTag, System.TimeSpan timeout) [0x0009b] in <628fca344e4f47e1ad080e10f9a8d33f>:0 at Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportHandlerAmqp.OperationStatusLookupAsync (Microsoft.Azure.Devices.Provisioning.Client.Transport.AmqpClientConnection client, System.String operationId, System.String correlationId) [0x00128] in <628fca344e4f47e1ad080e10f9a8d33f>:0 at Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportHandlerAmqp.RegisterAsync (Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportRegisterMessage message, System.Threading.CancellationToken cancellationToken) [0x004f5] in <628fca344e4f47e1ad080e10f9a8d33f>:0 --- End of inner exception stack trace --- at Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportHandlerAmqp.RegisterAsync (Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportRegisterMessage message, System.Threading.CancellationToken cancellationToken) [0x006a5] in <628fca344e4f47e1ad080e10f9a8d33f>:0 at SigneeOpensource.IoTHub.DeviceConnect.RegisterDeviceAsync (Microsoft.Azure.Devices.Shared.SecurityProviderSymmetricKey security) [0x0008d] in Services\IoTHub\DeviceConnect.cs:104 at SigneeOpensource.IoTHub.DeviceConnect.SetRegistrationDataAsync () [0x0008b] in Services\IoTHub\DeviceConnect.cs:86 at SigneeOpensource.MainActivity.IotHub () [0x00037] in \Activities\MainActivity.cs:74 at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.23(intptr,intptr) at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.23(intptr,intptr) [ERROR] FATAL UNHANDLED EXCEPTION: Microsoft.Azure.Devices.Provisioning.Client.ProvisioningTransportException: AMQP transport exception ---> System.TimeoutException: The operation did not complete within the allocated time 00:01:00 for object message. at Microsoft.Azure.Amqp.ExceptionDispatcher.Throw (System.Exception exception) [0x00006] in <9cea9f83a18d449284cb86dea42f9d95>:0 at Microsoft.Azure.Amqp.AsyncResult.End[TAsyncResult] (System.IAsyncResult result) [0x000f5] in <9cea9f83a18d449284cb86dea42f9d95>:0 at Microsoft.Azure.Amqp.SendingAmqpLink+SendAsyncResult.End (System.IAsyncResult result) [0x00000] in <9cea9f83a18d449284cb86dea42f9d95>:0 at Microsoft.Azure.Amqp.SendingAmqpLink.EndSendMessage (System.IAsyncResult result) [0x00000] in <9cea9f83a18d449284cb86dea42f9d95>:0 at System.Threading.Tasks.TaskFactory1[TResult].FromAsyncCoreLogic (System.IAsyncResult iar, System.Func2[T,TResult] endFunction, System.Action1[T] endAction, System.Threading.Tasks.Task1[TResult] promise, System.Boolean requiresSynchronization) [0x0000f] in /Users/builder/jenkins/workspace/archive-mono/2019-10/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/FutureFactory.cs:534 --- End of stack trace from previous location where exception was thrown --- at Microsoft.Azure.Devices.Provisioning.Client.Transport.AmqpClientLink.SendMessageAsync (Microsoft.Azure.Amqp.AmqpMessage message, System.ArraySegment1[T] deliveryTag, System.TimeSpan timeout) [0x0009b] in <628fca344e4f47e1ad080e10f9a8d33f>:0
at Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportHandlerAmqp.OperationStatusLookupAsync (Microsoft.Azure.Devices.Provisioning.Client.Transport.AmqpClientConnection client, System.String operationId, System.String correlationId) [0x00128] in <628fca344e4f47e1ad080e10f9a8d33f>:0
at Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportHandlerAmqp.RegisterAsync (Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportRegisterMessage message, System.Threading.CancellationToken cancellationToken) [0x004f5] in <628fca344e4f47e1ad080e10f9a8d33f>:0
--- End of inner exception stack trace ---
at Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportHandlerAmqp.RegisterAsync (Microsoft.Azure.Devices.Provisioning.Client.Transport.ProvisioningTransportRegisterMessage message, System.Threading.CancellationToken cancellationToken) [0x006a5] in <628fca344e4f47e1ad080e10f9a8d33f>:0
at SigneeOpensource.IoTHub.DeviceConnect.RegisterDeviceAsync (Microsoft.Azure.Devices.Shared.SecurityProviderSymmetricKey security) [0x0008d] in \Services\IoTHub\DeviceConnect.cs:104
at SigneeOpensource.IoTHub.DeviceConnect.SetRegistrationDataAsync () [0x0008b] in \Services\IoTHub\DeviceConnect.cs:86
at SigneeOpensource.MainActivity.IotHub () [0x00037] in
\Activities\MainActivity.cs:74
at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.23(intptr,intptr)
at (wrapper native-to-managed) Android.Runtime.DynamicMethodNameCounter.23(intptr,intptr)

Expected/desired behavior

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
Android

Versions

9.0

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Exception after first login with device streams proxy sample

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

  1. Use device streams proxy samples to set up device and service side SSH proxies on the SAME machine (experiencing different issues cross machine).

  2. Log in using SSH via service side proxy. See it work.

  3. Exit SSH session.

  4. Log in again using SSH via service side proxy. This second login throws an exception on the device proxy:

Microsoft.Azure.Devices.Common.Exceptions.DeviceNotFoundException: Device {"Message":"{"errorCode":404001,"trackingId":"c45f6aee9d2b4cc78402ad05811ca501-G:11-TimeStamp:02/06/2019 22:41:10","message":"Device unavailable","timestampUtc":"2019-02-06T22:41:10.9080359Z"}","ExceptionMessage":""} not registered
at Microsoft.Azure.Devices.HttpClientHelper.ExecuteAsync(HttpClient httpClient, HttpMethod httpMethod, Uri requestUri, Func3 modifyRequestMessageAsync, Func2 isMappedToException, Func3 processResponseMessageAsync, IDictionary2 errorMappingOverrides, CancellationToken cancellationToken)
at Microsoft.Azure.Devices.HttpClientHelper.PostAsync[T,T2](Uri requestUri, T entity, TimeSpan operationTimeout, IDictionary2 errorMappingOverrides, IDictionary2 customHeaders, CancellationToken cancellationToken)
at Microsoft.Azure.Devices.AmqpServiceClient.CreateStreamAsync(Uri uri, DeviceStreamRequest deviceStreamRequest, CancellationToken cancellationToken)
at Microsoft.Azure.Devices.Samples.DeviceStreamSample.HandleIncomingConnectionsAndCreateStreams(String deviceId, ServiceClient serviceClient, TcpClient tcpClient) in /home/jadsa-auto/Repos/azure-iot-samples-csharp/iot-hub/Quickstarts/device-streams-proxy/service/DeviceStreamSample.cs:line 60
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location where exception was thrown ---
at System.Threading.ThreadPoolWorkQueue.Dispatch()

  1. Observe that service side proxy terminates with no exception as well.

Any log messages given by the failure

Expected/desired behavior

Multiple logins should work

OS and Version?

Ubuntu 18.04

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

ServiceClientStreamingSample needs to be updated for microsoft.azure.devices 1.27.2

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [x] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

the newest version of microsoft.azure.devices is 1.27.2 and it had a breaking api change from version 1.27.0-preview-004 used in the sample. can you update the sample to help me know what to change?

https://github.com/Azure-Samples/azure-iot-samples-csharp/blob/master/iot-hub/Samples/service/DeviceStreamingSample/ServiceClientStreamingSample.csproj#L18

steps to reproduce -

errors are:
Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'DeviceStreamRequest' could not be found (are you missing a using directive or an assembly reference?) ServiceClientStreamingSample
Severity Code Description Project File Line Suppression State
Error CS1061 'ServiceClient' does not contain a definition for 'CreateStreamAsync' and no accessible extension method 'CreateStreamAsync' accepting a first argument of type 'ServiceClient' could be found (are you missing a using directive or an assembly reference?) ServiceClientStreamingSample

AutomaticDeviceManagementSample AddConfigurationAsync gets exception

This issue is for a: (mark with an x)

- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)
- [x]   Question... possible issue?

I put the AutomaticDeviceManagementSample.cs code into a solution, provided all my azure account info, and am getting an exception.

When the following line is called, 

await _registryManager.AddConfigurationAsync(configuration).ConfigureAwait(false);

I get the following.

{"Message":"ErrorCode:InvalidConfigurationContent;BadRequest","ExceptionMessage":"Tracking ID:c59f9dce01e34834863130822b805b30-G:25-TimeStamp:03/04/2020 22:37:07"}

Before I try the AddConfig, I print out the configuration.  Here is what I get.

Configuration Id: config001
Configuration SchemaVersion: 1.0
Configuration Labels:
Configuration Content [type = assignment]
ModuleContent:
                properties.desired.modulesContent_key = modulesContent_value-config001
DeviceContent:
Configuration TargetCondition: tags.environment = 'Latest'
Configuration CreatedTimeUtc: 1/1/0001 12:00:00 AM
Configuration LastUpdatedTimeUtc: 1/1/0001 12:00:00 AM
Configuration Priority: 20
Metrics Results: (0)
Metrics Queries: (0)
Configuration ETag:

Input is appreciated!


Running on Windows 10, 1909.
Working azure account and subscription with lots of resources, including an IOT Hub.

Stack Trace is:

   at Microsoft.Azure.Devices.HttpClientHelper.<ExecuteAsync>d__35.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Devices.HttpClientHelper.<ExecuteAsync>d__32.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Devices.HttpClientHelper.<PutAsync>d__11`1.MoveNext()
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at RegistryMgrTest.Program.<AddDeviceConfiguration>d__7.MoveNext() in D:\SoftwareDev\Cloud\RegistryMgrTest\Program.cs:line 143

( line 143 is the line of the await statement above )
<!--
IF SUFFICIENT INFORMATION IS NOT PROVIDED VIA THE FOLLOWING TEMPLATE THE ISSUE MIGHT BE CLOSED WITHOUT FURTHER CONSIDERATION OR INVESTIGATION
-->
> Please provide us with the following information:
> ---------------------------------------------------------------

### This issue is for a: (mark with an `x`)
  • bug report -> please search issues before submitting
  • feature request
  • documentation issue or request
  • regression (a behavior that used to work and stopped in a new release)

### Minimal steps to reproduce
>

### Any log messages given by the failure
>

### Expected/desired behavior
>

### OS and Version?
> Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

### Versions
>

### Mention any other details that might be useful

> ---------------------------------------------------------------
> Thanks! We'll be in touch soon.

Quickstart device quick stream proxy is not working

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

cannot compile and build project in the quickstart
ServiceLocalProxyStreamingSample

Any log messages given by the failure

Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'DeviceStreamRequest' could not be found (are you missing a using directive or an assembly reference?) ServiceLocalProxyStreamingSample C:\Users\Richard Lawidjaja\Desktop\1\azure-iot-samples-csharp-master\iot-hub\Quickstarts\device-streams-proxy\service\DeviceStreamSample.cs 54 Active

Expected/desired behavior

should be able to compiled

OS and Version? win 10

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Unauthorized exception in device streams echo sample with AMQP over websockets and certs auth

Please provide us with the following information:

This issue is for a: (mark with an x)

- [ X ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Code snippet below along with the streaming echo sample.

public static class Program
    {
        public static int Main(string[] args)
        {
            var cert = new X509Certificate2(@"/home/nandan/nanca/certs/new-edge-device.cert.pfx", "1234");
            var auth = new DeviceAuthenticationWithX509Certificate("MySecStreamDev", cert);
           

            using (DeviceClient deviceClient = DeviceClient.Create("DevStreamPPIoTHub.azure-devices.net", auth, TransportType.Amqp_WebSocket_Only))
            {
                if (deviceClient == null)
                {
                    Console.WriteLine("Failed to create DeviceClient!");
                    return 1;
                }

                var sample = new DeviceStreamSample(deviceClient);
                sample.RunSampleAsync().GetAwaiter().GetResult();
            }

            Console.WriteLine("Done.\n");
      }

Any log messages given by the failure

Unhandled Exception: Microsoft.Azure.Devices.Client.Exceptions.UnauthorizedException: 
Tracking Id:4ea66322278e4659b903a4c57915f7da-G:5-TimeStamp:02/07/2019 03:51:30
   at Microsoft.Azure.Devices.Client.Transport.AmqpTransportHandler.OpenAsync(CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.Transport.ProtocolRoutingDelegatingHandler.OpenAsync(CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler.<>c__DisplayClass27_0.<<ExecuteWithErrorHandlingAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler.ExecuteWithErrorHandlingAsync[T](Func`1 asyncOperation)
   at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.<>c__DisplayClass41_0.<<OpenAsyncInternal>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.EnsureOpenedAsync(CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.<>c__DisplayClass23_0.<<EnableStreamsAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.EnableStreamsAsync(CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.InternalClient.EnableStreamAsync(CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.InternalClient.WaitForDeviceStreamRequestAsync(CancellationToken cancellationToken)
   at Microsoft.Azure.Devices.Client.Samples.DeviceStreamSample.RunSampleAsync(Boolean acceptDeviceStreamingRequest) in /home/nandan/sdkcsharp/azure-iot-samples-csharp-master/iot-hub/Quickstarts/device-streams-echo/device/DeviceStreamSample.cs:line 33
   at Microsoft.Azure.Devices.Client.Samples.DeviceStreamSample.RunSampleAsync() in /home/nandan/sdkcsharp/azure-iot-samples-csharp-master/iot-hub/Quickstarts/device-streams-echo/device/DeviceStreamSample.cs:line 24
   at Microsoft.Azure.Devices.Client.Samples.Program.Main(String[] args) in /home/nandan/sdkcsharp/azure-iot-samples-csharp-master/iot-hub/Quickstarts/device-streams-echo/device/Program.cs:line 42

Expected/desired behavior

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Streaming video over Device Streams

It appears that streaming video over HTTP doesn't work. I was barely able to get a web site to display over HTTP (in other words, it doesn't work every time). Is this supported?

This is the error I get:

Unhandled Exception:
Unhandled Exception: Microsoft.Azure.Devices.Common.Exceptions.IotHubException: {"Message":"{"errorCode":504101,"trackingId":"cce140dd335c41fd90047208d8f7f0d0-TimeStamp:02/11/2020 01:36:39","message":"Timed out waiting for the response from device.","info":{"timeout":"00:01:00"},"timestampUtc":"2020-02-11T01:36:39.4565857Z"}","ExceptionMessage":""}
at Microsoft.Azure.Devices.HttpClientHelper.d__35.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Devices.HttpClientHelper.d__262.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Devices.AmqpServiceClient.<CreateStreamAsync>d__47.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
at AI.Box.DeviceStreamService.StreamingService.d__6.MoveNext() in C:\Users\bkotvis\Source\Repos\AI-Box\ConnectedCommunities.AI.Box\AI.Box.DeviceStreamService\StreamingService.cs:line 58
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
Microsoft.Azure.Devices.Common.Exceptions.IotHubException: {"Message":"{"errorCode":504101,"trackingId":"d9b0ecc6d1ca4ac98d4ee8c7cfd06970-TimeStamp:02/11/2020 01:36:39","message":"Timed out waiting for the response from device.","info":{"timeout":"00:01:00"},"timestampUtc":"2020-02-11T01:36:39.1850481Z"}","ExceptionMessage":""}
at Microsoft.Azure.Devices.HttpClientHelper.d__35.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Devices.HttpClientHelper.d__262.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.Devices.AmqpServiceClient.<CreateStreamAsync>d__47.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult()
at AI.Box.DeviceStreamService.StreamingService.d__6.MoveNext() in C:\Users\bkotvis\Source\Repos\AI-Box\ConnectedCommunities.AI.Box\AI.Box.DeviceStreamService\StreamingService.cs:line 58
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadPoolWorkQueue.Dispatch()
C:\Program Files\dotnet\dotnet.exe (process 9892) exited with code 0.

Short overview of samples anywhere?

Is there a possibility to add a quick summary of what the samples do/show in the readme.md? In particular, looking for Identity Translation these days... Thanks!

Device Streaming Errror - Forbidden Access Permissions

This issue is for a: (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

  1. Clone: https://github.com/Azure-Samples/azure-iot-samples-csharp
  2. Change directory to
azure-iot-samples-csharp\iot-hub\Quickstarts\device-streams-proxy\service
  1. Start the service
dotnet run HostName=<hubname>.azure-devices.net;SharedAccessKeyName=iothubowner;SharedAccessKey=<key> <deviceid> 2222
Unhandled Exception: System.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions
   at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, String callerName)
   at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.Sockets.Socket.Bind(EndPoint localEP)
   at System.Net.Sockets.TcpListener.Start(Int32 backlog)
   at System.Net.Sockets.TcpListener.Start()
   at Microsoft.Azure.Devices.Samples.DeviceStreamSample.<RunSampleAsync>d__7.MoveNext() in C:\Git\azure-iot-samples-csharp\iot-hub\Quickstarts\device-streams-proxy\service\DeviceStreamSample.cs:line 92
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.Azure.Devices.Samples.Program.Main(String[] args) in C:\Git\azure-iot-samples-csharp\iot-hub\Quickstarts\device-streams-proxy\service\Program.cs:line 66

Expected/desired behavior

Service starts

OS and Version?

Windows 10

Versions

Version 1903 (OS Build 18362.175

Mention any other details that might be useful

This may be due to a Windows 10 update I did this morning. It was working last Friday.


Thanks! We'll be in touch soon.

Connection string is missing the property: HostName for Message Receive Sample

Hi everyone, I perhaps bring you quite an easy problem to fix, but since I am a bit new to C# I am having a little trouble with my C/C++ background.

I am trying to run the Message Receive Sample, but I am getting an error:
Unhandled exception. System.ArgumentException: The connection string is missing the property: HostName.

I am passing my connection string as a command-line argument using VS 2022 by right-clicking on Solution in Solution Explorer ->Properties -> Debug -> General -> Open debug launch profiles UI) and pasting my string into the command-line arguments text box in the following format:

-p, HostName=xxx;DeviceId=xxx;SharedAccessKey=xxx

What is wrong with what I am doing? Could I perhaps hard-code it somehow into the code?

I really appreciate any help you can provide. Thanks in advance.

Tutorials\Routing\SimulatedDevice-DeviceAuthenticationWithRegistrySymmetricKey Pops up exception

Please provide us with the following information:

This issue is for a: (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [ ] regression (a behavior that used to work and stopped in a new release)

Minimal steps to reproduce

Download the repo, build and run the sample (environment: VS 2017 enterprise)
(No matter change the s_deviceKey or not, same exception.)

Any log messages given by the failure

System.ArgumentException
HResult=0x80070057
Message=Key must be base64 encoded
Source=Microsoft.Azure.Devices.Client
StackTrace:
at Microsoft.Azure.Devices.Client.DeviceAuthenticationWithRegistrySymmetricKey.SetKeyFromBase64String(String key)
at SimulatedDevice.Program.Main(String[] args) in C:\IoT\azure-iot-samples-csharp-master\azure-iot-samples-csharp-master\iot-hub\Tutorials\Routing\SimulatedDevice\Program.cs:line 23

Expected/desired behavior

the string is pretty straightforward, copied from IoT Hub portal. And actually no matter what the string is, all the same error.

OS and Version?

Windows 7, 8 or 10. Linux (which distribution). macOS (Yosemite? El Capitan? Sierra?)
Win10 17763.

Versions

Mention any other details that might be useful


Thanks! We'll be in touch soon.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.