r/DotNet – Telegram
r/DotNet
11 subscribers
485 photos
56 videos
11.5K links
.NET Community, if you are using C#, VB.NET, F#, or anything running with .NET... you are at the right place!

Part of @reddit2telegram and @r_channels
Download Telegram
CLI notes app in .NET 10

Just finished building a cross-platform CLI notes app in .NET 10! 📝

Add, list, search, and delete notes
Tags support
Works on Windows, macOS (Intel & Apple Silicon), and Linux
Single-file, self-contained binaries

Would love to hear feedback from fellow .NET devs!


Link: https://github.com/IcyDrae/CliNotes

https://redd.it/1pwrher
@r_dotnet
Debianet - A Debian based WSL distro for .NET development
https://redd.it/1pwvjjz
@r_dotnet
Why is Remove method available on FrozenDictionary via CollectionExtensions.cs

Can someone help me understand the design choice or history background here? The Add method is protected with explicit implementation, which is great, but Remove is exposed as an extension method on IDictionary. Why was it implemented this way?

        FrozenDictionary<string, int> frozenDict = new Dictionary<string, int>
{
["one"] = 1,
["two"] = 2
}.ToFrozenDictionary();

// frozenDict.Add("three", 3); // Cannot access private method 'Add(T)' here

frozenDict.Remove("one", out var value); // Will throw
Console.WriteLine(value);


https://redd.it/1pwwt06
@r_dotnet
Has any one used .NET API (AOT) for mid sized api. Need to know if its good for production

Was checking the .NET API AOT and found it to be pretty fast (for obvious reasons). I generally use the traditional API (The non AOT one). Starting a new project which will soon be in production so margin for mess up is low. So was just wondering if I can put AOT as an option for the team or just stick to what works.

Just wanted to know if others have successfully used AOT for production API. Not just micro services but entire things like login systems for apps and subnoscription services to track payments which are critical areas for apps.

Or do you recommend to keep it limited to micro services only.

https://redd.it/1pwzrkd
@r_dotnet
New C# ML Library in Development – Looking for Contributors!

Hi r/dotnet community!

I’m building a C# ML library called ML.cs – a lightweight alternative to ML.NET, focused on simplicity and ease of use.

Current Features:

CSV reading (`readcsv`) returning a dictionary of data
Handling nulls (getNullSumdropRow)
Data preprocessing in progress

Planned Algorithms:

Supervised: Linear Regression, Logistic Regression, Naive Bayes, SVM, Random Forest
Unsupervised: K-Means, Hierarchical Clustering, DBSCAN
Future: Deep learning models

How You Can Help:

Clone the repo and implement algorithms in the `Algorithm` folder (`supervised` or `unsupervised`)
Suggest improvements for preprocessing, data handling, or new algorithms

Project Goal:
Make machine learning in .NET simple, educational, and collaborative.

Repo: https://github.com/RohanGoparaju028/ML.cs

All contributions are welcome! Please be kind and respectful to other contributors.

https://redd.it/1px3xix
@r_dotnet
Did any backend dev here migrate their .NET 8 code to 10? Is it worth it at this point?

Im usually the 1st to migrate my serverside (my own of course, not work related) to the latest .NET LTS but recent microsoft shenanigans have discouraged me from touching anything new they make

Is there any feature in .NET 10 that makes it worth the risk? How we feeling about it?

https://redd.it/1px3q0e
@r_dotnet
Generate backend architecture diagrams in less than 3 minutes
https://redd.it/1px722v
@r_dotnet
NUKE Build Canonical Fork?

A couple weeks ago I was saddened to read that the maintainer of NUKE Build had called it quits and doesn’t plan to appoint a successor.

At time of writing there are 448 forks on GitHub but does anyone know if a “preferred” or “canonical” fork has emerged yet?

https://redd.it/1pxbkdi
@r_dotnet
Rules: are we allowed to post a link to an ASP.NET Core app we've made or does that contravene Rule #4 - Self-Promotion?

G'Day all,

Are we allowed to post a link to an app made in ASP.NET Core (open source but dual license on GH) or does this contravene rule 4 - self-promotion because it might be considered
a) I've done this, so look at me
b) dual license which has some commercial context for large companies only

https://redd.it/1pxe0kk
@r_dotnet
I understand why C# and dotnet but...

For sometime I had a problem with C# for having "too many ways of doing the same thing" and with dotnet for having "too much magic implicit behavior and opiniated structure". And why do I have a problem with this?

First, I think that when you have too many ways of accomplishing something, it makes codebases across multiple people filled with preferences and styles. In a language like Python for example, there's only one thing to do something, so there's more uniformization across syntax.

Second, opiniated frameworks that work with implicit behavior are easy for those who know them really well but hard for those who are new. When I learned Flask, I was able to build websites in FastAPI, Javalin, Micronaut and ExpressJS with ease. But when transitioning into a bigger framework, it was hard, because I didn't know what to look for as each framework had it's own conventions.

But I finally see the sense of it now. I mean I'm getting to. I still think that while C# has too many ways of doing something, I can still choose to write my code simpler and more explicit. It's a thing of preference. I normally write my C# code as highschool level C++ if that makes sense. Thing is, I love it for personal projects but I dislike it when other programmers create a soup of features. That's an instance where I'd have preferred for my workplace to use Python instead.

But Python is not perfect either. Python standardizes the syntax of a program but not the architecture of a software. So, that's where bigger frameworks come in. Even if C# has multiple syntax options, it offers better organization via it's dotnet opiniated framework. So there's a tradeoff where each part loses something but does something else better.

So, where I'm getting at? I think that C# is overall the better choice because performance-wise, you can build much more things than with Python or JavaScript and in a world where RAM is as expensive as a secondhand car, ElectronJS is not a solution (it's powerhungry for memory without any good reason). But... I feel overwhelmed.

So, above was my analysis. Sometimes I can clear my thoughts if I write them up so... my question for whoever is interested in this topic, how do you manage to balance the obsession of knowing the entire language at once vs being productive and stop overthinking?

Thank you!

https://redd.it/1pxc92j
@r_dotnet
Honest question to the .NET community: why do new devs still default to Node.js?

I’ve been a .NET dev for a while, and this is something I keep coming back to.

On paper, .NET has everything:

async/await done right
first-class TypeScript support
fast, compiled runtime
cross-platform
now even AOT
mature tooling and great performance

Yet when new devs start backend work, they still default to Node.js + Express/Nest.

Yes, we have our fair share of over-promised and under-delivered frameworks (looking at you, MAUI and Blazor). But at least they live in the same ecosystem and share the same fundamentals.

This isn’t a “Node bad / .NET good” post. I’m genuinely asking: where are we failing?

Is it:

Perception? (.NET still feels corporate / enterprise)
Open-source optics? (many still don’t realize .NET is fully open-source)
Onboarding friction? (too many concepts before a simple “hello world” API)
Community visibility? (Node content dominates YouTube, blogs, bootcamps)
Deploy & hosting simplicity?
Or are we just bad at telling our story?

Or… am I simply looking at the wrong communities and mistaking online noise for reality?

As a community, we’ve built an insanely capable ecosystem. But capability clearly isn’t what wins mindshare anymore.

Would love honest takes.
No flame wars. Just reflection.

https://redd.it/1pxh0sn
@r_dotnet
Interested in Working with .NET and Blazor

Working with Blazor Server for about two years, building applications using C#, **ASP.NET** Core, SQL Server, and creating REST APIs for Blazor apps. Experience includes AML and ERP systems, along with DevExpress for reports, dashboards, and data grids. Previously worked with React JS for two years, familiar with modern frontend frameworks.

Always interested in connecting with other developers or teams working on Blazor Server, APIs, and DevExpress. Happy to share experiences and learn from others in the community. If anyone has insights, resources, or collaboration opportunities, feel free to reach out.

https://redd.it/1pxt3m1
@r_dotnet
Do you obfuscate code?

Do you use any kind of code obfuscation?

My company is asking for options because we need to distribute a desktop application, but I don't know any.

I wanted to know what's the community thoughts on this!

Thanks!

Edit: obviously "it depends" is the best answer for this. Just imagine you do have some algorithms that some competitors would like to see. Although I don't give a damn, company is asking for options and I'm asking the community if you are doing this or not, even considering competition and stuff

https://redd.it/1pxvwy6
@r_dotnet
How to hot reload while debugging in vs code

I Try to debug the code and change some code, doesn't work, I try using dotnet watch command in cli and attach a debugger to it, but when I change the code the debugger doesn't work and I have to restart the project.

In visual studio this is not the problem I can hot reload while debugging, but the cons is if I change the UI (cshtml) hot reload is slow in visual studio debug mode.

How do you guys debug in visual studio code or how to improve speed of hot reloading cshtml file in visual studio ?

https://redd.it/1pxxn5m
@r_dotnet
Recommend a code generation tool

Hello, when working with native interop (PKCS#11), I need to generate C# structures that are always the same in four variants, because each platform uses a different unsigned integer size and different structure alignment. In addition, the given integer size may not match nint. Unfortunately, generics cannot be used with native interop.

Is there any tool that could help me with this? Something like the old T4?

https://redd.it/1pxxa0m
@r_dotnet
Modernize your .NET localization: convert .resx to JSON, keep IStringLocalizer, add OTA updates - open source toolkit

I've been working on LRM (Localization Resource Manager) - an open-source CLI + NuGet library + cloud platform for .NET localization.

The big idea: One platform that connects your local dev environment, GitHub repos, and live apps:

- Local CLI → push/pull to cloud
- GitHub integration → sync repos, create PRs with translations
- OTA SDK → apps fetch latest translations without redeploying

Translators work in the web UI, changes sync to your repo and live apps automatically.

The .NET-specific stuff:

- Source Generator - strongly-typed classes at compile time. Full IntelliSense, refactoring, no magic strings
- OTA updates - background refresh, ETag caching, circuit breaker. First OTA for .NET
- IStringLocalizer - drop-in replacement for ASP.NET Core, Blazor, MAUI, WPF
- CLDR pluralization - proper plural rules for 30+ languages
- Code scanning - finds unused/missing keys in C#, Razor, XAML

CLI: 50+ commands, 10 translation providers including Ollama (local LLM - no API costs, air-gapped). JSON output for CI/CD.

Also supports i18next, Android, iOS if you're cross-platform.

Already using .resx? Modernize in one command:

lrm convert --from resx --to json


Your IStringLocalizer<T> code stays the same - just swap the NuGet package. JSON instead of XML, easier to diff and merge.

100% open source (MIT). Self-host everything, or use lrm-cloud.com - free tier included.

GitHub: https://github.com/nickprotop/LocalizationManager

https://redd.it/1pxynqn
@r_dotnet
C# 14 Null-Conditional Assignment Operator Benefits for Beginners

Although the official page covers the new features very well, thought it would be helpful for beginners to have a more detailed overview.

I will start with a new class that includes one property:

class VideoProject
{
    public string? LastExportPath { get; set; }
}

Then let’s have a method called ExportVideo which is there to simulate a long-running and resource-heavy operation in this case for exporting a video.

I will use Thread.Sleep to pause for 5 seconds for simplicity:

string ExportVideo()
{

Console.WriteLine("Exporting Video...");

Thread.Sleep(TimeSpan.FromSeconds(5));

var outputPath = @"C:\\Exports\\video.mp4";

Console.WriteLine($"Export Finished: {outputPath}");

return outputPath;
}

Next, let’s declare a variable called project of type VideoProject, make it explicitly nullable and assign null to it:

VideoProject? Project = null;

Then let's see what happens if I assign the result of the ExportVideo method to the project.LastExportPath property:

project.LastExportPath = ExportVideo();

As you have guessed this will raise a NullReferenceException, but what's really bad is that ExportVideo method will still run so you will see:

Exporting Video...

Export Finished: C:\Exports\video.mp4

NullReferenceException message

Now, there is a feature set called Nullable Reference Types, which allows developers to set a Nullable Context (since C# 10 .NET 6 release Nullable Context is enabled by default).

This enables what’s known as null-state analysis, which provides warnings in cases such as the one above – when dereferencing a null reference. You can also set <TreatWarningsAsErrors>true</TreatWarningsAsErrors> on the project level to treat all warnings as errors, ensuring that you do not accidentally overlook issues that could cause runtime failures.

However, that is just a warning system and does not solve the main problem.

The reason why the problem is occurring is because assignment operator is Right to Left associative.

So, it first evaluates the ExportVideo() method, which is the right operand and then it uses the value to assign it to the left operand which should be an assignable entity – in this case a property.

In this scenario, the left side is guaranteed to fail, but the right side still executes unnecessarily, wasting time and resources. One way to fix it is to use an if statement like so:

if (project is not null)
{
project.LastExportPath = ExportVideo();
}

Now if the project variable is null then the if block will simply not be executed.

But starting from C# 14 .NET 10 release there is a new improvement to an already existing feature called null-conditional operator, which allows you to express this logic in a more concise way.

Null-conditional operator can be used for type members (.?) or collection elements (?[]) – in this example I will only cover type members but same applies to collection elements.

The new update changes the evaluation order, so it now starts from the left side instead of the right side when there's a null-conditional member or element access operator on the left side of the assignment operator. In other words, if the left side evaluates to null, then the right side is skipped.

So, I can write a one-line equivalent of the if statement above and still benefit from null safety, while at the same time avoiding executing long-running and resource-heavy operations unnecessarily.

project?.LastExportPath = ExportVideo();

Before the C# 14 and .NET 10 release, you could use null-conditional member or element access operators, but they could not appear on the left side of an assignment operator. Moving forward, they can, which as mentioned adds both null safety and convenience.

With Nullable Context enabled in modern versions of C#, you can easily catch these types of exceptions. So, you should rarely if ever be faced with a situation like the
one described above. However, I think it's still important for beginners to understand the evolution of the language to fully appreciate the advantages brought by new features and improvements.

Hopefully this is helpful. Feel free to share any suggestions or comments, and the article will be updated as needed.

Below are some of the references:

Null-Conditional Member Access/Element Access Operators
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/member-access-operators#null-conditional-operators--and
Null-Conditional Assignment Operator (C#14)
https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-14#null-conditional-assignment
Nullable Reference Types
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/nullable-reference-types
Full Video Explanation of Null-Conditional Assignment Operator (by Digital Dev Academy)
https://www.youtube.com/watch?v=z8bf4l7qQB4

https://redd.it/1py410a
@r_dotnet