revolt
Partial classes and platform specific code
Hello. Trying to create platform specific code and only use/compile the code for correct platform upon release. My current issue is that regardless of platform my linux specific code is trying to run on windows. I seen examples of it using MAUI, however i'm just trying to make a simple console app.
In my csproj:
Base class:
used like this:
an identical implementation is done for linux and all code is in the same namespace
and it's built using this command:
dotnet publish wallpaper.csproj -r win-x64 -c Release
55 replies
CancelKeyPress not being handled/interrupted correctly
The issue is that on ctrl+c press the application does call CancelKeyPress event, however I'm assuming it is not respecting e.Cancel = true correctly. Either that or the main program passes ctrl+c to the spawned process and does not respect e.Cancel = true.
Code :
Program.cs
ServerHandler.cs (Relevant code. _serverProcess is a reference to new spawned Process, not the current main process)
CustomLifetime.cs
2 replies
❔ Properly calling "await login()" in web service constructor
Hello. Kinda noob, but I am looking for the best way to call a async login function for an external library in a web service constructor. I posted my code below. I want to use this service in DI singleton and make sure the _client.ConnectAsync() is called once correctly. AFAIK this approach would require me to call EnsureInitializedAsync(); everytime I use this service in my api controller. I just want to know if this is the best approach, or if there is something easier to use. Thank you!
16 replies