C#

C

C#

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

Join

ADO.NET Error

Hi everyone, I'm running into an issue when trying to add an ADO.NET Entity Data Model in Visual Studio 2022. I get a System.Data.Entity.Core.EntityException with the inner exception saying: "An attempt to attach an auto-named database for file ... failed. A database with the same name exists..." It seems VS is looking for the .mdf file inside the VS Installation folder (Common7\IDE) instead of my project folder....
No description

Flickering (/blink) bug effect on opentk

```cs public class FrameBuffer2D {
public FrameBuffer2D(IntPtr renderer, int width, int height)...

Allow intellicode/copilot during debugging?

Does anyone know if it's possible to uncheck "Disable during debugging" for intellicode like there was in 2022? I don't see an intellicode section in tools>options any more, and I don't want to have to stop debugging every time I want to make code changes if I want FIM.

Best way to process queue events in .NET without blocking or losing backpressure?

I’m working on a .NET microservice that consumes events from a queue (Kafka, Service Bus, etc.). The queue already guarantees ordering per key/partition, so ordering is not the problem. The issue is how to process messages concurrently without losing backpressure. Problems I’m trying to solve: If I await HandleAsync(...) directly in the consume loop → processing is slow, consumer builds lag....

An unhandled exception of type 'System.AggregateException' occurred in System.Private.CoreLib.dll: '

``Exception has occurred: CLR/System.AggregateException An unhandled exception of type 'System.AggregateException' occurred in System.Private.CoreLib.dll: 'One or more errors occurred.' Inner exceptions found, see $exception in variables window for more details. Innermost exception System.IO.IOException : Received an unexpected EOF or 0 bytes from the transport stream. at System.Net.Security.SslStream.<ReceiveHandshakeFrameAsync>d__1511.MoveNext()...
No description

✅ Visual studio code

made a website #web
No description

Rider - Custom Roslyn Analyzer

Hello! I wrote a custom Analyzer for Roslyn to show some errors on Rider which works quite well. The goal is to "simply" detect if a method called EventManager.Attach(EventHook.MyEvent) was called and if it is : we look for a EventManager.TriggerEvent(EventHook.MyEvent) to check if the generic version was properly used or not (because there is a non-generic version and a generic one) It works properly to check cross-files and show errors on Rider. However, this line triggers a warning (RS1030 : ...

✅ Tips Debugging in Visual Studio Community

Need help tips for debugging with Visual Studio 2022 Community. There is a project where I have to fix bugs. Want to understand the workflow of a project quickly. Any tips? (.NET Core Web API in the backend) and (ASP .NET Core in the frontend) #help...

I have created an ASP.NET project (not done yet) and I don't know how to organize the folders inside

Are the folders of "Models", "View" and "Controllers" suppose to contain everything else? The picture shows how my structure looks like right now, (I don't have View since I don't use razor pages), am I suppose to put all of the other folders inside Models? Or Models only include the files of the models (how the database looks like kind of)?...
No description

✅ Fake loading bar

I'm trying to make a fake loading bar but it's not printing the bar in the same line code: ```cs using System; using System.Threading;...
No description

Linq+File

Can you give me some tips ? I only created seed file info writer to create and fill file with data (Step 1 and 2) Let's make two txt.file 1) Customers.txt 2) Orders.txt...

VS Code: The .NET SDK cannot be located (steamOS)

I am attempting to use a steam deck game dev with unity and VS code gave this error one day. I DO have .net sdk installed and it is set to PATH. I have tried uninstalling C# extentions and re installing. As well as removing dotnet from this computer and re installing. Nothing as worked. full error: The .NET SDK cannot be located: Error running dotnet --info: Error: Command failed: dotnet --info /bin/sh: line 1: dotnet: command not found...

✅ SignalR getting connectionID from userID

Basically iam using signal R and i want to send notifications to a specific user via their userID i dont want to store connectionID in DB because its transient and i dont want to make a group for each user and i dont want to make a custom mapper either there must be a way in signalR to do this in a clean way...

Importing minimal set of classes from project A to project B

Project A has a class I need. But it depends on some other classes within the project. Is there a way to export the class with all dependencies within the project? As I want to try it with a few versions of project A, I don't like the idea of manually copying files....

Culture.invariant

Invariant culture is only used to keep visual studios from choosing the current date and time on the computer that and THATS THE ONLY FUNCTION OF IT Like in this example cs Datetime Today = DateTime.ParseExact(“6/12/1999”,”m/d/yyyy”, cultureinfo.invariantculture);...

I am unsure how to go about learning Entity Framework Core.

That might not even be the part I'm having the issue with, though it is an issue. I've been trying for the better part of 2 months to make some kind of headway into ASP.NET, or Entity Framework Core, or Razor, or... whatever these things are and whatever it is they're trying to accomplish. I have not been able to find any information friendly enough to my lack of understanding of what any of those are to learn the basics. The Microsoft tutorials seem to assume I have information that they...

Odata nextlink

Hello guys, i havé an odata controller, and i m trying to catch the nextlink value in order to paste it into the response header. I tried using the odatafeature().nextlink in a custom action and in a custom middleware but everytime its null, even though the @odata.nextlink is present and with a value in the response on the client side. The only way that seems to work, is by using a custom middleware, deserializing the body stream, and catching the nextlink… any advice or idea?...

FluentValidation validators not registering in DI despite using extension method

I’ve implemented a validation pipeline, but it doesn’t retrieve any validators. The dependency injection container returns an empty collection, even though the validators are registered.
No description

Reorder itemscontrol without resetting the item

Hi. I have an ItemsControl. It takes in an ObservableCollection, and it generates a long list with input boxes and other forms based on that observablecollection. I have been trying to reorder items in the list (the application is supposed to be a sort of scriptlike thing), but every time I change the order it resets the textboxes for instance to old values. ...