Async method is not showing UI context of declared variables

Sanjay Kumar Jha 156 Reputation points
2023-04-25T15:16:35.0833333+00:00

Hi, I am using the async method in my application. The first time when I run the application, It is showing UI context for declared variables or passed parameters but the second time when I call the same function, It is not showing UI context for passed parameters or declared variables. I have also tried the ConfigureAwait(true) or ConfigureAwait(false). But still, I am facing the problem. No idea what is the cause behind it. I am attaching a screenshot for the help of the first cars and 2nd cases. Please have a look.MouseHover_Variable_FirstTime_2

MouseHover_Variable_FirstTime_1

MouseHover_Variable_2ndtime_1

MouseHover_Variable_2ndtime_2

Thanks, Sanjay

Developer technologies Windows Forms
Windows for business Windows Client for IT Pros Devices and deployment Other
Windows for business Windows Client for IT Pros User experience Other
Developer technologies C#
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,751 Reputation points
    2023-04-26T11:35:58.4266667+00:00

    Hello there, Can you share the script your are following? Also if you're new to asynchronous programming or do not understand how an async method uses the await operator to do potentially long-running work without blocking the caller's thread, read the introduction in Asynchronous programming with async and await. The following code is found inside an async method and calls the HttpClient.GetStringAsync method: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/async Hope this resolves your Query !! --If the reply is helpful, please Upvote and Accept it as an answer--

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.