Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report] #3449

Open
sebastian-bylinski opened this issue Apr 5, 2024 · 2 comments
Open

[Bug Report] #3449

sebastian-bylinski opened this issue Apr 5, 2024 · 2 comments
Labels
bug Something isn't working.

Comments

@sebastian-bylinski
Copy link

Context

  • OS, version, SKU and CPU architecture used: <Windows 11 Pro Desktop x64> (Windows 10 Desktop x64, Ubuntu 15.04 x86, Windows 10 IoT Core arm32, etc.)
  • Application's .NET Target Framework : <net8.0> (See https://docs.microsoft.com/en-us/dotnet/standard/frameworks. E.g. netcoreapp2.1, net451, uap10.0, maui/windows)
  • Device: (Laptop, Raspberry PI3, Android APIv25 etc.)
  • SDK version used: <2.0.0-preview004> (Please include the NuGet package version for all involved components)
  • "features": "GWV2, RootCertificateV2",

Description of the issue

Using 2.0.0-preview004 in GWv2 gateway, call to OpenAsync to IotHub wipes message from IoTHub for the first time when connecting when device is offline before message has been send to IoTHub. It happens at random. Sometimes getting the message in the code, sometimes not. Out of 10 tries 3, worked 7 did not. Apparently this issue supposed to be corrected in GWV2, but it is not. The issue remains.
It works fine when device is already connected to IoTHub when message has been sent.

Code sample exhibiting the issue

private static IotHubDeviceClient _iotHubClient;

try
{
var _connectionString = "HostName=;SharedAccessKeyName=device;SharedAccessKey=;Deviceid=";

IotHubClientAmqpSettings transport = new IotHubClientAmqpSettings();
    var options = new IotHubClientOptions
    {
        RetryPolicy = new IotHubClientFixedDelayRetryPolicy(0, TimeSpan.FromSeconds(3), true)
    };
    
    _iotHubClient = new IotHubDeviceClient(_connectionString, options);

    Task.Run
        (async () =>
        {
            try
            {
                await _iotHubClient.OpenAsync();
                await _iotHubClient.SetIncomingMessageCallbackAsync(MessageCallback);
            }
            catch (Exception e)
            {
                throw;
            }
        });
}
catch (Exception e)
{
    throw new Exception(e.ToString());
}

}

protected async Task MessageCallback(IncomingMessage message)
{
return MessageAcknowledgement.Abandon;
}

Console log of the issue

@sebastian-bylinski sebastian-bylinski added the bug Something isn't working. label Apr 5, 2024
@andyk-ms
Copy link
Contributor

Thanks for the info.

For preview release, please update to the last good version:
https://github.com/Azure/azure-iot-sdk-csharp/releases/tag/preview_2023-08-14

For production stable setup, please use the latest version of the official SDK release here:
https://github.com/Azure/azure-iot-sdk-csharp/releases/tag/2024-03-28

@sebastian-bylinski
Copy link
Author

sebastian-bylinski commented Apr 16, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working.
Projects
None yet
Development

No branches or pull requests

2 participants