C#

C

C#

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

Join

what type of pattern would u use?

Particle Manager, Particle Emitter. each particle emitter has its own animation output 'json' i need some kind of emittergroup or multiemitter that share 1 animation output...

Make WPF clicks go to the window below.

I'm trying to make an overlay timer app, and I'd like to make it so it sits on my screen and I can still click the window focused below, but the overlay takes in all the clicks.

Uri.TryCreate failing when input is from Chinese localized text

I'm sorry in advance if I'm rambling :email: I have text command that accepts a url from a user, my program needs to verify that the user input is actually a url. So I run it through Uri.TryCreate. The problem I'm having is that when the input is by a user who has a system set to the Chinese language, when inputting a valid url it always fails. I found that this is because their system gives a slightly different set of english characters that normal. Not sure if it will be visible in discord but these are their and my versions of input text. I'll include a screenshot of the text in a different editor just in case....
No description

Trying to understand proper error handling

I am trying to write my code to properly handle errors and I am getting so hyper fixated on it that I can't tell whether I'm making good decisions or not. I have rewritten the way my code base handles errors several times and I'm not sure what the right approach is anymore. I originally started using my own implementation of the result pattern, then realized I have this issue where the status code wasn't correct when returning errors, so I said maybe my implementation isn't that good so I looked for a library and settled on ErrorOr, but soon realized its the same issue, I dont understand how you can tell the "result pattern" that this error is a 401, 500, or 400 etc so I gutted that out and started writting my own custom exceptions and made a middleware that handles all the exceptions but now Im reading that you shouldn't throw errors when you now how to handle them and that throwing excessive erros will cause performance issues....

Can you map a project as an external reference to a project in .NET Aspire?

I have a .NET backend API project, and a React Vite frontend. Everything works fine debugging locally, but when I generate a docker-compose file with Aspir8 the frontend with has a HasReference(api) gets the "internal" docker url, but Id like to get the "external" (it will be external from docker but still "internal/localhost") and the published port of docker?

✅ Padding option does not work in winforms

Im trying to make a sidebar and to make it i placed a panel and a button on top of that after that i gave it an image and tried to get it a little to right using the padding option but it did not do any changes even if i used left, right, top and down sections how can i get my image to right?
No description

✅ how to make a borderless winforms moveable?

Hello im new to c# and Winforms and i was trying to make a custom panel for my application but i had a problem about dragging i want to use the white border to move the application how can i do it?
No description

.NET Core OnModelCreating gives me error

Hi, ive always used this code but now the highlighted code crashed the Update-Database when I try to Add-Migration and Update-Database. If I remove the highlighted code it works. I cant see whats wrong here, is it something new with .NET 8 that makes it not work?
No description

✅ Base64

Is there a way I can compress Base64 and then decompress it? I can't sotre a string longer than 100 characters in the Discord SelectMenu value....

Single Project Fails With Missing DLL When Started Up With Multiple Startup Projects

I've configured VS for multiple start-up projects, five in total. These are all API projects with no reference dependencies on each other. My fifth project, lets call it MainApi, runs fine on it's own, but when I add it as a fifth startup project, it fails with Could not load file or assembly 'Shared.Logging`. Any guesses as to why this is?

✅ ABP.IO framework, can't open the swagger

I'm using abp version 9.0, but the problem is when ever i create a new app the swagger doesn't work, this error show up "Refused to apply style from 'https://localhost:44389/global-scripts.js?_v=638710662962456189' because its MIME type ('text/javascript') is not a supported stylesheet MIME type, and strict MIME checking is enabled" i can't open the swagger page at all, if someone can help
No description

VS Designer load issue

Ive tried many solution, like running as admin or reboot, but it still keep showing the loading windows and not the designer
No description

✅ Web project used to work, now msbuild failing but nothing has changed in the source

I have just opened up a project that was working fine last time I was compiling it (lets say 6 months ago), since then only thing I can think of that I have done is install .net 9, but other than that nothing has changed with .net to my knowledge. The projects in question are still targetting .net 8 anyway. So with that out of the way whenever I try to compile a Microsoft.NET.Sdk.Razor project which contains a section to copy static content: ```xml...

✅ jwt token

Hello guys, hopeyou are doing great in new year, I am new to dotnet, and actually facing a probelmregarding JWT token and appriciate any help:) The point is, I'm using dotnet 8, and added the JWT using using Microsoft.AspNetCore.Authentication.JwtBearer; which works completely fine on dev environment, and I have set up the setting for it like this: Logging": { "LogLevel": { "Default": "Information",...

✅ C# Issue with animation

My animation do not work, is there another way to animate the guna seperators like going clean (one visible-false and one will turn visible)
No description

Othello game

I have a little trouble understanding what I am supposed to in game manager. From what I have understood this is all it’s supposed to do. I have written this code but it’s hard to try it when I don’t have the other parts.

Is there a way to make this a shorter phrase.

I was wondering if i was able to put both input under the same name. something like
if(cheeseburger){jump}
if(cheeseburger){jump}
, rather than this ```using System.Linq.Expressions; using Unity.VisualScripting; using UnityEngine; using UnityEngine.InputSystem;...

✅ Smpt | email sending

Hi, I have a problem, I uploaded a project to github with the function of sending email in smtp, but after cloning the repository on another computer, this function does not work. It does not send the email. I added a secret manager for the password just like on the computer from which I sent. Does anyone know where the problem is? I checked and on one computer the email goes to the same account and on the other it does not, I did not change anything in the code, the only thing I did was delete...

Surprising performance problem under debugger

Using NET 8.0 and Visual Studio 2022 Enterprise. I've written an application that reads large XML files, does some processing on them, and then inserts records into SQL Server. It works great, except it's slow. It executes 400 to 500 batches per second when I run it. That stinks!...

Redis | Weird Issue

A exact same piece of code where run within EC2 to connect to redis and overwrite a value returns timeout error. Where the exact same piece of code called within aws lambda updates within a second
Next