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

Windows Forms
Windows Forms
A set of .NET Framework managed libraries for developing graphical user interfaces.
1,901 questions
Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,702 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,005 questions
Windows 10 Hardware Performance
Windows 10 Hardware Performance
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Hardware Performance: Delivering / providing hardware or hardware systems or adjusting / adapting hardware or hardware systems.
117 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Limitless Technology 44,381 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.