C#

C

C#

We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.

Join

Logging from disconnected Business logic

Hey all, I have an outstanding requirement that I've played around with off and on over the last few months.
I have a LoggingService that handles communicating errors to backend servers, writing to file, etc. The log server has a LogServiceInstance for each job running and it captures messages to specific locations based on the jobs context. The jobs run through a bunch of code I have control of (The job manager, the job service, etc.) All of that is fine and I can obviously capture the log records to the proper places....

✅ idk why when the form is maximize, it stays as the same size.

i want it to expand like when its full screened, but the panels had a problem w their scale/sizes stays the same.
No description

✅ Serializing/Deserializing a Dictionary with a struct key not working

I have been pulling my hair out to support this library that uses a struct key. Since the Dictionary uses a weird key, I have to change the serialization. The class is as follows: ```cs public sealed class BCCCodebase...

ZkTeco sdk

I have a problem with connecting the zk device type of iFace1000 with the BiometricZktecoDeviceCommunication nuget package , the problem is that some fuctions don't support the iFace1000 device , how i can handle it when i want to connect an old device with this nuget package ? or is there another nuget packages that can help ? also i tried the old dll for the zkeeper for the zkteco bio , it works with iFace1000 but the problem is when you add it to a docker container it will not work since the container hosted on linux and the functions will throw the exception for not suppored COM , since the linux don't support such thing...

I am trying to make a desktop icon , to change copy paste keys and alt key to open clipboard

Everything is done and working but it is very laggy and not at all performance optimised , clibboard opens but cant paste it can any one help

✅ Route Doesn't Trigger When Called Externally

Hi, I need some help with this issue. I've tried everything but still can't find the solution. Here's my code: ```c# [HttpGet]...

SQL: Trying to obtain all rows that have a primary key inside a inputted table

The code works if the Recipe string replaces the ? in the string. However, as I want to prevent SQL injection the RecipeString isn't treated as SQL so the ' ' either side of each name in RecipeString isn't identified in the SQL string hence returning no values. Hopefully you understand the issue. If anyone has any ideas on how to fix this it would be greatly appriciated. Thanks Code: ```C# string _sSqlString = "SELECT * FROM IngredientRecipe WHERE ProductName IN (?)";...

not able to display image in monogame

Im making a simple game for a uni project. however when the player collides with the enemy an end screen is supposd to show up which in this case is not. im quite unsure what could possibly cause that

WPF - Custom Control Help

See attached files, the template binding to FlyoutDirection is not working. I am getting this exception: ``` System.Windows.Markup.XamlParseException HResult=0x80131501...

user input, completes given function

Hello im back :) I am using c# in visual studio. I would like to have a question pop up in the terminal, which day of the advent of code they would like to see, currently on day 2 obviously... if the user gives a value not 1 or 2, i give an error message and ask again. i have never dont getinput in c# so pls help me out with this. I also dont know how to execute a given method without 25 different if statements, im sure there is a better way...

✅ Ef-core query efficiency?

I have a question regarding querying data. Which one is more efficient since I only need the department ids. The first one ```cs private async Task<OrganizationMemberDTO?> RetrieveMemberAsync(CancellationToken ct) { return await db.OrganizationMembers...

✅ List.Sort()?

I am using a list named cmp to compare another list if it is equal to a sorted version of the same list. I am using cmp.Sort(). From what i have seen in the console.writeline... that it does not work at all on the top is the list, on the bottom is each value in cmp, which is clearly not sorted from least to greatest. pls help...
No description

Sloppy Constructors

I know I'm missing something here. There's likely a better way of doing the below? ```cs public class SolidColorBrush : Brush { public Color Color { get; set; } = System.Drawing.Color.White;...

Recommendations for deploying to and managing Raspberry Pi machines?

I'm creating a system involving several RPi devices I'll be using for their GPIO capabilities. Does anyone have recommendations on how to ensure these devices stay up to date, receive updates for my software, etc? I considered getting an absolute bare bones Linux install going with Docker and pushing images. It does seem possible to access the GPIO APIs this way with a few extra steps. But I'm overall in the very early stages of this part of the design and would appreciate any guidance you h...

How do i start?

Im a noob when it comes to WPF and i was wondering if someone could point me in the right direction I want to create a Calculator program with a log in screen and a note taking section with a search bar to look for notes. What should i do?

API

hello som im trying to connect my be with fe i have set the correct local hosts but when i send a request to be it says this inspector.js:7 ...

How to make sure a background service is never stopped by any user, not even local admin?

I was learning to create a background service using C# and dotnet. My curiosity is to know, can we make such a service that cannot be stopped by any user not even local admin?

Using resourceTypedParamsAndOutputs in bicep

I am writing a bicep file to deploy an app-service. I am using the experimental feature 'resourceTypedParamsAndOutputs' for this. ``` module nervexisAppService './appService.bicep' = { name: 'deployAppServices'...

Source code generation not working with partial record, only with partial class

Using a basic incremental source code generator to generate some serializer-like functionality. ```c# [Generators.Pkt]...

How To Properly Catch An SMTPException & IOException

Hi, everyone. I have a project that sends emails to clients and also saves a copy of the email but somewhere during the operation of sending these emails, I get an IOException & sometimes an SMTPException for a particular email & it breaks the server & gives me a "Error 500" I want to properly handle an exception when happens, like retry sending that email again or just move on to the next or maybe log it (If logging that error is the way, I want a way for the problem to appear on Event Viewer). How would I achieve that. Here is the code link...