C#

C

C#

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

Join

Hi any one have C# validator for Apple purchases JWC for storekit2?

I try to validate Apple purchases on my .net core website but I do not have good example and every things I try fail.

Confusion with nullability of a custom LINQ method

I have this custom extension method I used a lot in my project, however every time I use it, it trips nullability checks and thinks I'm using a possibly null value. ```csharp /// <summary>
/// Tries to get the first item that meets a condition from a collection. /// </summary> /// <typeparam name="T">Type of items in the collection</typeparam>...

✅ I need help with Aspnetcore Identity in clean architecture

What the correct was to integrate identity with clean architecture? As I understand I shouldn't extend domain user model from identityuser. Should I have separate dbcontexts to manage domain users and identity user? I need user + roles + permissions to secure my app

i need help with .NET Blazor web app cockies

I recently started working on a Blazor web app project, and when I got to the login part, I faced a problem where the client does not save the cookies. What’s strange is that in the refresh token request, the operation succeeds and the token actually appears, but it’s not present in the cookies. The second time, when the JWT expires and a refresh token is sent, the cookie still doesn’t appear...
No description

✅ how to learn C# for mono game?

Hey, im interested in gamedev, what to make games with monogame, but i dont have a lot of c# knowledge, what to do before starting monogame? here is an example code that i just dont seem to understand how it works: ``` using System; using System.IO; using System.Text.Json;...

✅ Beginner question about formatting

Hey all! I'm learning the basics and struggling a bit to understand why the second picture correctly displays the message. While trying to format the output text I also tried to do: - Console.WriteLine($"Celsius conversion: " + {celsius:F1} + " Celsius."); and it obv resulted in some kind of syntax error. ...
No description

✅ Question about crosscompatibility and function usage

I have a question, i want to convert one image type (eg jpg) to another (eg png), i want the program to be cross compatible with linux and windows, will System.Drawing.ImageConverter or System.Drawing.ImageFormatConverter do what i want and be cross compatible? thanks in advance

Blazor app wont use tailwind js files during navigation

I added tailwind and added the js file to app.razor and put them in the correct folders, why dont they get loaded when using a link, but do when I enter the url to the page or when I hit refresh? Happens while using the NavLink and anchor https://github.com/chrisb123/BlazorTailwind...

✅ [.NET Minimal API's] How to design expansion of data through my API?

Hi guys, I am designing a small toy project, basically a flash card application where a user can create sets of flash cards. I have the following models:...

[Microsoft.StylusInput] Deployed software is suddenly not working anymore after a Windows update

After 8 years without any issues, we just got many reports that an exception is now triggered, related to .NET's Code Access Security. Is there a way to avoid this without resuscitating and modifying this old project? And how to know what recent change triggered this issue? System.MethodAccessException: Attempt by security transparent method 'Microsoft.StylusInput.ComObjectCreator.CreateInstanceLicense(System.Guid, System.Guid, System.String)' to call native code through method 'Microsoft.Ink.UnsafeNativeMethods.CoGetClassObject(System.Guid ByRef, UInt32, IntPtr, System.Guid ByRef)' failed. Methods must be security critical or security safe-critical to call native code. at Microsoft.StylusInput.ComObjectCreator.CreateInstanceLicense(Guid clsid, Guid iid, String licenseKey) at Microsoft.StylusInput.DynamicRenderer..ctor(Boolean isControl, IntPtr handle)...

[.NET 6] Fault contract not working

Why is my fault contract not working anymore after I added a CallbackContract to my ServiceContract. The request just spins until it timeout but never receives FaultException on the client

How to determine SEO + competitors at the same time

Hi everyone, When you need to check your website's SEO or see how your competitors compare, what tools or methods are they currently using? I'm familiar with several sites like SimilarWeb and Google Insights, but SimilarWeb is expensive, and I don't see much use for ProductHunt because you still have to pay....

Deep copy of a NaryTree

I am trying to implement a copy constructor for a BehaviorTree (special case NaryTree). The tree is defined as: ```csharp public class BehaviorTree { private BehaviorTreeNode root;...

Difficulty Retrieving MeetingId for Teams Meeting Created via Calendar Event using Microsoft Graph.

I am working on integrating Microsoft Teams meetings with a .NET 6 backend using the Microsoft Graph API. In my implementation, I create calendar events with online meetings enabled by setting IsOnlineMeeting = true on the event object. The creation of the meeting itself works fine, and I receive a joinUrl link which attendees can use to join the meeting. However, I face a significant challenge: I need to programmatically retrieve the Teams meeting ID (meetingId) after creating the event, which is crucial for functions like fetching attendance reports and meeting insights....

Invalid option '14' for /langversion with .NET 10 installed and in use

I cannot for the life of me figure out what's wrong here. I just switched the projects in my solution over to .NET 10 and C# 14, confirmed we are building with .NET 10 and bundled MSBuild, but it fails to recognize C# 14? C:\Program Files\dotnet\dotnet.exe exec "C:\Program Files\dotnet\sdk\10.0.100-preview.7.25380.108\Roslyn\bincore\csc.dll" 0>CSC: Error CS1617 : Invalid option '14' for /langversion. Use '/langversion:?' to list supported values. ...

Terminal toggle on Visual Studio.

Is there a way to set the terminal to toggle on Visual Studio?

WPF App Issue With MSAL

I have a WPF app I am setting up using Microsoft AD/Entra for authentication. The app is only in production right now for 10 or so users ... will be hundreds over the next 12 months. Right now the problem is that about half of those 10 users are having issue when the app loads. The login screen, whether using WebView2 or Chrome/Edge, never loads. Or if it does load (which takes like 2-3 minutes) ... the screen is white....

Project advice

hey yall, at what point would you guys recommend someone start a project of their own, im currently like 3days into c# but im really excited about starting a project

Dilemma with JWT Management in Blazor Server + Worker Service + Centralized WebAPI

Hello community! I'm facing an architectural dilemma regarding JWT authentication management in a scenario where I have multiple types of clients and a single centralized WebAPI as the backend. I would really appreciate insights from anyone who has solved similar problems. Context:...