8 ms·
Learning C# and .NET after two decades of programming
- debacle 2y agoAlways wanted to try our Blazor, but there are weird barriers (as a layman) to understanding the client-side lifecycle. Maybe just opaque abstractions that don't seem necessary at first glance.
- sheepscreek 2y agoIn my limited experience, Blazor significantly simplifies front-end development, particularly in larger and more intricate projects. This is partly due to the maturity of .NET tooling and ecosystem, which makes it easy to manage projects at different scales of complexity.
- whoknowsidont 2y ago"It works on my machine" is not simplifying front-end development. Please just stick with React, Hotwire, HTMX, literally anything else.
- sheepscreek 2y agoI’m not sure what you’re referring to. Blazor, along with Razor pages, was developed to simplify front-end development in dotnet. It’s essentially the React of the C# world, enabling the embedding of both C# and HTML into Razor pages, both on the client and server sides. Its most impressive feature, however, is LiveView, which is akin to server-side rendering. It’s more sophisticated than that. It does a diff on the state changes and only the diffed DOM node states are transmitted over the network, resulting in lightning-fast performance. In other words, if a value changes from <p>5</p> to <p>10</p>, only the 10 gets sent from the server (along with sufficient information to locate the correct location of the replacement).
- whoknowsidont 2y agoBlazor is not robust. It is not ready for production websites. Teams using Blazor are often not equipped to understand the stack and the intricacies of how it actually works under the hood, and therefore do not monitor for issues. And worse, when they become aware of these issues, they can do nothing to fix them (well, you technically can, most Blazor teams are not those teams). >It’s essentially the React of the C# world, No it is not even close to similar. If you are using Blazor on a website today I bet you a very, very large amount of money your users are consistently running into issues they cannot recover from. I know how Blazor works. A lot more than I care to. If you are actively using Blazor today that's a huge fuck you to both your end-users and anyone being forced to interact with the application.
- whoknowsidont 2y agoDon't. Unless you're a client-side web tech expert, Blazor will break under production load. Things will work fine in QA, but it's not a robust framework. So when things break, they break hard, leaving your end-users in the ditch. Something like Phoenix LiveView is a much better option.
- debacle 2y agoIs it using something like websockets to stream data?
- whoknowsidont 2y agoYes, it can, and by default be through SignalR. The problem is both SignalR has its own limitations as well as web-sockets in general. I have never seen a SignalR (and recently Blazor) implementation without significant and characteristic issues the moment you actually star to observe end-user errors/issue/anatomies. Either through automated reporting or user feedback. And this is because SignalR is built on .NET and .NET has many different threading issues when you need those thread to be stable and robust (not talking about transit B2B apps) It always happens. Without exception. You do not have to take my word for it, look at the active, open, and historical issues here: https://github.com/SignalR/SignalR/issues https://github.com/SignalR/SignalR/issues The issues are plainly fundamental. It's absurd. And it only survives because it's Microsoft.
- sebazzz 2y agoThat version of SignalR you are referring to is from .NET framework and really bolted on. That version of the framework had async/await in ASP.NET also bolted on, and the threads itself use a synchronisation context and locks. This is mostly no longer the case in modern .NET. SignalR is a core part of the framework and completely rewritten. In our case, Blazor Server has been very stable for us, also for multiple users.
- foretop_yardarm 2y agoI’ve recently learnt blazor as a non-dotnet person. I definitely think it comes across as complex at first glance. The learning is pretty front loaded (especially with efcore too) but it’s not too bad once you dive in. In particular, I am a big fan of the Maui blazor hybrid stuff. Worth a look if you fancy making a desktop app.
- breadwinner 2y agoThe main downside of C# when compared to Java is its weaker exception handling, see here: https://mckoder.medium.com/the-achilles-heel-of-c-why-its-exception-handling-falls-short-f7f932488aba https://mckoder.medium.com/the-achilles-heel-of-c-why-its-ex...
- Dwedit 2y agoIn earlier versions of C# (including .NET 3.5), Access Violations did not inherit from Exception, and could not be caught using "catch (Exception ex) { }" syntax. You had to use "catch { }" syntax instead.
- neonsunset 2y agoYou still cannot catch AccessViolationException, StackOverflowException or ExecutionEngineException. This is by design because each indicates catastrophic unrecoverable failure (you could have a couple of hand-wavy arguments about AVE dereferencing wrong address but, really, that indicates critical error in implementation or memory corruption still). You should never see any of these regardless. Aside from abusing stackalloc by passing a large number I guess.
- vips7L 2y agoI’m really passionate about exceptions and checked exceptions in general. Java really has done a disservice by not making it easy to uncheck checked exceptions. Much like rust I hope they offer some sort of ? operator in the future. This really is the main gripe with checked exceptions.
- breadwinner 2y ago> uncheck checked exceptions. What do you mean? if you add "throws Exception" to every method then you can defeat checked exceptions but please don't do this in production code
- vips7L 2y ago
- sanex 2y agoGreat choice, I miss .NET every day.
- Hawxy 2y ago.NET is a very productive stack, if you're coming from a JS background you'll find all of the batteries included that'd usually require a dozen or so NPM packages. If you're building a Blazor app, I'd suggest sticking with its SSR project type. WASM is fine but SSR is far more productive. The hybrid mode is a recent addition, but it has too many rough edges and I'd avoid it.
- klipt 2y agoAnders Hejlsberg was chief architect of .net after creating both Turbo Pascal and Delphi.
- Kerrick 2y agoI think we’ll be priced into using WASM mode for at least one of our products, because we have VoIP functionality built-in. The call needs to stay live and controllable as the user navigates the application. I think that’s the main reason they chose Angular rather than .NET MVC.
- kaydub 2y agoUgh, I like enterprise apps but I can't get behind using Blazor. It reminds me too much of JSF. I hated that monstrosity. I just think it's good practice to decouple the frontend. If you're a tiny team and you already know how to use something like Blazor, maybe it makes sense. But that's the only place I see it being valid.
- webprofusion 2y agoIf it's Blazor WASM the server side would a conventional rest API. If it's server rendered Blazor it would be a hybrid in a somewhat similar style to Server Rendered Components found on other frameworks.
- deleted 2y ago[deleted]
- arnonejoe 2y agoI’ve been working in C# since 2002 and only in the last 2 years have I been using the Rider IDE and will never go back to VS Code. I know most C# developers use Code or Visual Studio but Rider has a lot of small features that make working with the c# very enjoyable. I have no affiliation with JetBrains (maker of rider).
- Kerrick 2y agoI’ve been using WebStorm and RubyMine for 5+ years and I love them. I’m definitely going to try to make Rider work before falling back to Visual Studio.
- PaulHoule 2y agoI used JetBrains for Java (IntelliJ IDEA), Python (PyCharm) and Javascript (WebStorm) and many of the same affordances work across all those languages and I'd expect Rider to do the same. (Funny I am doing a hackathon this weekend where we are writing a game with Unity and I'm using Visual Studio for the first time in 15 years! It's pretty amazing how big a role C# plays in game development as it is used in many other frameworks like Godot)
- KronisLV 2y agoRider is up there with IntelliJ IDEA in its usefulness. If you opt for the package of all of JetBrains' tools, then it's definitely worth a look, IMO. Of course, the full Visual Studio is also pretty nice nowadays, I'll admit that. As for game engines that support C#/.NET/Mono, there's actually quite a few: Unity https://docs.unity3d.com/6000.0/Documentation/Manual/scripting.html https://docs.unity3d.com/6000.0/Documentation/Manual/scripti... Godot https://docs.godotengine.org/en/stable/tutorials/scripting/c_sharp/index.html https://docs.godotengine.org/en/stable/tutorials/scripting/c... Stride (formerly Xenko) https://doc.stride3d.net/latest/en/manual/scripts/index.html https://doc.stride3d.net/latest/en/manual/scripts/index.html (even the new physics engine they're integrating is written in C#, bepuphysics2, it's really cool how deep into the engine code you can dig, it's like 90% C#) MonoGame https://docs.monogame.net/articles/getting_started/3_understanding_the_code.html https://docs.monogame.net/articles/getting_started/3_underst... Flax https://docs.flaxengine.com/manual/scripting/index.html https://docs.flaxengine.com/manual/scripting/index.html And a few others (like NeoAxis, that one is really niche, but I think their voxel LOD idea was cool, even if it didn't run well for me). I wonder why Java doesn't see the same level of attention, since the runtime itself is pretty good and the modern versions of the language are reasonably nice, yet for Java it seems that there's only LWJGL and jMonkeyEngine. That said, .NET is really good even when it comes to webdev, I have to admit that ASP.NET feels way more coherent than working with the likes of Spring Boot in Java sometimes does, I guess I'd say that it's more of a focused and less fragmented experience.
- Thaxll 2y agoModern C# is nice, Blazor not so much.
- webprofusion 2y agoI've been able to pretty much drop Javascript for business oriented apps due to Blazor (both server rendered and WASM)
- ridiculous_leke 2y agoDoes C# still require you to write everything with classes? Would love to try it if there's option to write functional code in it.
- vunderba 2y agoThey introduced the concept of top-level scripts a little while back - though I don't know whether its just syntactic sugar such that when it compiles down to IL everything just gets wrapped in a main class. https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/program-structure/top-level-statements https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals...
- sedatk 2y agoIt's just syntactic sugar. That said, a static class with static methods is basically a namespace.
- intrasight 2y ago"classitis" is much diminished
- Kerrick 2y agoI’ve heard it’s multiparadigm now, but I can’t yet substantiate that. Even if it is, I don’t know if it’s JavaScript-level (so functional they rewrote SICP in JS), Ruby-level (just a sprinkle of lambdas and pattern matching), or somewhere in between. I’ll be sure to post an article once I find out. :-)
- webprofusion 2y agoYou know about F# right? https://dotnet.microsoft.com/en-us/languages/fsharp https://dotnet.microsoft.com/en-us/languages/fsharp https://learn.microsoft.com/en-us/dotnet/fsharp/whats-new/fsharp-9 https://learn.microsoft.com/en-us/dotnet/fsharp/whats-new/fs... Dotnet has compilers for C#, VB and F# and they can all share the same frameworks and libraries. C# is the most popular.
- sedatk 2y ago
- ergonaught 2y agoI’ve never been able to overcome general “hostility” toward Microsoft to really learn it. I like C# as a language, and think it does a better job of being “a better C++” than Java, but can’t get past it.
- Kerrick 2y agoSame. I spent way too many years angry at Microsoft for the web stagnation during the IE years. Now that .NET and C# are open source and Edge auto-updates, I think I can swallow it.
- Salgat 2y agoSince it was opensourced I don't really care anymore. Not like Oracle or Google are great companies either.
- notesinthefield 2y agoI am learning C# as well after decade of powershell, bash and (a little) python to fill security tool gaps. It feels heavy because I have to actually worry about error handling, speed and the quirks of compiled languages. Ive also had a great time learning with ChatGPT - i can ask it to explain and compare a C#-ism to a similar powershell or python pattern. Hugely helpful.
- neonsunset 2y ago> It feels heavy because I have to actually worry about error handling, speed and the quirks of compiled languages. This is a bit unfortunate. It doesn't have to be this way - i.e. you don't need to write "extra" syntax many adopt out of blind adherence to old, outdated practices (i.e. 'private' or'internal class' usually makes no sense to use - these are default visibility levels anyway, you're repeating yourself, or reimplementing Java-style heavy visitor patterns). If you see there's a shorter path to get from point A to point B it's almost always a good idea to take it. Even if something seems less than optimal, it will still run an order of magnitude faster than any interpreted language. There are obvious language-agnostic gotchas you may want to avoid but otherwise there is no reason to not use e.g. LINQ in regular application logic.
- deleted 2y ago[deleted]
- schneems 2y agoHeroku (I work there) recently announced support for .NET on the platform https://blog.heroku.com/dotnet-support-on-heroku https://blog.heroku.com/dotnet-support-on-heroku
- Kerrick 2y agoThat’s awesome! Heroku was incredibly important for Rails beginners for years. I wonder if this will move the needle on .NET adoption for beginners.
- bob1029 2y agoC#/.NET is my go to always. But, I have a really hard time loving Blazor, and most of the other non-essentials that are piled on top of HttpContext. My current preference is to lean on string interpolation [0] to do most of the heavy lifting when rendering web documents on the server. You can nest interpolations and use LINQ + collection aggregation (string.Join()) to trivially build things like tables and other complex documents. Combine interpolation with verbatim [1], and you basically get a poor man's PHP document system nested within your C# source files. I've done the whole razor template thing and I am completely over that. Managing the dependencies and weird initialization routines for these rendering engines is not worth it when the language has a built-in feature that accomplishes virtually the same thing with absolutely zero BS. Writing raw HTML to the client is a simple one-liner [2]. You can quickly build your own bespoke web frameworks, leveraging the power of features like reflection to make your life 100x easier. You can sidestep virtually all of the AspNetCore namespaces and the attribute-driven nonsense that is hallmark of most .NET/MVC-style web apps. If you keep it light and avoid the boilerplate, you can do a lot of damage within 100 lines of code these days. [0] https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/interpolated https://learn.microsoft.com/en-us/dotnet/csharp/language-ref... [1] https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/tokens/verbatim https://learn.microsoft.com/en-us/dotnet/csharp/language-ref... [2] https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.httpresponsewritingextensions.writeasync https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspne...
- greatgib 2y agoIt's 2025 and there are still companies doing "business corporate crap" in .NET... "Patterns of Enterprise Application Architecture", even just the title of this book reminds me of the good old time when you would hire 30 java consultants to do online forms for business with java beens, j2e, .JSP and co, delivering the worst and most buggy user experience facing a lean website like "facebook" created by 2 students doing simple html/php apps.
- sandreas 2y agoI started C# and .NET a few years ago and I still enjoy it. The cross platform initiative has been such a relief. OK it's Microsoft and please set the environment variable export DOTNET_CLI_TELEMETRY_OPTOUT=1 , but believe it or not, I'm on Linux and I use C# every day. The most significant advantage over other languages I noticed is that it is a very versatile language. You can do basically anything with it and it usually works cross platform out of the box. CLI, GUI, WebService, Mobile Apps and even WASM is also included. With the new PublishNativeAot option you can even build native apps without depending on the runtime. It's not Rust or go in size or performance, but it often is close enough. And boy there are great libraries for nearly everything. Command Line App? - Spectre.Console WebService or Api? - FastEndpoints Cross platform GUI? - AvaloniaUI Image handling? ImageSharp ProcessHandling? CliWrap Unit-Testing? xUnit, FluentAssertions and NSubstitue or the new TUnit Hate Exceptions? Rust-Style error handling is possible [1] The only thing I'm really missing is a well maintained cross platform audio library with a permissive license. That's why I'm learning P/Invoke now to create a C# wrapper around miniaudio[2]. So I'm still learning C# after all these years and haven't hit the wall. Good luck! 1: https://github.com/gnaeus/OperationResult https://github.com/gnaeus/OperationResult 2: https://miniaud.io/ https://miniaud.io/
- DimmieMan 2y agoCan someone who's done it let me know the appeal of the Angular to Blazor migration? it seems a such a common pathway. I've used; React, Blazor and svelte professionally but never Angular. Sure, the node ecosystem has warts but I've found both the DX and end product of Blazor to be so wildly behind the JS ecosystem that I can't see myself choosing it again. Is there something uniquely bad about Angular or something?
- Kerrick 2y agoI think Visual Studio used to have a preset to generate a web application with a C# API and Angular front-end (perhaps because of its strong TypeScript culture?). In that case, there are a lot C# / .NET shops out there using Angular. For those teams it simplifies a lot to use one language.
- neonsunset 2y agoA bit of a tangent but .NET CLI is excellent and I find it more productive at project management/scaffolding/building/etc. It has quite a few useful templates for 'dotnet new' command. Though I found the Angular one a bit outdated back then, but perhaps this changed.
- Townley 2y agoAt work I’ve recently moved from a Node/TS monolith to “Python+TS react in a sea of .NET microservices I debug and contribute to” It’s been the second time in my career I’ve been surprised by not hating C# (the first was goofing off with Unity in 2018). The language itself has a lot of niceties; for example a method to turn the variable foo into the string “foo”. The Neovim LSP set itself up just by installing the dotnet executable. And the syntax for creating complex workflows were pretty ergonomic once an experienced .NET dev walked me through what I was even looking at. I still prefer FastAPI + well-typed Python as the backend framework of my dreams… but I’d work in .NET again. Blazor hasn’t sold me yet, but seems like a fine choice. It fits in the same class of tools to me as Django Templates, HTMX, or JS handlebar rendering. There’s a class and size of apps for which that’s perfect, and there’s some value in a fullstack language keeping your stack monolingual. But IMO the framework should stand on its own against frontend frameworks like React, Vue, or Svelte… with the simplicity of monolingualism added as a cherry on top. Otherwise you’re optimizing towards the number of languages your devs need to learn over which frontend framework would be the best fit for your app. And between the DX and expansiveness of the JS ecosystem, it’s been hard to imagine going back once you’ve spent a few years eating the shamefully-complicated-constantly-shifting-and-reforming elephant that is learning TS React and friends
- Kerrick 2y ago> eating the shamefully-complicated-constantly-shifting-and-reforming elephant that is learning TS React and friends Can I say again how nice it was to use EmberJS from its release candidate days all the way through my seven year tenure at that job? Batteries included, Promises way back in 2013, and way more stable than anything else.
- pier25 2y agoI've been learning C# and dotnet core for the past couple of months and it's been a great experience. I love C# and wish I could write all my web stuff with it. Unfortunately, Blazor WASM is so far behind pretty much all JS front end frameworks in terms of performance, bloat, and memory usage. https://krausest.github.io/js-framework-benchmark/current.html https://krausest.github.io/js-framework-benchmark/current.ht...
- cutler 2y agoI gave up on C# and .Net after realising Microsoft is still the same old Microsoft I loathed back in the 90s and 00s when IE ruled the world. The emperor's new clothing is cross-platform .Net. The reality is that whilst .Net may well run on Linux and OS X the culture surrounding .Net hasn't changed. Case in point, I recently assessed .Net's leading CMS - Umbraco - for a project. Yes, it runs on Linux and OS X but can you use standard open source databases such as MySQL and PostgreSQL with it? Sorry, not supported. You have to cough up for a MS SQL Server licence to get your open source CMS up and running. As if to rub salt in the wound Umbraco does support SQLite but wtf!? M$ culture will never change. Their lip service to Linux and open source only happened because their hand was forced after decades of pursuing the likes of Red Hat and SuSe with bogus patent lawsuits and secretly funding the notorious SCO in their Unix patent litigation.
- neonsunset 2y ago> bogus patent lawsuits and secretly funding the notorious SCO in their Unix patent litigation :D I'm curious, could you link the lawsuits?
- cutler 2y agohttps://www.crn.com/news/applications-os/199501735/microsoft-waves-patent-lawsuit-stick-at-linux https://www.crn.com/news/applications-os/199501735/microsoft...
- theusus 2y agoI code in C# and I find the language and its ecosystem lack luster. There are lots of packages that are not active. Also, the language doesn't have good generics, no sum types, no decorators support
- veleek 2y agoCan you help me understand your point of view a little bit more? I’ve been working for decades in C# professionally with a few stints in other languages and plenty of smaller side projects in any number of different ecosystems. I always find myself frustrated with “the experience” of working with many other languages. They all have their own pros and cons of course, but saying you don’t like the language because it doesn’t have sum types feels like saying you don’t like a Prius because it doesn’t have a pickup bed. Not a perfect analogy, but there are so many other features of C#’s type system that make it amazing to work with and it’s continually being improved year over year. I would be interested in knowing what types of things about the generics system you wish could be improved.
- theusus 2y agoI find a need for specialisation at a lot of places and it simply doesn't exist in C#. Meta programming in C# almost everytime requires reflection which adds to uncertainty and compromises on readability. Other two are what I posted in original comments.
- neonsunset 2y agoStruct generics in C# are monomorphized - exact same as in Rust. Combine that with pattern matching and you can go quite far. In place of macros you can use source generators, although they are both weaker and stronger than proc macro depending on what you use them for.