C#

C

C#

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

Join

How to distribute VisualStyles for dialogs Vista style - FIXED!

I created a self-contained package and it works. Problem is that in my project C# WinForms, I use System.Windows.Forms.VisualStyles to have dialogs in Vista style, but the sytle is not applied as if I used normal dialogs. What should I distribute to make it work? Note that the software works as expected if executed from Debug folder or from the IDE itself, but not from the Release folder after the self-contained packags is created....

[Rider] Incompatible framework for unit tests

Hi, would anyone know how to run unit tests on a windows-forms solution on rider? When I want to add my windows-form solution to my unit test project using the references, it tells me that there's a problem with incompatible framework (btw both have the same versions) Preview of problem : https://streamable.com/ymnra5...
No description

Tutorials

Are there any good youtube tutorials for C# and winUI3?

How can I use wpf with c++?

Someone got some harebrained idea to develop a c++ application with a GUI, so I thought of how WPF allows you to develop in C++ (which it then translates into C#, if memory serves me right). I found this documentation page: https://learn.microsoft.com/en-us/dotnet/desktop/wpf/advanced/wpf-and-win32-interoperation?view=netframeworkdesktop-4.8 Which presents several ways to connect a C++ application to WPF in the section called "WPF Interoperation Projects", I would like a recommendation on which is the simplest, considering that this will be a simple app and I don't have experience coding C++ for a WPF application. And also some help on how to implement it (later, not now)....

Error: The value of shadow key property 'ResourceDemandChunks.Id' is unknown when attempting to save

Hey everyone! I'm stuck with this problem: The value of shadow key property 'ResourceDemandChunks.Id' is unknown when attempting to save changes. This is because shadow property values cannot be preserved when the entity is not being tracked. Consider adding the property to the entity's .NET type this is how I register entity in db context: ``` modelBuilder.Entity<WorkingTaskEntity>().OwnsOne(c => c.CustomData, t => ...

βœ… Exceptions

Are exceptions essentially if statements that are global across the entire program?

shorter way of writing x => x.Length()

I thought you could just put string.Length? but you apparently cant? is there no way to write it shorter?

When I select a category from a picker, I want only its children to appear in the other picker

I have 3 pickers and in these pickers I have parent, child and subchild categories respectively. When I select the parent category, I want only the children of that parent to appear in the other picker as an option.However, when I select the parent category, the second picker appears empty. When I remove the Parent Category, my normal child categories appear.
No description

βœ… Possible null reference assignment warning on event unsubscribe

On the following code gives me a CS8601: Possible null reference assignment. on build. ```csharp // View.razor.cs internal EventHandler<FocusSectionEvent> FocusSectionRequested = delegate { };...

AWS Cognito as IDP - Federated Auth flow - token endpoint from API

Hi, I am running an Angular app backed with ASP.NET 8.0 API. I am to implement Fed.Auth flow - first provider would be Microsoft Entra(AD). I am using Cognito as IDP for classic username+password flow. ...
No description

Does Visual Studio come with IIS Express

Hello, Just wondering if IIS Express came with Visual Studio. I'm not quite sure what this is, but after some research I think this may have came bundled with VS and is some website hosting stuff? Also does this cause a "My Web Sites" folder to be created in documents containing all sorts of files? It was created the same time as IIS Express folder....
No description

SignalR Groups not working

Nothing special, just trying to use groups in SignalR and it's just not working. Am I doing something wrong, and if not, anyone see this issue before? .NET 8 Works...

Not sure what Senior Dev expect me to do

Hello, I'm moving my post to this forum so it will be more visible. I just finished in my job simple endpoint that returns paginated result, we use clean arch with mediatr - easy. My handler looks something like (pseudo code) ```class GetItemsHandler : IRequestHanlder<PaginatedResultsDto<ItemDto>>...

βœ… Strange colleague

Hello, there's a colleague in my company who behaves oddly. I enjoy simplifying processes and finding better solutions for repetitive code. I implemented some patterns that reduced the workload and cleaned up messy code. And after that he starts play envy because seniors speaks high about me. But I found out this days he often reworks my solutions in regular code part in very vague solution. Instead of discussing his changes, he just pushes them without explanation, and his modifications often make the code more bug-prone. We don't have much competition in the company since we work in a niche area. His programming skills are questionable, but he understands the overall process better than I do. Despite my efforts to collaborate and be a team player, he constantly tries to assert dominance, making me feel inferior. ...

βœ… What exactly is .NET?

Could someone break it down to me like i'm 5 y/o?

Can't autoresize height of row ( datagridview in winform)

I I am using the DataGridView control for WinForms programming. I have set the WrapMode property to True and the AutoSizeRowsMode property to AllCells, but the height of the cell I am editing does not automatically adjust when I enter a lot of text, causing the cursor to move to the next line without expanding the cell height
No description