Category : async-await

I’m writing a WinUI3 (Project Reunion 0.5) application with .NET 5 and would like to use the .NET Generic Host. I’m using the default host with a custom IHostedService: public App() { _host = Host.CreateDefaultBuilder() .ConfigureServices((context, services) => { services.AddHostedService<MyHostedService>(); }).Build(); InitializeComponent(); } The hosted service performs some asynchronous operations in StopAsync. For demonstration purposes, ..

Read more

Does there exist any reasonably platform-independent equivalent of the following? void sleep_async(delay_t delay, void (* callback)(void *), void * data); That is, a means of asynchronously executing a callback after a delay. POSIX, for example, has a few functions that do something like this, but they are mostly for asynchronous I/O (see this for what ..

Read more

I need to use a third-party DLL which implements a TCP socket client (in C++) using blocking calls. So basically (pseudocode); void DoRequest() { send(myblockingSocket,data); recv(myblockingSocket,responsedata); } What is the recommended way to make these calls accessible in .NET as asynchronous calls using async-await (without changing the original DLL) ? I read: https://docs.microsoft.com/en-us/dotnet/standard/async-in-depth#deeper-dive-into-tasks-for-an-io-bound-operation and https://docs.microsoft.com/en-us/dotnet/csharp/async ..

Read more

I need my app to require admin rights before running a process asynchronously. It used to work well with the following configuration in the app.manifest: <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> However, since now processes were added that should not require admin rights to be run, this elegant solution no longer cuts it. This is what I ..

Read more