C#

C

C#

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

Join

Issue when deserializing web response

Hey, I'm making a simple call to the api and looking at the text reponse it looks correct (check first image). ```cs HttpResponseMessage response = await client.GetAsync(nextPageUrl); string responseBody = await response.Content.ReadAsStringAsync(); ...
No description

Native AOT Shared Library - Correct Typing for Struct Pointer Parameter

I'm trying to define an exported static method to conform with the following procedure: void retro_get_system_info(struct retro_system_info *info) Currently I'm defining my method as:...

Failed build

When i click the button to start the build it just fails instantly, any ideas?
No description

Anyone can help me with aspnetboilerplate?

Wanted to just fix something for a client but the setup to me is harder then I expected and ofc I am on a MacOS which makes it even weirder. If anyone has experience please DM.

The embed log with the webhook for name changes shows the old name as null โ€” that's the issue

In the code I wrote in Form1.cs, there's an issue: the variable "oldNick" is incorrect. When the bot starts or is already running, if a member's name is changed, "oldNick" becomes null (i.e., not registered). But I don't want it to work like that. If a member's nickname is empty, I want it to assign the "global name" instead. If the nickname is set (i.e., the name has already been changed), then I want it to use the nickname.

.NET generate assets for build and debug not apperaring

Hello, I just started learning C# and have been following the brackeys tut (https://www.youtube.com/watch?v=N775KsWQVkw&list=PLPV2KyIb3jR4CtEelGPsmPzlvP7ISPYzR&index=4) One of the suggestions is to type in the title in the search bar and get the launch.json file so that i can switch th code from running on an internal console to an external terminal. It worked fine at the start, but does not seem to show up on any new projects i create even though i follow the same steps Am I missing something>...
No description

Combining a MAUI App and WPF Updater into a Single MSIX Package?

Hey everyone! Iโ€™m working on a .NET project and I have a question about packaging. I have a MAUI app that I want to distribute as an MSIX package. I also have a separate WPF app that acts as an updater for the MAUI app (it checks for updates and installs them). Is it possible to combine both apps into a single MSIX package, so they can be installed together? Any tips or best practices?

Regex Code Analyzer?

I'm looking for a Roslyn code analyzer that checks for proper use of Regex - I cannot use the Regex source generators yet, so I want something that checks that Regex with a const pattern uses .Compiled and that any .Compiled is not leaked (must be static readonly). Also, would like some sort of analyzer to check for dangerous dynamic Regex patterns without timeouts and any other Regex best practices.

Trying to log database operations into file and insert values into db using ef core at same time

Processing failed: The process cannot access the file 'C:\Users\user\RiderProjects\TestMigrations\driving-school-booking-system\MainProject\MainProject\Logs\logs.txt' because it is being used by another process.
Processing failed: The process cannot access the file 'C:\Users\user\RiderProjects\TestMigrations\driving-school-booking-system\MainProject\MainProject\Logs\logs.txt' because it is being used by another process.
Hello guys, I'm trying to read from a file and inserting into my database, which I was able to do. The problem is since database is already in used, I'm not being able to log the operations in my log file. So I was wondering what is the issue here, is it some kind of threading issue where same thread can't access database more than once and we can resolve it using some kind of multi-threading ?...

Cannot resolve symbol 'HttpPostedFileBase'

My IDE does not recognise HttpPostedFileBase although my code declared using System.Web as per documentation ``` [HttpPost] public async Task <JsonResult> CreateUser([Bind("ListingName")]ListingProjects_ver2 obModel, List<IFormFile> file) {...

Avalonia Issue

Im having an issue in my wordle clone with when i type with the onscreen keyboard then press the enter key it types the same character that you pressed. Its been giving me quite a bit of trouble. I have a relay command named Press() and it calls the typecharacter function. Im thinking that it is the problem but i cant see anything. https://github.com/NoahWeddles/Wordle-Clone

How can I keep Azure prices down

Last week we had a new person join our team at work. His name is Jack. I asked Jack what the job market was like. He said it wasn't good. I also asked him what skills he believes are in demand. He said cloud. So, I've got to get experience at Azure, the cloud I know something about. However, I am not going to get much experience at using Azure, or any cloud for that matter, at work. I have experience at migrating small SQL Server databases to Azure SQL. I've created Resource Groups and have done some basic IAM. And I've created several Azure Key Vaults. But I don't have any experience at things like Azure Functions, Azure Logic Apps, using PaaS in Azure, etc. Things that a developer who works designing and implementing cloud solutions would know and do. I have always shied away from getting a cloud account because of the alarmist stories I've heard of developers signing up for an account with a public cloud provider one month, then the following month getting stuck with a bill that runs into the thousands of dollars. Of course, I could sign up for a simple Azure tutorial. I've done that, more than once, but they tend to be very narrow and once I'm done with the course, that's it as far as using Azure anymore goes. (At least, that's always been my understanding.) But now, given what Jack said, I think I've got to bite the bullet and get an Azure account. But I've GOT to keep it as cheap as possible. For those of you with experience at using your own Azure account, how do you keep the costs down? What advise can you give me, please?...

โœ… .Net Digital Persona Integration Task

I have digital persona device that i want to setup. application is already built you just have to adjustments. Like settings buttons, layout and some fixes

Reading CSV file in C#

Hello guys, quick question. I need to read a csv file. Is there any recommended way of doing it or I just stick with the classic way of reading the file line by line and spliting them by the common delimiter? I read that their are in-built libraries for CSV, should I use them ?...

.NET Api Setup

Hello all, I just need advice in the setup of my .net project. I was making it using the typical Unit of work (Repository) architecture where you have a unit of work & services that call unit of work which has a bunch of classes that are repositories. ...

Clipboard.GetImage() handling webp.

Im trying to save copied image from clipboard to file, problem is if that image is .webp it is all black pixels. I tried pngencoder, using writablebitmap, skiasharp... I think the bitmapsource cant handle webp as Clipboard.GetImage() returns BItmapSource? Any ideas?

Need help with assignment

Hi, Iโ€™m working on a C# assignment for my course (Designing and Developing Object-Oriented Computer Programs) and Iโ€™m honestly a bit lost. Iโ€™m still very new to C# and programming in general, so I was hoping to get some guidance on how to approach it. Hereโ€™s what the assignment is about: Calories Tracker App...