Comments (8)
from azure-iot-sdk-csharp.
Its not executing the break inside. So could that be the cause of cancellation token timing out.
If thats the case how should I solve this.Please let me know.
if (ct.IsCancellationRequested)
break;
I also see that it just comes out of the method and so the return View gets executed.
So after this I am able to see the page. Though I keep a break point at the end of the method - } - it doesn't come there. Looks like it abruptly ends and goes to the called method.
Can we expect any issue in the below statement which is inside the loop.
string data = Encoding.UTF8.GetString(eventData.GetBytes());
--> like a null value or so is being called on - GetBytes or GetString here on eventData --- and it throws error ... or similar?
from azure-iot-sdk-csharp.
I tried including try catch block
i.e placing the code statements - while(true) part - of the method ReceiveMessagesFromDeviceAsync in try catch block as below.
I have confirmed that it never hits the statements marked below as ====>
STT-A or STT-B or STT-E or STT_END_OF_METHOD
It loops inside while for some number of times (i.e receives data from IoT Hub)
and at one point of time at the statement STT- IoT_DATA it comes out of the method and returns to the calling method - i.e to the method SetHubs() I have mentioned in my query\comment
(This proceeds to display the page)
try{
if (ct.IsCancellationRequested)
break; // STT-A
EventData eventData = await eventHubReceiver.ReceiveAsync(); // STT- IoT_DATA
if (eventData == null)
continue;//STT-B
string data = Encoding.UTF8.GetString(eventData.GetBytes());
}
catch(Expecption exp){
string e =exp.message(); //STT-E
}
} //STT-END_OF_METHOD
Am I missing something like the partition limit or so. If so please guide me how to do or make the required settings to make this work.
## Note : The same code works fine in a Console App.
from azure-iot-sdk-csharp.
I would like to know why you commented out Task.WaitAll ?
//Task.WaitAll(tasks.ToArray());
from azure-iot-sdk-csharp.
In this web app, If that is not commented the system hangs - continuously waits - there ;
even when I'm debugging the debugger doesn't get back if that statement is hit.
When this statement(Task.WaitAll(tasks.ToArray()
);) is in a Console App the control(or debugger) continuously loops thro while\foreach loop
until a break given.
from azure-iot-sdk-csharp.
I don't think you can fire and forget async receivers this way. You need to have a background task manager to root client objects and tasks. For example, what happens when eventHubClient is garbage collected while your receiver is still running. Can you dig into web for correct implementation of "fire and forget" programming in ASPNet applications?
from azure-iot-sdk-csharp.
Hi @jeywinlizy
I think the conversation has now gone way beyond the SDK use itself. Would it be possible for you to post the issue you are having on StackOverflow to make sure you get the right people looking into it?
Thanks
from azure-iot-sdk-csharp.
@jeywinlizy - Since this issue is not related particularly to this SDK, we're closing it here.
from azure-iot-sdk-csharp.
Related Issues (20)
- Desired Properties callback not triggering after a reconnect HOT 5
- [feature request] Move to System.Text.Json to support AOT HOT 2
- [Bug Report] DeviceClient.SendEventAsync takes over one minute after update from 1.42.0 to 1.42.2 HOT 7
- [BUG] error CS0426: The type name 'Create' does not exist in the type 'ServiceClient' HOT 1
- Building digital twin of the robotic arm [Technical Question] HOT 2
- How do I send data stored in array (floating type) from my robot to IoT hub? [Technical Question]
- [Bug Report] Fails to establish TPM connection HOT 1
- [Technical Question] Security: Check root certificate on device-to-cloud connection HOT 10
- Unhandled exception. Microsoft.Azure.Devices.Client.Exceptions.IotHubException: Request 817bda7c-6fc4-40e0-8946-93eb851fcb12 returned status 403 [Bug Report] HOT 7
- [Bug Report] Send message in batch to multiple outputs using ModuleClient throws HOT 2
- Is it possible to send bulk messages in telemetry from device to IoT hub? [Technical Question]
- [Technical Question] HttpClientHelper error code 400030 HOT 3
- [Bug Report] When try to fetch reported properties after updating the reported property it will return previous version of reported property not the latest one. HOT 2
- [QUERY] How to properly acknowledge IoT hub messages HOT 6
- [feature request] Make DPS Queries testable HOT 2
- MQTT Channel is Closed / Migrating Sample to .net8 caused an issue HOT 5
- DeviceNotFoundException results in InvalidErrorCode (404103) HOT 2
- [Bug Report] v2.0.0 now removed from nuget package HOT 4
- Getting PlatformNotSupportedException on .NET Framework 4.6.1 HOT 3
- [Technical Question] HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-iot-sdk-csharp.