C#

C

C#

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

Join

How to Start with ASP.NET Web API

Hi, @everyone I am new to ASP.NET Core I want to build a simple login & signup page using ASP.NET Web API
frontend is on react.js database is MongoDB...

Wrong DataContext Inference?

First of all I am still a beginner, so I might not completely know what I am saying. So I am building an Avalonia MVVM app, it is an inventory management system. I have used Postgres for the database. The problem here is, in InventoryView, the commands to edit and delete rows can not be resolved. Rider tells me that the datacontext for the commands is InventoryView, which should be InventoryViewModel, if I am right? I am very new to Avalonia, and only familiar with Winforms, which a lot different....
No description

Selecting and filtering from a list with full nullable safety & warnings as errors

I have the type Btn in my sample below which simulates the portion of WinForms that I'm interested in. I have a list of Btn objects and my goal is to mutate it into a subset of Btn objects that have their Tag matching the Wanted type without being opaque to the static analyser that detects potential null references (and avoiding the null-forgiving operator) I ran the code below over on https://sharplab.io and it does not complain that OfType could return any nullables....

Trying to Get Start with Entra ID and Blazor / .NET Core API

Looking for some good MS docs on using EntraID with .NET, I found this doc https://learn.microsoft.com/en-us/entra/external-id/customers/tutorial-web-app-dotnet-sign-in-prepare-tenant but this is for External ID. trying to find something like this for Entra. Or am I just over looking this. Wanting to dive into this, trying to know of the bits that move. At a high level trying to find all the docs that will point me in the right direction to do the following. - Blazor Frontend that will authenticate all users....

Date not getting in required format.

I want date like this 2000-11-11, I am sending like this in postman, But API taking it like this {11-11-2024 00:00:00}. How can I fix this. I am compairnig date in database and date coming through client.
No description

Threading and Microsoft.Data.Sqlite

I'm using multithreading. Each thread will make a query to a SQL Database by using a static class. They should all use the same SqliteConnection connection object that is a field of static class SqlDatabase. ...

Wpf binding failures

I'm getting xaml binding failures for HorizontalContentAlignment and VerticalContentAlignment for my ListViewItem. It seems like it isn't able to find these props for the ancestor control. Can anyone help to fix this?
No description

include project dependencies inside dll

Hi, I want to be able to use my class library inside other project with only the output dll
No description

Naming factories “class”factory always a good idea?

Hi everyone, I’m just learning about design patterns, and all code examples I’ve seen highlight their implementation with obvious examples such as “DogFactory” etc. I’m wondering if this is usually done in practice, or if the class name should instead represent its purpose in the code, for example:...

Rider completion sort criteria

By default, it groups the suggestions by their kind (property, method). It lumps the stuff from the base classes together with the stuff from the subtype. I can't find a way to make it put the derived stuff up top.

what am i doing wrong

S is just walking back and LeftShift is Running, Im trying to make it so if you walk back you cant sprint
No description

CommunityToolkit discussion: handling Receive async await

Looking for a little advice on the subject. I've found a workaround for the moment, but if there are any other pearls, I'm open to suggestions how better to handle things. Semi intermediate subject I suppose; possibly advanced as it deals with potentially nuanced async await. https://github.com/CommunityToolkit/dotnet/discussions/983...

Hangfire recurring-jobs struck in queue

Hi team , I have scheduled a hangfire job to send mail at 9 30 pm everyday. It is hosted in IIS( .net core app). For some reason it will get struck in the queue. when ever I open the dashboard , it will get automatically execute. I have set IIS startmode alwaysrunning and Idle timeout 0. I want it be up and running all the time without getting struck in queue. Please help...

VSCode set dotnet sdk directory

I have a specific version of dotnet installed on my machine for a project, I can't replace the system wide one installed through my package manager since other things rely on it. I tried to set these in settings.json:
"dotnet.dotnetPath": "/home/seanomik/.local/share/mise/installs/dotnet/9.0.100-rc.2.24474.11",
"dotnetAcquisitionExtension.sharedExistingDotnetPath": "/home/seanomik/.local/share/mise/installs/dotnet/9.0.100-rc.2.24474.11"
"dotnet.dotnetPath": "/home/seanomik/.local/share/mise/installs/dotnet/9.0.100-rc.2.24474.11",
"dotnetAcquisitionExtension.sharedExistingDotnetPath": "/home/seanomik/.local/share/mise/installs/dotnet/9.0.100-rc.2.24474.11"
...

Insert Method does not insert or save the user input as wanted

I have a working UI with a text field to enter a property name like "Ca* Oro Bridge" on my MVC view. The save button is also displayed on the view. Onclick it does not save the userinput in the text field (henceforth it is also not saved in the DB). I have debugged the follwing code responsible for handling user inputs ```[HttpGet] public IActionResult InsertListings() {...

HTTPClient 'Host' header is not sent when 'DefaultRequestVersion' is set to 'Version(2, 0)'

When I specify 'Host' header it is not being sent when I am trying to use HTTP/2 request version. It is sent when I use HTTP/1.1 but I need to make HTTP/2 requests. What do I need to do to achieve that? I am using dotnet 8....

Incorrect Position for syntax tree nod

As you can see by the debug log provided, the absolute position given by the request is so far off from its actual position? the position I'm looking for is the object creation node, and basically all i want for now is to detect when the cursor is in the braces (scope) of that object creation. and of course it is, and the token at the cursor should be a blank line inside (or what ever I type next) inside the cursor, and yet its ActorTrait??? The absolute position is far off from the actual pos...
No description

.NET MAUI Android Licenses

Visual Studio and the Android SDK Manager refuse to accept the Android licenses. Everything was fine until I updated to VS 17.11.5. I've already tried reinstalling things with no luck - any thoughts on this would be appreciated.
No description

Restoring packages takes way too long

I use dotnet 8 and JetBrains Rider. Recently after creating a new project I noticed that restoring packages takes at least 10 minutes. Every time I rebuild a project or install net nuget packages I have to wait. The project is new and I only have a few nuget packages installed. ```xml <Project Sdk="Microsoft.NET.Sdk">...

how to delegate on static method

Hi, I want to delegate from a static method to delegate trapped exceptions from Godot. By nature, all un-caught exceptions from this block are caught inside Godot and only logged at the end. ```csharp catch (Exception ex) {...