C#

C

C#

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

Join

Force Clickonce to use a specific port?

How can I force a clickonce setup and the update mechanism to use a specific port? including the initial connection

ILogger<T> extension method "pass the args".

I am trying to create an extension method on ILogger<T> called LogPermissionDenied. I have a custom IPermissionDeniedErrorFragment which is an auto-generated interface from Strawberry shake based on a GraphQL fragment, that doesn't really matter that much, it is just to provide some context. The ILogger<T> has a method called LogError with an overload that accepts an string message and a params object?[] args...

Uninstaller won't remove AppData\Local expanded files.

Hey all, new here. I have a .NET 6 WPF app with an installer project (Microsoft Visual Studio Installer Project 2022) I added and "mostly" works fine. The issue is that the uninstall is not removing the temp files. I have an AppData\local collection of expanded on-demand files, but when uninstalled, it leaves them behind. Is there a native way to have the uninstaller remove them, or do I need to make a CustomActions class to explicitly remove them?...

Is List.Contains(Object) checks by address or by value?

Hi, if I have the following List/Dictionary (I know it doenst matter in this question): I want to check if a drink is inside the dictionary like this - Drinks.ContainsKey(drink) I'm not sure if it will check by value like if all the values inside the drink are equal or it will check if this is the identical drink (by adress). I want to point out that I overrided Equals inside of Item....
No description

Delay While Page Loading

while navigation from one page to another is taking so much delay why here i have attached the three Document and one video in Basci text i have the App.cs And Mauiprogram.cs all the This ...

Issue installing NUnit

Hello, I have been trying to install NUnit to add unit tests to my main project. To do so, I created a new project on Rider. The file structure is the following: \ \MainProject.sln \MainProject.csproj \TestProject\TestProject.csproj...

✅ building nativeaot project with static library still requires library to be copied

i have tried to build nativeaot project with: ```xml <ItemGroup> <DirectPInvoke Include="raylib"/> <NativeLibrary Include="raylib.lib"/>...
No description

✅ cleanup

dotnet clean not removing obj and and bin folders

ViewFeatures, but something that isn't deprecated?

Trying to use this kind of code line: public IEnumerable<SelectListItem> AuthorList { get; set; } Works fine, if I have: using Microsoft.AspNetCore.Mvc.Rendering;...

".NET MAUI iOS Simulator Error: 'Please connect the device' with UDID, stuck after build"

I'm running into an issue with .NET MAUI on iOS. I keep getting the error: Please connect the device ':v2:udid=8B56F350-7124-4C30-A582-30BC84EF1BE6'... This UDID is for my simulator, and I'm unsure how to resolve this. I've followed the official MAUI docs, but still no luck. ...
No description

.Net 8 Web Api Config

Deployed webapi in IIS. Previously using .net 4.5.* where changing config in application settings in UI and restarting for dynamic change. Now in .Net 8 using Environment.GetenvironmentVariable, on publishing generated web.config file but adding values doesn't reflect and added values to pool also none but when added to system level it works but it takes time to recognise. Tried ChatGPT and older relevant question here and none working can someone point me in the best direction? TIA

✅ How do I pin both NET 8 and NET 6 sdk versions in global.json?

hi everyone! if I pin the 8.0.204 sdk in global.json for some reason it wants to pull version 6.0.35 of the Microsoft.NETCore.App.Ref nuget package. is there a way to pin both the 8.0.x and 6.0.x versions of those nuget packages? at my company we are using internal nuget repositories and we don't have a way to pull those internal SDK nuget packages automatically

UWP MAUI building problem

Hi ! So, I was testing Jetbrains Rider, as I have a free student account, and when I want to run on debug the basic MAUI template for Windows (UWP), it just doesn't work and throw me this error : Registering UWP app with manifest: D:\Programmation\CsharpProjects\MauiApp3\MauiApp3\bin\Debug\net8.0-windows10.0.19041.0\win10-x64\AppX\AppxManifest.xml arch X64... Register application failed return code is 1. STDERR: ERROR: The asynchronous operation was failed: E_ACCESSDENIED General access denied error (hresult_error:80070005)[location] = Z:\BuildAgent\work\40149736ac453055\dotnet\Rider\Native\Solution\winrt_launcher\src\utility.hpp(41)[function] = void __cdecl jbrs::wait_for_finished(const struct winrt::com_ptr<struct IAsyncInfo> &)[uri] = D:\Programmation\CsharpProjects\MauiApp3\MauiApp3\bin\Debug\net8.0-windows10.0.19041.0\win10-x64\AppX\AppxManifest.xml...

Windows Authentication

Hello, I have this blazor application that uses Windows Authentication. Everything works well but not on some deployments, I know Negotiate should only use HTTP1.1 but in some of these deployments it only uses HTTP2 and doesn't try to downgrade. I have checked everything I know including kestrel which I already use HTTP1andHTTP2...

Migration issues -EF core.

I am creating a DDD application with EFcore but I am not able to use the migration because of the following error. Does anyone know how to solve this? can provide code snippets if needed...
No description

Join to other table in LINQKit Predicate

hello, assume that i have a query ```c# var allClasses = from s in context.Classes select new ClassView { Id = s.Id, Name = s.Name,...

✅ How to debug a visual studio extension?

The project is open on a new VS "Ext" intstance but no breakpoint get hit
No description

my MVC view thinks my model is null!

I wanted to load backend data (MariaDB via Rider) onto my browser as part of developing my simple ASP.NET Core web app. The problem now is that the browser does not display the backend data (it thinks my model got null data, as per screenshot) If I check the data table and columns etc I see it is not null; ```mysql> SELECT * FROM ListingDBTable; +----+---------------------+------------------------------+------------+------------+...
No description

WPF login system

Hey all! hope everyone's doing well. I wanted a bit of help on a PRS system that I'm developing for a personal project. I want to make a login system for it using JSON but i've never actually read/wrote to a json file. im using the Nuget library as i've been told it would be best for me so i'm sort of just going with that. could someone help me on how to read from the json file and where exactly to start with the verification of it. my code and window has been attached below as screenshots. woul...
No description