C#

C

C#

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

Join

How flexible is NSwag?

I’m working on a project with my team where we currently have a home grown schema generation (similar to OpenAI) as well as a client generator (that uses handlebar templates). My team wants me to move us over to swagger, which is simple enough. But they also want me to implement a drop-in client that mirrors the existing one today. I know NSwag has customizable liquid templates for this, but it sounds to me like they’re kinda not recommended to use for anything too extensive since NSwag could easily break them in an update. ...

hi can i some good short and sweet C# ?

some tutorials of C# please (3-5) hours, i can take videos that have parts

Access is denied problem

I have a problem. When i'm trying to run my c# code (with or without debbuging in visual studio 2022 it shows me "Access is denied"... I tried almost everything i can find to fix it but nothing worked please help...

[YARP] How to set up a reverse proxy for another full web server in a sub path?

I have a Qliksense server on some domain and I have its certificate (pfx) and I want to make a reverse proxy to it with ASP.NET + YARP the issue is when I set the proxy prefix as /qlik for example and go to localhost/qlik it would gives me 404 because the qlik server would read /qlik as a route and will try to fine the page that called qlik but when I remove the prefix of /qlik in the transform section...

.NET Modelstate does not apply validation

Hello, I'm currently developing my first .NET web api/Angular project. I'm nearly done with it, currently developing the test project but I'm facing a problem with this create function. I'm trying to test if it throws an error when i leave the name property out (which is required), but my modelstate does not stop it. (Modelstate remains empty) ...
No description

2FA? Is it hard to implement?

How hard is it to implement 2FA into a log in. Using something like google Authenticator?

EF Core 1-1 relationship with automatic discriminator

I have a CommentsThread entity and multiple ICommentable entities (Blogpost, Profile, Document, etc.) that all reference it: ```cs public sealed class CommentsThread { public long Id { get; init; }...

thinking how my code should look like

```cs using System; using static MyFunction.Function1; public class Program...

How to Setup a remote Blazor server on Ubuntu

Hey all, I'm working on a project and I'm getting overwhelmed with the options and need some guidance. I'm developing a Blazor project on my windows pc and trying to host it on an Ubuntu pc/server. It sometimes works, but I can't seem to get it to run as a service on the server. To help troubleshoot, I want to remotely attach to the process, but it's not being detected. Right now, I'm publishing to folder (debug as opposed to release) and uploading the files to /var/project. I'd like to attach to the process at the very start, but I can't find how. Ideally, I'd like to be able to start debugging on my windows pc, but run on the Linux to see why it's failing....

Api Method Name Attribute

Hi, i just wonder what the name property inside the HttpMethod attribute is for? I read it can be used in MVC a lot when calling other controllers or getting their routes. So I have something like ```csharp...

remove or minify variable names out from compiled exe

I dont see the reason why variable names are compiled inside the exe file data when if the target is debuggin there is the .pdb file with all the debugin information it not just makes file larger (i know that wont do such diference) but probable also slower to load (also probably no palpable diference)

need help making and deploying a postback api

if you have any knownledge please get in touch

Validate datagridview cell values

I have a data grid view that my user can edit and add new lines This is my grid: Quantity | Item | unit price | price The column quantity needs to be a number ...
No description

Hi, how I can use Python commands in C# Windows Form .NET Framework

How I can use Python commands in C# Windows Form .NET Framework

Hangfire Execution Time

I have a recurring job I've scheduled in Hangfire. If the app is not running and misses executions, then it might run multiple times when the app starts again. How do I get access to the time that the job was supposed to have run for, but was missed? It doesn't look like Hangfire provides any context for the job execution in the called method. Is this the kind of thing that has to be applied with a filter?...

Application fails to find DLL that is in the same directory

I've added a DLL reference to my project, which compiles just fine but when the application runs it fails to find this DLL even though it's in the same directory. How would I debug this?
No description

How to distribute VisualStyles for dialogs Vista style - FIXED!

I created a self-contained package and it works. Problem is that in my project C# WinForms, I use System.Windows.Forms.VisualStyles to have dialogs in Vista style, but the sytle is not applied as if I used normal dialogs. What should I distribute to make it work? Note that the software works as expected if executed from Debug folder or from the IDE itself, but not from the Release folder after the self-contained packags is created....

[Rider] Incompatible framework for unit tests

Hi, would anyone know how to run unit tests on a windows-forms solution on rider? When I want to add my windows-form solution to my unit test project using the references, it tells me that there's a problem with incompatible framework (btw both have the same versions) Preview of problem : https://streamable.com/ymnra5...
No description