Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Chasiubao
Apr 2, 2010


What's everyone's opinion on the var keyword? I'm in the middle of a religious discussion on code reviews.

Team 1 has no hard and fast rules: use var where it makes sense, for super long nested generics, etc.

Team 2 insists that it should only be used when the type is immediately discernible from the rhs.

Adbot
ADBOT LOVES YOU

Chasiubao
Apr 2, 2010


No Safe Word posted:

Use var like all the time basically. (Both teams are correct, and it should almost always be immediately discernible from the RHS or you should consider refactoring)

code:
var x = await GetAMyObjectAsync(); // okay

var y = await DoAThingAsync(); // not okay
Team 2 is not happy with the second line because the return type of the RHS is not immediately discernible, but Team 1 does not want to rename DoAThingAsync to DoAThingThatReturnsMyResponseAsync.

Chasiubao
Apr 2, 2010


omeg posted:

Do they also want to return to Hungarian notation?

:shrug:

I don't know.

Chasiubao
Apr 2, 2010


Dred_furst posted:

One can hope for WPF, forget it for winforms. what's the point?
secondly, if someone provides clr bindings for their UI library, as long as the app is developed with it then sure why not.

Would people event want WPF skinned apps on Linux / OSX?

Chasiubao
Apr 2, 2010


I took a job that has me writing Java instead of C# for services. This thread is like the happy place I go to get away from the awfulness :sigh:

I really want to get a Surface Pro 3 for personal projects but I can't justify the price tag right now.

Chasiubao
Apr 2, 2010


epalm posted:

How so?

We haven't switched to Core yet but I was looking forward to natively-supported DI.

When I was looking at 2.2 for a prototype web service, found out very quickly that you can’t register two discrete versions of the same type and then conditionally resolve later. With AutoFac we accomplished this with named registration and then named parameter resolution for the consuming types.

Luckily you can replace the DI container with another one, although they made it slightly more obtuse in 3.0

Per the original poster, we use the built-in DI for any runtime things required to configure Kestrel that are out of the box, but for anything we own, they go into the AutoFac container.

Chasiubao
Apr 2, 2010


EssOEss posted:

What is all y'all's experience with nullable reference types? Any great success stories to tell? I tried them out and just found it to be a nice idea that in practice is just a nuisance that did not help me at all. Wondering if this is a common experience or if there is a scenario where they prove worth bothering about.

At best/most I'll use
code:
<Nullable>warnings</Nullable>
My opinion on it is that there's two scenarios. In scenario one where things can be statically proven to never be null, it's great and a nice little time saver of writing
code:
if (blah == null)
But in the scenarios where it doesn't work or hold - per the docs arrays and structs - the author of the code still has to null check. And so you end up in a world where the developer has to keep that additional cognitive load in their head where they always have to be asking "Is it scenario one or two?". And if they get a false positive on one, okay so you burned a few cycles on a need-less null check. But the opposite leads to a null ref exception.

Chasiubao
Apr 2, 2010


cruft posted:

Is there a way to dump the number of active tasks?

I'm trying to add some debugging to Jellyfin to figure out a bug that I suspect is related to too many tasks and not enough threads in the Thread Pool.

I fully expect the actual issue is going to take 3 months just to locate, but this feels like the right place to start. Unfortunately, I've never written C# before, so I'm hoping this quick check can at least tell me if I'm on the right track, before I dive too deep into understanding .NET's TPL.

I'm late to this but there are some well-known .NET runtime performance counters for thread pool queue length and thread count which are emitted by default. https://learn.microsoft.com/en-us/dotnet/core/diagnostics/available-counters I'm newer to .NET Core and it does seem like there are fewer useful counters by default compared to FX, but this might get you started as well?

Chasiubao
Apr 2, 2010


raminasi posted:

I was going to say, I remember getting a lot of mileage out of staring at a Datadog dashboard with exactly the requested metrics on it, but I was on my phone and it was a couple years ago so I didn't post.

:hf: I waited until I was at a desktop before I responded or even looked for that link

Adbot
ADBOT LOVES YOU

Chasiubao
Apr 2, 2010


Add an explicit dotnet restore step, and then your build steps can pass the —no-restore flag to skip that.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply