C#

C

C#

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

Join

โœ… .NET 8, EF Core, Fluent API - Schema definition is ignored when accessing via DbSet

HI, I would appreciate some hints where I have made the mistake. I am running an ASP.NET API. I am relying on EF Core for data accessing ORM. The db is scaffolded with Code first approach. I have created and mapped a new Entity. ``` protected override void Up(MigrationBuilder migrationBuilder)...

anyone want to make an exucutor for Roblox

We will share the profits in a ui designer been doing ui since I was born ๐Ÿ˜‚ get in touch I already have the key system donโ€™t just need the main functions sorted out

Blazor Forms and Different Sessions

Hi all, I'm working on a simple webpage (functioning as a homepage) with blazor (server). My current goal is to create a contact form at the bottom of the page, where customers can send a message to staff. I created an EditForm using a model and used MailKit in the code fragment to send the message submitted by the EditForm via our mail server. This worked as expected until......

Create data during EF6 migrations

Hey guys, in our project we use some kind of "changelog implementation" to track all changes in our data. For some reason we also need to create changelongs with default values in case we add let says new columns to DB tables and I dont know what's the best way to do it. Currently I'm playing with some kind of DbCommandInterceptor that detects DB update process (applying migrations), parse them and create records accordingly but I'm not sure if that's correct approach. One of the reason I dont l...

System.AggregateException in TCP requests

I'm trying to make my own version of HTTP, however I get the following exception whenever I try to communicate between my client and server: System.AggregateException: One or more errors occurred. (Unable to read data from the transport connection: An established connection was aborted by the software in your host machine..)

โœ… EFCore issues when removing an entity,

Hello, so currently im having a bit of issues, im using InMemoryDB. So i have this setup where i have an Item(dynamic data) which user can change, and ItemData(static data). ItemData belongs to some ItemCollection(there are multiple item collections). Now when i combine 2 items, i remove them and create next level which i get from ItemCollection.Items, basically next index from current ItemData....

SocketException, TCPListener, TCPClient reason?

a) Why do I get a SocketException when opening a TCPListener + TCPClient @ IP 127.0.0.1, Port 5089 (there is only my listener at that port, and only my client sends on it) telling me the system actively refused the connection - however it still goes through and sends everything/gets received?! and the firewall didn't block it b) what information to look at to know such stuff?...

incredibly slow ctrl-click-to-go-to-definition feature VS2022

So, I'm working on this codebase, and for some weird reason, unlike most other codebases I've worked on, it's basically impossible to get the IDE to show me where something is defined first by ctrl-clicking it- as is usually the case. Say, I'm clicking the FormattedMessage here while holding CTRL, in the pic- it refuses to do anything....
No description

โœ… need some help making a program

buuuuuuuuuuut im getting errors idk how to fix
No description

FileSystemWatcher causes user limit exceptions on Kubuntu Linux

Using the following code results in the exception The configured user limit (128) on the number of inotify instances has been reached, or the per-process limit on the number of open file descriptors has been reached.: ``` public static void Init(string ProjectPath, List <ProjectFile> ProjectFileList, List <ProjectDirectory> ProjectDirList, List <Icon> IconList) {...

Build order with dotnet build ...?

Hi, Im using VS code for my C# development. I have some MSBuild Tasks that create assets that are used by other projects. Now, when I run dotnet build at solution level, the asset producing projects always run late. So I have to run it twice. I created a script to build each project in order by calling dotnet build on the project level. However, some commands like dotnet publish or dotnet release seem to work better and easier on the solution level. So I wonder is there maybe a trick to define the order? Maybe in the *.sln file? Or can I define it in the debug|release section somewhere?...

Change language at runtime in WPF

Hi! I have a set of *.resx files with translations and they work fine when I start the app. If I start on computer with english system, it chooses english translation, if I choose spanish system, it loads spanish translation, etc. But how can I change it at runtime? Currently, I'm doing it in this way: ```C# <Label FontSize="10" Foreground="Gray" Margin="0,10,0,0" Name="languageLabel" Content="{x:Static p:LanguageVersion.Settings_Language}"/>...

Cant find design view for win form

I installed visual studio 2022 on new laptop. I cant find design view anymore. Before it would usually start up the form file as form but now it wont. I have tried things like shift f7, right clicking my file(but there is no option to view as design when i right click), I have also trierd changing web forms designer setting to start in design view, If anyone could help me would be great

Error MSB4018: The "Message" task failed unexpectedly

When building my asp.net app via a gitlab runner, I get the error error MSB4018: The "Message" task failed unexpectedly. This seems to be connected to some nuget packages, but I disabled every package except Microsoft.AspNetCore.OpenApi and Swashbuckle.AspNetCore. What else do I need to change that this error stops popping up? It seems to happen during the restore process....

LastIndexOf method can't find index of ";" HELP

Hi, I'm a newbie junior full-stack developer working mainly on the front end using React and JS. I now got assigned to a .Net core (version 5) backend project and my PC got a weird bug??? LastIndexOf method did not work when finding the index of a semicolon only on my pc on the attached picture it could not find the first ";" in the string, ...
No description

โœ… best UI framework?

I wanted to start making apps with a decent ui, but i don't know what to use. is WinUi3 good?

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...