C#

C

C#

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

Join

Need help Publishing / Trimming my Maui / Blazor app

Currently if I enable trimming in any way shape or form it completely breaks my app. I have a linker xml set and all my libraries set to be completely preserved in the linker. Here is a link to my CSProj file and my Linker.xml https://pastebin.com/5Pa7exw0...

React + .Net core api issue

Hey everyone, I need some help with an issue I'm facing after deploying my React + ASP.NET Core Web API project on an AWS EC2 Windows Server (IIS). Project Setup (Development) β€’ Frontend (React): o Works fine locally on: ...

Azure function connection string from azure app configuration store

Hello, I need some help. I have an Azure Function that is triggered by a Service Bus queue message. One of the parameters is the connection string to the Service Bus. My problem is that I am using Azure App Configuration Store to store shared connection strings between apps. The connection strings are stored in the configuration in-memory like this: configuration = configuration.AddInMemoryCollection(config); However, there is a problem when I try to run the app. The Azure Function is not able to read the connection string from the configuration, and I am getting this error: Service Bus account connection string with name ServiceBus:ConnectionString...

system project problem

hey everyone! I'm a C# beginner and I'm having some problems on my system code (It's a billing system). Every time I click total, always shows that I need to put a cash amount, idk if this is an window popup error (this also my problem on my login and register password hashing even though I followed it). Does anyone willing to help and teach me how I can fix this? Thanks in advance and have a great day! 😸

Extending a razor component so I can make developer experience a bit easier

Hey there, this might be a qustion that has no answer but Im making a small library so I can easily use Lucide icons in my blazor web app. Ive made a small component that is basically a wrapper around the svg data: LucideIcon.razor: ```cs...

Creating a method that takes a generic method and its variadic parameters as arguments and call it i

I need a way to pass generic static methods and its argument to another method, and the static method inside this another method. In C++, I can easily achieve this with variadic templates and std::forward: ```cpp #include <utility>...

Why do my regex matches have 2 instances of one group?

I have this regex to pull two pieces of information from each method overload declaration in a class. The methods all look like this: ``cs public bool RetrieveServiceCache(service_cache service_Cache, ref DocumentModelFailureCount responseCache, ref String sLog) ...

Calendar functionality

What are some things you have to think about when implementing a calendar functionality into a webapp? Are there any good C# libraries for doing this πŸ˜„ I'm planning on building the backend with ASP.NET Core....

JWT Token Error

Guys I am having this issue even though jwt token is correct ``` Microsoft.AspNetCore.Authentication.JwtBearer.JwtBearerHandler[1] Failed to validate the token....

Error with Console and int variables. Syntax error?

```csharp Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("nice! i'm a yellow guy, fyi! " + favouriteColor + " is still very cool, though."); Console.WriteLine("... \nhey! i've been working on my math recently, how about we give it a go?"); Console.WriteLine("type one number you want for me to add to another, \n make sure it's just a number and nothing else!")...
No description

EnumerateFiles Blocks UI thread even in Task.Run()

I'm writing an application that needs to validate a user-given directory by searching for specific files in said directory. I'd like to run the validation in the background so the app doesn't freeze up. I've tried a few suggestions and still ended up here asking because it seems EnumerateFiles refuses to run on another thread. Following is a functional example as a .net8 WPF application....

βœ… How to make httpcontext threadsafe?

I have this: ```cs public sealed record UserConnectionModel { private readonly CancellationTokenSource cancellationTokenSource;...

What blazor template do I start from...

I templated out Blazor Server - and noticed after updating to .net 9 that MS no longer even offers that template anymore when spinning up projects in VS2022... Is going the signalR route for intranet apps (These are purely just CRUD apps for our internal databases) a bad call if it seems like MS moving to kill it already? If so, wtf do I use? Selecting the Blazor Webapp starter I am greeted with the option to do Server, Client or Auto interactive rendering. I don't want to sell my team on something if it's look obsolete already, basically....

Lucene.net problem with wildcard search

I have a worker service that writes data into a lucene database. I have tried different analyzers all have the same problem. (the problem is most likely in my search code) ```cs // var analyzer = new KeywordAnalyzer(); // var analyzer = new WhitespaceAnalyzer(luceneVersion);...

How to run a Windows Forms project on Linux

I know I know, there are better ways than windows Forms, but i have a project which works with files and i want to know how it is possible to run the .exe file so the openfile dialog works on linux too. I know that .exe files are not 100% supported, but there are workarounds like wine or bottles. But how can I make Wine or Bottles or any application so that it gives me a legit open file dialog that works for Linux and it shouldnΒ΄t be something that is a open file dialog for windows on Linux. I a...

βœ… What is the syntax for generics in methods signature

Hello guys, consider the following: TraverseBreadthFirst<T>(T, Func<T, IEnumerable<T>>) Declaration:...

2D Movement

I am trying to make a code that moves left and right for unity in a 2D project, but there is a weird error occuring. Can someone help? using UnityEngine; public class Movement : MonoBehaviour...

Entity Framework Entity Saving

hi guys can someone help me with EF? I have a Visitor and want to add a plannedVisit to it public sealed class Visitor : Entity<Guid> {...

βœ… Why is it not working

Im a beginnier at coding in C#. I tried making player move and i added those inputs but only W works and the rest doesnt i deleted the W input to check if it does something and it didnt yet player was still moving when i pressed W. Can i fix it somehow?...
No description