C#

C

C#

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

Join

Garbage collector

Hello, please tell me, who knows about the "garbage collector" in C#, how to search for garbage leaks in a C# program, are there any tools for viewing references to an object in the heap, because of which the "garbage collector" does not reach and does not remove them.

Need help with fixing my rounded rectangle calculation

Hi! I'm making script for Unity. I'm bad at understanding floating points calculations and geometry, so it might be silly. Help me please ```c# public RoundRect(float width, float height, float r) { if (width < r || height < r) { throw new Exception("Radius"); } this.width = width - 2*r;...
No description

I want a page to play music in my WPF app, I have it working at the minute, but there is a problem.

I have a function that when a specific page opens, it starts playing music. It works fine, but when you click off the page or go on it multiple times, the music starts slowing down and bugging out, and it starts using absurd amounts of RAM. Voice calls in Discord also sound ass when it starts bugging everything out, but I'm guessing that's due to the RAM problem. I just need help trying to figure out how to stop and sort of dispose of the music, so it's not even being used in the code anymore, untils it's page is opened again....

Is there a way to create an AWS SAM image on docker with compose ?

Hi , I 've a doubt about AWS SAM. Is there a way to create an container on docker who run like LocalStack , and provide SAM server and SAM build directly from container ? I want to do on this way, beacause i want segregate this from my computer, i dont want to install. I want to do this for .NET CORE 8.0...

changing a boolean value outside a loop from inside a loop

so im doing a leetcode challenge to detect duplicate numbers in an array, im trying to use the duplicate bool value so when a duplicate is detected, it edits the duplicate value to true and exits the loop, no matter what i try the output is always false however ```cs public class Solution {...

NUnit test with Asp net web API

Hello, Im having trouble to setup NUnit tests for the API, as of now it seems Ive managed to start the service and it's running yet whenever i send the data to my endpoint it simply returns a 500 message...

Convert from MSSql to MySql

I'm trying to convert this MSDoc tutorial project from a local instance of MSSql to a MySql server. I'm fairly certain I've gotten all the configuration correct, except the syntax differences of MSSql to MySql. (i.e nvarchar) I pushed it to GitHub if someone is able to take a peek at it. Thanks in advance. https://github.com/Cykotech/RazorPagesMovie...

what are hashtags for in C#?

i've written C# for a month and have zero idea what these hashtag symbols are for. like #define - what does that do?

Need help

``` public static string CaesarTower(int n) { if (n < 1) { throw new ArgumentException();...

Code to Diagram (EF Core Power Tools) very beginner question

Hi, Tldr: How to show .dgml as graphic in Visual Studio 2022? Answer: Install DGML Editor from Visual Studio Setup....
No description

✅ SDK 8.0.403: System.InvalidOperationException: No workload set information

I'm currently running into an issue that impacts all of my C# projects after an SDK update. I have tried to look for similar issues and haven't seen any that relate to this version. dotnet info posted in comments OS is OpenSUSE Tumbleweed RPM install ...

Intelisense unexpectedly broken in VisualStudio.

Don't know what happened but recently i am unable to build even fresh project from visual studio. It produces this ```NuGet package restore failed. Please see Error List window for detailed warnings and errors. Error occurred while restoring NuGet packages: NuGet.PackageManagement.VisualStudio.Exceptions.ProjectNotNominatedException: The operation failed as details for project Test2 could not be loaded. at NuGet.PackageManagement.VisualStudio.CpsPackageReferenceProject.GetPackageSpecsAndAdditionalMessagesAsync(DependencyGraphCacheContext context) at NuGet.PackageManagement.DependencyGraphRestoreUtility.<GetSolutionRestoreSpecAndAdditionalMessages>d__10.MoveNext() --- End of stack trace from previous location where exception was thrown ---...

NuGet package project references

I need to share a project from my solution as a NuGet, to provide base implementation types for my application's plugin system. Let's call this project BasePlugin. BasePlugin has project dependencies that must be supplied with the produced NuGet package. I was able to configure that; the built nuspec file contains the required project references....

✅ I'm looking for performance and load testing data on ConfigureAwait(false)

I cannot find any proper performance and load testing data on ConfigureAwait(false) for .NET 8 API's and azure functions. I want this info in order to make educated decision on using it.

✅ FileNotFoundException: Could not load file or assembly. The system cannot find the file specified.

I'm modifying an application using AsmResolver and adding a new assembly into the module references, but for some reason .NET can't find the referenced assembly even though it's right there in the same folder as the one I'm editing. Attached is a minimum reproducible example, and a video showing what's wrong. I also tried editing the .deps.json file, since this guy https://discord.com/channels/143867839282020352/1288099229834805248/1288099229834805248 had success with that and a similar problem,...
No description

VS intellisence when building dotnet runtime locally

Hi! I cloned the "runtime" repo and followed the steps to setup my PC to build and test it locally. The build works but when I open some of the solution I have intellisence errors : Reference to type 'ValueType' claims it is defined in 'System.Runtime', but it could not be found Am I missing any setup ?...

Dapper Migrations

Hey, looking for tips around dapper and handling migrations / updates to domain entities. So can keep log of changes in the database and run SQL scripts r likewise to keep the database sync and allow other devs in team to sync their local databases. Basically to get the same concept as would with EF migrations. The team I’ve joined prefers Dapper for lightweight reasons and ability to control SQL ran on queries and such....