C#

C

C#

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

Join

Cant bind styles to elements

Hi!! Actually I am very new to WPF and would appreciate some assistance with a problem I have with this. So this is the element tree looks like: Main Window - > contains Navbar -> contains Nav Button <- used by Base Button...

✅ Event Handler functionality

Hi, I have an assignment where I need to create a list of rooms, each represented as a unique object. When a user clicks on a room, they should be able to press a button to request a booking for that specific room. However, I'm unsure how to use the selected room's object to transfer its details to another page, where the user can continue adding booking information. Any guidance would be appreciated!

FileNotFoundException: Could not load file or assembly 'System.Data.SqlClient, Version=0.0.0.0, Cult

``` public void makenewuser() { string constring = "Data Source =LAPTOP-3KI3JMHO; Initial Catalog = Stormz; Integrated Security = True"; using (SqlConnection con = new SqlConnection(constring)) try...

Array as Public Property; Need to Set Value at Index

I come from C/Lua/VBA background, very new to C# or anything like it. Using .NET 9 and Onvif.core with VScodium/Omnisharp on Windows. Onvif.core has this class: ```C#...

C# Compress with large window size (26)

I want to compress files that are big so i need to have a larger window size but i dont find any way to do it brom brotli encoder and all the third party libs are ass slow as hell with same parameters help.

im watching a course about asp.net and creating some kind of web

but everytime i try to do "dotnet ef migrations add init" it says "Unable to create a 'DbContext' of type 'RuntimeType'. The exception 'Unable to resolve service for type 'Microsoft.EntityFrameworkCore.DbContextOptions`1[api.Data.ApplicationDBContext]' while attempting to activate 'api.Data.ApplicationDBContext'.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728"
No description

Planning an app out before starting

I want to make a gong fu cha (tea brewing style, the main thing is that it involves even up to 10 steeps, first ones are short and they're getting progressively longer) timer & steep counter app with a statistics tab. The timer should allow to set a base steep time and an increment to be added each round. The app should allow to see how many brewing sessions there were each month. Each session should have the tea's name in it and a space for flavor and scent description. I'll be using AvaloniaUI and focus on mobile. I guess I'm going to need some sort of database for the descriptions and saving the sessions, I worked with entity framework and postgresql before. I want to give test driven development a try, seems like a good thing to know, although I don't know if I'll be able to do it before determining the app's structure down to each function and accurately tell what needs testing and what doesn't. Did I miss anything important?...

Serializing a Function in Unity using AnimationCurve

Hey there guys, I'm working on a game with Unity right now and I have a few classes which basically represent certain types of functions that I want to use in some contexts. What i would like to know is if there is a way to translate my functions into animation curves (ideally using a custom attribute such as SerializeCurveAttribute) so that I can use Unity's built-in serialization for said curves. I'm not quite sure how to go about this, as I've barely written any attributes, and the decompiled code for Unity's SerializeField literally contains nothing. Here is the code for my curve classes: ```cs public interface ICurve...

FirstOrDefault and other methods are not working in LINQ

```C# using System.Diagnostics; using Microsoft.AspNetCore.Mvc; using practical.Models;...

scope of a for loop

what is the scope of i in for (int i = 0; i < Length; i++) { }? does it only exist within the for loop? if i want i to be used outside, i need this right?
i = x
for (int i = 0; i < Length; i++) { }
i = x
for (int i = 0; i < Length; i++) { }
...

EFCore Discriminator Issue

Getting a very strange error on creation of my context. Ive been unable to figure out why this is popping. I was hoping that someone has experienced this prior and may be able to help.I can share any other info needed, just didnt want to overload the images. Thanks!...
No description

FluentUI Blazor rerender dropdown Items in ComboBox

<FluentCombobox ValueChanged="QueryChanged" Placeholder="Know it? Search for the title" Items="@_songOptions" Style="width: 100%"/>
<FluentCombobox ValueChanged="QueryChanged" Placeholder="Know it? Search for the title" Items="@_songOptions" Style="width: 100%"/>
With this element I hoped to update _songOptions on QueryChanged, but it doesnt get reflected in the dropdown options. To trigger refresh I have to click outside of the element, and then click back on it....
No description

blazor authentication service (WEB Api server)

i'm back end dev and i got no idea how i need to do Client side auth, any tips (or link on guide)? This is my Back End Controller i think to do AuthService in client side ```cs using Application.Users; using MediatR; using Microsoft.AspNetCore.Mvc;...

✅ Problem updating rider

Hello guys, I tried to update to the latest version of rider but the thing is I didn't have enough disc space and so the update was cancelled. Now that I made enough space, when I try to update it again, it seems that nothing is happening, I had the "update" button but when it finish updating, the IDE remains as it is and it seems that when I click on certain buttons, like settings or plugins, nothing happens. Is there any solution to tackle this issue please... I even try to invalidate caches b...

How to integrate RabbitMQ on a Microservice architecture

Hi guys, I have an app with a .NET back end made in multiple services, and those services are communicating with http requests, but some of them I'm waiting for a response when I do not need, I could just send to a messenger service like RabbitMQ, but there are some cases where I want to wait for a response to get data, from the videos that I watched about RabbitMQ, there wasn't one that showed how to wait for the other api's response, can someone send me some content or explain how can I implem...

Looking for some NoSQL database with this characteristics

Good people, did any of you know some NOSQL database with this characteristics: - (Hopefully) an API or some other code neutral way to interact with it directly. - Reliability > Speed (Or anything else really, i need it than the data is reliable). - Have scripting capabilities, something similar or on point with SPs right out of the box would be good. - Can be installed locally, preferably using Docker but that is not a requirement....

✅ Avalonia Message Box

In Avalonia you can create a message box with this tool: https://github.com/AvaloniaCommunity/MessageBox.Avalonia, but how can I see what I clicked on the Message Box. Imagine I had a messagebox with Yes or No as an Option. How can I simply find what option I clicked and do something if i clicked either yes or no?

✅ Else condition refusing to work- looks correct.

first one is what i'm trying to solve, second one is what the error shows, and the third is something else that looks the same but still doesn't work.
No description

Cookies and JWT for Authentication

I'm working on a project and need help identifying an authentication issue I'm facing. My project uses ASP.NET Core 9 for the backend and React for the frontend. I recently converted JWT authentication to use cookies, but now authentication is not working. The claims properties are missing, and the user is not getting authenticated. If anyone has experience with this, please help. I Update the ProgramFile as well
`builder.Services.AddAuthentication(options => {...

Avoid a Build Every Time I Call MSBuildWorkspace.OpenSolutionAsync

I'm working on an app to help me do some analysis or querying of a codebase, using the Microsoft.CodeAnalysis features. I start out like this: ```cs public async Task<SolutionModule> OpenSolutionAsync(string solutionFilePath) { var workspace = ConfigureWorkspace();...