C#

C

C#

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

Join

✅ Aspnet runtime not found when running, but present in dotnet --info (linux)

I'm having issues trying to run Aspnet applications on Linux Mint. Running dotnet --info shows both the dotnet and aspnet runtimes, but when I try to run the aspnet application I get an error stating that the framework is not found. I've since reinstalled dotnet manually instead of with the package manager and checked that the files are all present in the home directory. The app is using dotnet 7 with dotnet 8 installed, but this happens regardless of what dotnet version I use. I'd really app...
No description

✅ Mac is not supported by Visual Studio anymore, There is not download link for Mac user anymore,

I have checked the Microsoft page. VS has not been suported for Mac user since 31 August 2024, Rider is not free, there is only option for me VS code. I am just trying to create environment for basic C# code implementation to see the difference between Java, I am a new learner, I have cloned this git repo https://github.com/derekbanas/C-Sharp-Course.git which contains pretty good c# fundamental examples but I can not run any test I want to run C# Code / Program.cs file but I can not run it , what I am missing...
No description

✅ Hey IDK how to use NetSpell

This is probably really simple thing to do but IDK the keywords, and functions and methods to Netspell package and I can't find them on internet. I already installed the NetSpell package.

Need help with AspNetCore and GUID.

Well I have got the following code for my register method in my webapi (Shown on first image. It is pretty simple). I am running my xUnit test for this method (everything is good) but it seems that I can't access my user.Id normally (I am returning it via "return Ok(user.Id);" line). Somehow debugger shows me that I have got two Id properties, one is actual Id and another just filled with zeros (shown on second photo). I would be grateful if someone explains me what is the problem with them and...
No description

✅ .NET workloads not found when searching

Hello. I'm trying to install the iOS workload using the dotnet CLI. However, when I go to search for the iOS workload, I cannot find it. It happened the same with when I tried to install the android workload. That issue was fixed by just updating dotnet. However, this time it isn't fixed even after updating to the newer version. Any ideas that could be causing this? OS: Arch Linux x64 .NET SDK version: 8.0.402 Workload version: 8.0.402.1...

What the best way to handle splines/rail grinding in Unity?

Hi everyone! I'm working on a 3D sonic physics engine and I want to integrate splines with a player controller, but most of the tutorials I’ve found only show how to use splines for creating mesh paths or moving prop objects along a path using spline_animate. I'm looking to implement more complex mechanics like: Rail grinding: The player can move along a spline and jump off at any point, with speed carrying over. Auto-running sections: The player should be able to transition into a spline-based path, but their current speed should carry over instead of being reset....

What's the correct way to handle state in a SignalR Hub?

I am going to implement a SignalR hub which will be connected to by a client application. The purpose of this being SignalR and not just HTTP requests is so that I can send messages from the server back to the client at any point without the need for something like port forwarding, just ad-hoc, and I will also use the connection to request general data too, so I don't need more than one connection to communicate data either direction. I would like to authenticate the client with an API key when it connects, or allow it to connect unauthenticated so I can pop it up on my control panel and assign it a new API key and identity remotely (remote provisioning, essentially) What would the correct way to do this be? I understand that sessions are not available as a result of "duplex messaging" which makes perfect sense, so my other idea was to do this with a scoped service to hold some state data for the connection, but as far as I can tell, the DI scope is not guaranteed especially if the hub is connected via HTTP polling instead of WS....

C# winforms need help to do this..

I have a typing software I have virtual keyboard the expected key get's highlighted when it's needed to be pressed but I want to achieve one thing which is I want a virtual hand that is showing each finger placed over the default hand keys and then when the highlighting of needed keys by placing the hand finger on it I hope you got what I mean

✅ Storing user related data when using an auth provider

Hello, When using an auth provider, all the user data, like ID, email, etc. is stored and managed by the provider. Regarding that, do I need to store the user data in my SQL database and make relation based on that? Or would it be better to simply add an extra userId column to tables where needed and leave it be? (without any relationship)...

✅ Explicit interface implementation

Hi, guys. Maybe it's a stupid question, but can someone explain me, what is explicit interface implementation used for? I heard it can be used if a class inherits the same method from two interfaces or if one class inherits from another one which, in turn, inherits from an interface and the first class should implement it in its own way. These cases seem confusing and unlikely. Probably I don't understand the importance of this concept, so I ask you to tell me about occasions, when it could be useful. Thank you in advance....

nugget package update

I have a doubt. I recently did a nugget package update to my project and when I try to run my site in local. I'm getting a pop up
No description

✅ Help with small error

Git failed with a fatal error. Git failed with a fatal error. error: open("RealiserenThema7_8/.vs/RealiserenThema7_8/FileContentIndex/09aad924-6fda-4fa9-9462-6c498d674d0c.vsidx"): Permission denied fatal: Unable to process path RealiserenThema7_8/.vs/RealiserenThema7_8/FileContentIndex/09aad924-6fda-4fa9-9462-6c498d674d0c.vsidx does anyone know how to fix this when im trying to push to devops...

✅ Command Not Found error

I have created console app, I want to run hello word but some reason I am having this error although I have add C# Dev Kit extention , What can be the reason?
No description

ASP.NET Identity Login endpoint returns schema in of auth tokens

what the title says. I assume there some kind of messed up in my configuration somewhere, but i dont know where to start looking i also assume this is because of how this method is somehow supposed to return data without returning anything......

How do i put "" Inside a String?

I wrote down "
Console.WriteLine("Welcome to "Program"")
Console.WriteLine("Welcome to "Program"")
" And it simply told me theres an error. How do i fix that?

✅ ASP.NET razor

Why do I have to manually open a web browser and navigate to localhost:5030 to view my web UI? Why doesn't it just open up automatically after running dotnet run?

Need help for my escape room array field

Hi, I want to make an console escape room and I want to create a field with a key and a door. Can someone help me with this ? Im pretty new to programming

FileWatcher for project folder

```csharp string outputDirectory = AppDomain.CurrentDomain.BaseDirectory; string projectDirectory = Directory.GetParent(outputDirectory).Parent.Parent.Parent.FullName; // Navigate to the project folder this.watcher = new FileSystemWatcher();...

✅ Trying to make an undo function on my paint program thingie

so i started making a paint program in vs console bc i was bored and i need to rack up experience in coding, but im unsure of how to utilise stacks/ why my code doesnt work https://paste.mod.gg/rokqfntmjjcd/0 my entire code is in there and ill add snippets i dont understand in replies

CheckPasswordSignInAsync returns fail when password is correct

``` [HttpPost("login")] public async Task<IActionResult> Login(LoginDto loginDto) { if (!ModelState.IsValid)...
No description