News for hackers. Stuff that matters.
Re:Making life easier for newcomers to the .NET ecosystem by piva00 on Monday November 15, 2021 @06:02AM (#29225992)
> Microsoft is certainly an oppressive monster but they arguably produce some of the best tools in town right now.

Can you expand on this point? What tools Microsoft provides that are the top-of-the-crop right now?

Re:Making life easier for newcomers to the .NET ecosystem by tasogare on Monday November 15, 2021 @06:03AM (#29226004)
Visual Studio. Always has been. And the base class library of .net.
Re:Making life easier for newcomers to the .NET ecosystem by 5e92cb50239222b on Monday November 15, 2021 @06:07AM (#29226030)
Did you actually try the alternatives? If we're talking about dotnet specifically, then Rider? It's miles ahead of VS in every way that I can think of. I don't personally know a single dotnet developer who kept using VS after trying out Rider for a few weeks.
Re:Making life easier for newcomers to the .NET ecosystem by Const-me on Monday November 15, 2021 @06:27AM (#29226185)
> It's miles ahead of VS in every way that I can think of

When I need to write advanced SIMD code, or consume C libraries like FreeType designed to be hostile towards FFI, I often make C++ DLLs to be consumes from C#.

Unlike Rider, Visual Studio is not just .NET IDE, it's a C++ IDE as well. The two debuggers are integrated too, it's easy to debug both C# and C++ at the same time.

Re:Making life easier for newcomers to the .NET ecosystem by dotancohen on Monday November 15, 2021 @10:10AM (#29228290)
As a Linux user, what do I need to experiment with .NET 6 to replace Python for mostly simple file processing?

90% of my use would be to open and read/write files, read from stdin and argv, regex, maybe some http requests and math no heavier than the occasional integral or limit.

Re:Making life easier for newcomers to the .NET ecosystem by Const-me on Tuesday November 16, 2021 @01:18AM (#29237483)
Can’t recommend a Linux IDE. I develop quite a lot of .NET for Linux lately, but I’m using a Windows computer with visual studio 2019 to compile and debug. Only using the runtime on Linux to test things, with printf debugging when needed. Still, quite a few people on the internets, in this thread even, are saying Rider is actually good.

About programming, most of the things you have mentioned (except integrals and limits) are in the C# standard library. Here’s a few tips.

Be sure to handle exceptions in your Main(). On Linux, I usually printing messages into `Console.Error` stream and returning a non-zero status code. Without the top-level try/catch in the main, unhandled exceptions crash the process with no information about what happened.

Set <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow> compiler switch in all your *.csproj files. It causes the runtime to detect integer overflows and throw exceptions in runtime when it happens. It’s very useful to debug things (exceptions come with stack traces, if you keep the *.pdb files they will even contain source file names and line numbers), but I usually keeping the setting in release builds too, for a bit of extra safety. The performance overhead is negligible on modern computers.

About the I/O, use modern APIs, the usability’s better. For instance, when you need to read a text file line by line, call File.ReadLines() method, returns a lazily-evaluated sequence of these lines. Also, modern .NET supports spans pretty much everywhere and therefore you can read/write stack allocated buffers or unmanaged memory. Albeit depending on your use cases, stack allocated buffers might be a premature optimization.

About web request, the standard library has two HTTP clients, older WebClient, and newer HttpClient. For many use cases the functionality is equivalent, pick whichever API you like better. In both cases, I recommend their async-await APIs to make requests. The language supports async main for a few versions now.

Re:Making life easier for newcomers to the .NET ecosystem by dotancohen on Tuesday November 16, 2021 @02:00AM (#29237714)
Perfect, thank you. I do love the Jetbrains IDEs professionally, but its an expensive purchase for occasional use.

I much appreciate the mention of catching exceptions. For my own programs I usually don't catch exceptions because I want the failure to be hard and informative. It seems that dotnet is the exception here.

Re:Making life easier for newcomers to the .NET ecosystem by Const-me on Tuesday November 16, 2021 @04:40AM (#29238665)
Couple more things.

Don’t abuse LINQ. It’s awesome, but I can only recommend for simple use cases. For advanced ones, too easy to screw up, and too hard to debug. When that’s the case, I’m usually writing a foreach loop instead, and/or generator methods. Also, when I do use LINQ I prefer the C# syntax like `seq.Select( x => x.something )` instead of the SQL syntax `select something from seq`. It’s a matter of taste but IMO compiler is doing too much magic with the SQL syntax.

A few years ago, .NET finally got what MS calls string interpolation. Good stuff, can recommend, I think Python has an equivalent for a decade: https://docs.microsoft.com/en-us/dotnet/csharp/language-refe...

Most articles on the internets view C# as an object-oriented language. That’s only part of the story. In the typical code I’m writing, at least 50% of code is pure functions (in FP sense) in static classes. And at least 50% of non-static classes are structures (these are value types, an array or List<> of them will keep items at sequential memory addresses, good for performance) with all the fields marked readonly, i.e. immutable types. .NET 6.0 even has record structs now, with automatic readonly.

Re:Making life easier for newcomers to the .NET ecosystem by S04dKHzrKT on Monday November 15, 2021 @01:50PM (#29231020)
Depending on what kinds of files you read/write, you might want to take a look at F#'s type providers.

https://fsprojects.github.io/FSharp.Data/library/CsvProvider...

Re:Making life easier for newcomers to the .NET ecosystem by jmnicolas on Monday November 15, 2021 @04:26PM (#29232985)
Right now you probably can't experiment coding with .net 6 on Linux (I'm not sure with VSCode but it didn't work for me last week with Rider so I'm still on .net 5).

So if you wait a few weeks to get full support assuming you want an IDE experience and not running everything from the console:

- if you want free (as in beer): Visual Studio Code - if you have a Jetbrains license or don't mind paying for one: Rider

Re:Making life easier for newcomers to the .NET ecosystem by thrower123 on Monday November 15, 2021 @10:44AM (#29228688)
You're probably better just sticking with Python if that is all you are doing.

DotNet and C# works fine for all of those things, but it's definitely simpler to get spun up with a Python script for the quick and dirty. DotNet really shines as things get bigger and you need to have more structure.

Re:Making life easier for newcomers to the .NET ecosystem by dotancohen on Tuesday November 16, 2021 @02:02AM (#29237719)
Thanks. I just figured that text scripting, which I do often enough, would be a good foot in the door. I'm not looking for a better Python replacement, rather, I'm looking to get familiar with dotnet with a small project that I would be doing anyway.
Re:Making life easier for newcomers to the .NET ecosystem by throw1234651234 on Monday November 15, 2021 @11:04AM (#29228958)
Absolutely no reason. I prefer .NET over Python, but for your use case, there is no point, and .NET might be a downgrade since it's more verbose.

For huge projects, that verbosity is what makes it maintainable.

Re:Making life easier for newcomers to the .NET ecosystem by dotancohen on Monday November 15, 2021 @11:21AM (#29229148)
My mindset is to experiment and become familiar with .NET. Python is great and I can continue to use it, but I see text processing as a low barrier to entry way to get familiar with a new tech.
Re:Making life easier for newcomers to the .NET ecosystem by Scarbutt on Monday November 15, 2021 @10:24AM (#29228442)
Downloading .NET 6, a text editor and reading docs?
Re:Making life easier for newcomers to the .NET ecosystem by dotancohen on Tuesday November 16, 2021 @02:03AM (#29237729)
Yes, of course!

There was much mention in this thread of the docs being out of date, referring mostly to older dotnet APIs. Also, by mentioning specific use cases, I was hoping - and got - very specific and helpful recommendations.

Re:Making life easier for newcomers to the .NET ecosystem by piva00 on Tuesday November 16, 2021 @03:59AM (#29238415)
And Rider is not just Rider, it's based on the IntelliJ platform that can also support multiple different languages, including C++, Python, Java and so on.
Re:Making life easier for newcomers to the .NET ecosystem by pjmlp on Monday November 15, 2021 @10:26AM (#29228474)
Miles ahead only for those that don't know how to use VS properly.

It has tons of features missing for Windows development, debugging across .NET languages, C++, COM and WinRT.

Debugging of GPU code, parallel code, integration with mocking frameworks like Fakes, architecture modeling even for files without source available (code maps).

Re:Making life easier for newcomers to the .NET ecosystem by R0b0t1 on Monday November 15, 2021 @10:40AM (#29228642)
Those latter things (COM, WinRT) are gated behind the enterprise license, IIRC. Most people will not have cause to want them.

I know I don't.

Re:Making life easier for newcomers to the .NET ecosystem by pjmlp on Monday November 15, 2021 @11:25AM (#29229189)
Any serious Windows developer will.
Re:Making life easier for newcomers to the .NET ecosystem by R0b0t1 on Monday November 15, 2021 @02:18PM (#29231401)
They're a sign of dated tech. Nothing modern necessarily needs them. I know how to use them and I can respect the design, but pay gating them for so long has made them irrelevant.
Re:Making life easier for newcomers to the .NET ecosystem by pjmlp on Tuesday November 16, 2021 @04:41AM (#29238675)
Not only those things aren't gated, they are the modern APIs on Windows since Longhorn, they are only irrelevant if you are stuck on Windows XP.
Re:Making life easier for newcomers to the .NET ecosystem by R0b0t1 on Tuesday November 16, 2021 @01:53PM (#29244819)
The developer tooling was pay gated until VS2019 or something. You needed this tooling to make use of the APIs in a reasonable way, or alternative tooling.

Most people just responded by not using those APIs or recreating them.

Re:Making life easier for newcomers to the .NET ecosystem by GordonS on Monday November 15, 2021 @02:23PM (#29231472)
Serious Windows developer here - I want nothing to do with COM or WinRt!
Re:Making life easier for newcomers to the .NET ecosystem by pjmlp on Tuesday November 16, 2021 @02:14AM (#29237787)
Given that since Longhorn debacle, for better or worse all new APIs are COM based, and WinRT is still COM with extras, I cannot take that as serious Windows developer, rather a developer stuck with a Windows XP.
Re:Making life easier for newcomers to the .NET ecosystem by radicalbyte on Monday November 15, 2021 @06:24AM (#29226172)
It depends on what you're doing; Visual Studio with ReSharper is still very good (as long as you have a beast of a machine).
Re:Making life easier for newcomers to the .NET ecosystem by tonyedgecombe on Monday November 15, 2021 @10:24AM (#29228444)
Every time there is a new version of Visual Studio I try and use it for as long as possible before I give up and install ReSharper. So far VS 2022 looks like it might be good enough without it.
Re:Making life easier for newcomers to the .NET ecosystem by jmnicolas on Monday November 15, 2021 @04:30PM (#29233031)
I'm using Visual Studio without Resharper since 2009. What did I miss? :p

I never felt I was lacking anything in stock Visual Studio and since my company won't pay for anything I never considered Resharper.

Fwiw I have Linux at home and trying Rider (I have used Android Studio before) I much prefer Visual Studio.

Re:Making life easier for newcomers to the .NET ecosystem by tester756 on Monday November 15, 2021 @01:41PM (#29230898)
Visual Studio with Roslynator (free, needs less resources)
Re:Making life easier for newcomers to the .NET ecosystem by konamicode on Monday November 15, 2021 @06:22AM (#29226152)
VS's windowing system is better than Rider's. I often use VS with a layout which takes up two full screens (editor on one and Tests Explorer/Solution Explorer/Output Window/Find window etc on the other). I haven't yet found a way to replicate this in Rider.
Re:Making life easier for newcomers to the .NET ecosystem by GordonS on Monday November 15, 2021 @02:27PM (#29231521)
I use Rider, and often have a code editor on my main monitor, debugger at the top of my secondary monitor, and tests at the bottom of my secondary monitor - it all works great.

At the top right of each window pane is a popup menu that let's you change the window mode, it's that simple.

Re:Making life easier for newcomers to the .NET ecosystem by kovac on Monday November 15, 2021 @06:18AM (#29226117)
I did. I tried Rider and continued to use VS when I was programming on Windows. On Linux I use Rider (though I'm mostly off. Net stuff now). Reason for using VS is because I like it's UI (like the colour scheme more) and I think there are at times issues with resolving dependency issues like nuget stuff (which is what my colleague told me who is a fulltime rider user but fires up VS rarely to resolve them). I haven't tried things like parallel stack watches, debugging dlls and remote debugging. I just liked these things the way they are in VS. Though I'd rank Rider higher than VS since it runs on Linux.
Re:Making life easier for newcomers to the .NET ecosystem by dmitriid on Monday November 15, 2021 @10:21AM (#29228419)
Tried Visual Studio 22 Preview. It couldn't run a debugger because "property program isn't defined". Apparently you need to specify some launch.json file god knows where, and god knows why.

VSCode kinda works (but also creates a launch.json file somewhere).

Rider just works. If it creates something somewhere, I couldn't care less (as I couldn't care less for any other IntelliJ product which tend to just work).

Also. Obligatory rant by Casey Muratori on Visual Studio: https://www.youtube.com/watch?v=GC-0tCy4P1U

Re:Making life easier for newcomers to the .NET ecosystem by Dennip on Monday November 15, 2021 @10:25AM (#29228455)
Why not the stable version (2019) instead of a literal preview...
Re:Making life easier for newcomers to the .NET ecosystem by dmitriid on Monday November 15, 2021 @10:28AM (#29228519)
I'm on a Mac, so decided to give it a try. It's an interface overhaul, why wouldn't it be able to launch something though?

I tried to install a previous version. It started installing, and then ... just failed. With no description of what failed, and how to deal with it.

So eventually I gave up.

WHat's launch.json and where is it described? And why can't it figure stuff automatically like Rider? And why does VSCode create a separate launch.json and why can't the two share the same one?

So many questions, so few answers.

Re:Making life easier for newcomers to the .NET ecosystem by mook on Monday November 15, 2021 @11:02AM (#29228924)
Visual Studio for Mac is a completely unrelated product that happens to share a name; when people say Visual Studio without any qualifiers they _probably_ don't mean the Mac version.

Microsoft overall has a terrible naming sense, with occasional good accidents.

Re:Making life easier for newcomers to the .NET ecosystem by plorkyeran on Monday November 15, 2021 @11:15AM (#29229074)
Visual Studio is Windows only. VS for Mac is an unrelated program which used to be named Xamarin Studio.
Re:Making life easier for newcomers to the .NET ecosystem by rharb on Monday November 15, 2021 @11:43AM (#29229363)
2022 launched last week along side the production .NET 6 launch
Re:Making life easier for newcomers to the .NET ecosystem by SketchySeaBeast on Monday November 15, 2021 @09:49AM (#29228028)
Some would argue VSCode is there as well. I know a lot of my coworkers swear by it.
Re:Making life easier for newcomers to the .NET ecosystem by throw1234651234 on Monday November 15, 2021 @11:05AM (#29228965)
I personally don't like it at all. I use it to write Azure Cloud Functions, but I use WebStorm for Angular/React dev, even though I am used to Visual Studio for .NET.
Re:Making life easier for newcomers to the .NET ecosystem by aliswe on Monday November 15, 2021 @09:59AM (#29228145)
But its not an IDE /s
Re:Making life easier for newcomers to the .NET ecosystem by barrenko on Monday November 15, 2021 @10:58AM (#29228881)
Ugly bloated eye-sore. Pardon my language.

Just rip off JetBrains already.

Re:Making life easier for newcomers to the .NET ecosystem by onemoresoop on Monday November 15, 2021 @11:24AM (#29229173)
I use Visual Studio on a daily basis and I abhor it. It is hard to navigate without a mouse, things are shoved in small boxes and requires a lot of clicking around. But my coworkers love it so it must be a subjective thing, right? The amount of bugs make me hesitant to ever upgrade when I get a stable version. VS 2018 is riddled with UI bugs. One of them that is annoying me is the basic functionality for undo, text no longer focuses on the latest undo chunk and you don't know how far you got.