C#

C

C#

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

Join

✅ Unable to create a 'DbContext' of type 'ApplicationDbContext'.

hi 👋 i'm trying to structure my project with DDD model but getting this error: Unable to create a 'DbContext' of type 'ApplicationDbContext'. The exception 'The entity type 'IdentityUserLogin<string>' requires a primary key to be defined. ...

I want to add content to my database's table from API's data I pulled from an external source.

public async Task<Results?> pullGoogleInfo() -> Which pulls Places API data from google Places API. public async Task StoreInDB(Results apiResults) -> Stores the content inside my DB (PostgreSQL). It adds row for each JSON element inside the data of google. Now, I want to create a controller which uses those methods and I apply this controller with swagger. I got this idea from chatGPT (OF COURSE) but I don't understand what he explain much, so I need help please. ...
No description

Sign In a user signs in but doesn't authorize, blazor, sever side rendering

If sign in manager works base on result.Succeeded being true user is an IdentityUser I can extract Roles and Claims ```var result = await signInManager.PasswordSignInAsync(user, Input.Password, true, false); if (result.Succeeded) {...

✅ Is there a more efficient way other than ConcurrentQueue?

https://github.com/NoubarKay/MiniOps.Nucleus I have provided the code. You can find exactly the usage of it inside of RequestStore. It basically stores a list of requests, until i flush them out after a second. Any help would be appreciated!...

✅ Most suitable IDE

Hi everyone! I was wondering what you guys see as the IDE standard for C# .NET development. It was always Visual Studio, but nowadays we have full AI integration in other IDE's, such as Cursor and VSC. Which one are you currently using and why? Because I'm currently doubting about which one I should take after developing in VS for a few years. The problem I'm facing is the fact that the AI support in VS is to slow compared with other IDE's....

✅ WPF Image tooltip display issue in fluent style with .NET 9

I upgraded a wpf project to .net 9 recently to try out the new fluent style. I set the ThemeMode="Dark" property in app.xaml. I have a simple image that I display in a smaller size, and there's a tooltip inside that displays the image in its original size. This is the markup I have for it: ```xml...

✅ Looking for someone to help me learn C# :)

Looking for someone to help me learn C#, if you can teach at a slower pace like steps per day or a couple a day that would be nice 🙂 I do have a learning disability this is why it would be easier to do it in chunks

✅ Setting up C# in VS code

Having a issue, setting it up or whatnot? I'm not sure what the problem is.

✅ Help with http request

Hey guys, i'm having a wierd issue, i made a trial request to my mysql service provider via postman and it works fine, but when i try to do it via c# code, it returns with a 401, what's wierd is i used same auth ticket for both: ```bash curl --location 'https://spending-juanthehuman.turso.io/v2/pipeline' \ --header 'Content-Type: application/json' \ --header 'Authorization: ••••••' ...

DMX over UART bus on Raspberry Pi

Hey everyone, I'm currently trying to get an app running on my Raspberry Pi 5 that sends out DMX. DMX is a standard for communicating with lights: https://en.wikipedia.org/wiki/DMX512 I'm using this head for it: https://bitwizard.nl/shop/DMX-interface-for-Raspberry-pi I'm using this library for it: https://github.com/BrunoDPO/DMXSimples...

Entity framework overwriting List works?

I always thought that just overwriting a List like solution.Skus = []; doesnt work since the change tracker doesnt update everything, but after some testing it seems to work. Why does everyone then always says to not do this? ```...

✅BinaryReader reads garbage when reading from compressed stream

This is a weird one - I think. So I have a rather complex data type that I write to and load from disk. I'm using a ZipArchive to get some data compression. Writing basically looks like this: ```cs using var archive = new ZipArchive(someFileStream, ZipArchiveMode.Create, leaveOpen: true);...

string x = "6";x = x.Replace("6", "4");Console.WriteLine(x);

'why cant i use int here? thanks for the help btw

Profanity Filter

So the biggest advice I've gotten to learn programing is to just make stuff. So I thought I'd take what I saw from my latest lesson and try and apply it into something familair. I was learning boolean expressions and how the example showed a string and how it detected if the term 'fox' was present. I thought, 'Ok I can see how that comes in handy, it's probably how websites and stuff find and filter out profanity. So I decided to make one one but every time I run it, it comes back not detecting any. Is this because I have the user input the string? Or is there something I'm missing. Also this should go without saying but the code contains a number of dirty words so it'll be blurred for those who don't want to see it....
No description

Im getting an error code when trying to call a method.

I am following a youtube guide please explain what I am doing wrong because his code looks just like mine.
No description

Type identity mismatches in plugin framework when plugins depend on one another

In a plugin framework, suppose that one plugin has a dependency on another. As per https://learn.microsoft.com/en-us/dotnet/core/tutorials/creating-app-with-plugin-support, I've given every plugin its own AssemblyLoadContext, while the shared 'core' library is loaded into AssemblyLoadContext.Default. This has worked fine to avoid type identity mismatches on types of the core library. However, I've run into a different source of issues. I instantiate plugins as follows:...

✅ ILC AOT Analysis IL1005

So I'm working in a NativeAOT env, and I have this little chunk of code:
C++
[RuntimeImport("testGCC")]
extern static void* testGCC(void* a);
C++
[RuntimeImport("testGCC")]
extern static void* testGCC(void* a);
...

✅ need help with a basic code

nt x= 6 ; int y = 7; Console.WriteLine("what is x+y?"); string input = Console.ReadLine(); int answer;...

✅ Can you recommend me tools in C#

Hi, I'm planning on building a food ordering app, kinda like Uber Eats, and I'm thinking of adding a map feature. Any C# tools you'd recommend for this?
No description

How to use embbeddings. Net

Hello, has .net some libraries to work with embbeddings? Whats the most integrated vector db?