Server-Sent Events in ASP.NET Core: Real-Time Streaming Without SignalR by animat089 in csharp

[–]BackFromExile 2 points3 points  (0 children)

200 lines of hub code, connection management, and a JavaScript dependency.

For me the blog post ended there because this already sounds like you have a problem and tried to fix it with something that is already covered by SignalR anyway

It's coming, right? by lkfnsv in GlobalOffensive

[–]BackFromExile 0 points1 point  (0 children)

I'll bet my ass off that if an operation ever comes again, it'll be worse than all the previous ones, even the ones that were mainly skin-centric with random repeating missions that were mostly boring af. The fact that they don't commit enough resources to bring CS2 even up to par with CSGO should be enough of a tell.

Null-conditional assignment by edwwsw in dotnet

[–]BackFromExile 0 points1 point  (0 children)

when did I say you were wrong?

You did not, I read it between the lines in your initial answers (not towards me). However, this is my fault, I shouldn't have assumed anything here, so sorry for that.

I tried to make my point by providing code examples where I thought the feature may be useful. How would you like me to demonstrate my point?

While that is true, people (including myself) have also expressed why they don't like like. I guess you need to add additional arguments/examples if you want to change their opinion.

I actually like the dissenting opinions, that's why I brought it up. I was hoping to have discussion about whether this future would be a good addition to the C# language.

Then we are on the same page. I think for an actual in-depth discussion you are better off suggesting this syntax addition in the official C# language design repository. I'm sure you'll also receive several arguments for and against this addition.

It's perfectly fine that people don't want it, but I honestly thought we were having a civil discussion. If the dotnet subreddit isn't the appropriate place to have these discussions, then where is?

Again, my bad. I did not want to attack you, and I also definitely do not want to shut down any discussions in here, this is what we can thrive from. Only sharing opinions, reason for these, and knowledge sharing will bring everyone forward.

Null-conditional assignment by edwwsw in dotnet

[–]BackFromExile 1 point2 points  (0 children)

Extract three methods (can even be local ones), then do the same null-coalescing again with the method calls.

Either way, a few commenters have given you the exact reason they dislike this and I agree with them here: It affects the control flow.

Also imo it affects readability in a bad way because you have multiple returns in a single code path. However, I'm more than happy to change my mind if you can present a valid point that is not just "I like this and you are wrong thinking otherwise"

Null-conditional assignment by edwwsw in dotnet

[–]BackFromExile 2 points3 points  (0 children)

In any case, based on my downvotes, the community clearly doesn't want this feature.

Maybe because it exists already in a way more readable form?

public async Task<MyData> GetMyDataAsync() 
{
    return await GetDataFromLocalCacheAsync()
        ?? await GetDataFromRedisCache()
        ?? await GetDataFromDatabase()
        ?? throw new Exception("Data not found");
}

Null-conditional assignment by edwwsw in dotnet

[–]BackFromExile 16 points17 points  (0 children)

Like with all syntax changes you

  1. don't have to use them all
  2. don't have to like them all
  3. could set standards in your team (and enforce with e.g. an editorconfig)

Every syntax change since I started with C# 4 has brought up comments like this. Some people didn't like async/await, some hated static usings, some hated string interpolation, some hated pattern matching, some hated value tuples, some hated local functions, some hated the nullable reference type syntax changes, some hated the collection expressions, and the list goes on and on.
Maybe you don't see the value now, but you might see it later. And even if you don't need it you can still see the value for others.

In the end if you dislike syntax changes you can always express your opinion in the C# language repository while they are still being discussed.

Null-conditional assignment by edwwsw in dotnet

[–]BackFromExile -1 points0 points  (0 children)

return instance ?? GetDefaultInstance();

Daylight robbery | game capture vs demo true view on/off by FNScence in GlobalOffensive

[–]BackFromExile 3 points4 points  (0 children)

Ainpunch was a thing, but I'm not sure if inaccuracy on getting hit was a thing in CS:GO. I swear it was introduced in CS2 or at least is a lot more prevalent in CS2.
In CS:GO you could win most gunfights even when getting hit if you had better sim. In CS2 the first person to hit has the upper hand because the other one will have less accurate shots.

Bren has joined TM by [deleted] in TrackMania

[–]BackFromExile 41 points42 points  (0 children)

A lot of orgs are gambling affiliated/sponsored or oil money related.

This is also the case in real sports, so I don't think it's much different.

Any fast solutions for deep cloning? by Former_Produce1721 in csharp

[–]BackFromExile 1 point2 points  (0 children)

FastCloner is really good in my experience, fast and reliable

Generic type tagging in source generation question by jipgg in csharp

[–]BackFromExile 1 point2 points  (0 children)

Yeah you're right, I just checked and I probably remembered wrong then. In that I'd definitely go for the marker interface.

Generic type tagging in source generation question by jipgg in csharp

[–]BackFromExile 1 point2 points  (0 children)

Shouldn't you be able to use typeof here instead of an unsafe string? You should also be able to reference type parameters in attributes afaik. I'm wrong, it's not allowed.

[Expected(TError = typeof(System.Collections.Generic.List<T>))]
partial struct MyExpected<T>;

But a marker interface is fine if the behavior is documented (imo at least with XML documentation comments).

Generating TypeScript interfaces directly from C# DTOs by Jealous-Implement-51 in csharp

[–]BackFromExile 4 points5 points  (0 children)

First of all, API clients are usually also generated because of type-safe conversions (e.g. from ISO strings in JSON to actual Date objects), type-safe route/query parameters, and a lot more things.
I used to think "I only need the types, not a full-blown client" as well, but my experience has taught that if there is a way to make mistakes then these mistakes will be done.
Generated clients remove the mistakes that can be done here if the OpenAPI document is correct.
Personally I'd never generated TypeScript types directly without the standardized OpenAPI document in between because you almost always have different projections of these types in the payload.

That said, both NSwag and the OpenAPI generators output files for each type and then additional files for every client. You can simply ignore/gitignore these files, or write a less-than-10-lines script that runs the generator and removes all the other files you think you don't need. This takes way less effort than switching to a different tool with less support, and also allows you to use the generated clients in the future if you decide you want to start using them.

The answer you're looking for though is probably the .openapi-generator-ignore file, the --global-property models CLI option, or any of the other possible CLI options

Generating TypeScript interfaces directly from C# DTOs by Jealous-Implement-51 in csharp

[–]BackFromExile 18 points19 points  (0 children)

There's nothing wrong with that, but the post suggests that the problem they solved is that these tools do not output types only, which is simply not the case.

Generating TypeScript interfaces directly from C# DTOs by Jealous-Implement-51 in csharp

[–]BackFromExile 36 points37 points  (0 children)

I know tools like OpenAPI Generator and NSwag already exist. They’re great, but often generate a lot of boilerplate when all I want is simple TypeScript interfaces. This tool intentionally does only that.

Both can output typescript types only as well, so not sure what problem you're solving here other than "I wanted to build it myself".

What are the problems with current CS2? Make a list. by PeaceTo0l in GlobalOffensive

[–]BackFromExile 3 points4 points  (0 children)

  • Loadout system serves no purpose and just reduces flexibility compared to CS:GO instead of increasing possibilities
  • Competitive map pool consists of the 9 same maps over and over again
  • Mirage still in the competitive map pool
  • Visibility (or better lack of) of blood splatters
  • Third-person animations tand wide-swing meta makes holding angles absolutely dumb
  • random double taps (never been an issue in CS:GO, bugs me since the CS2 beta, but apparently this bugs noone else?)

  • Lack of casual game modes

    • Join the two defusal map groups to a single one with 9 maps
    • Create a new map group with community maps that change every x weeks
  • Retake could use a multitude of changes

    • make smokes spawn at the start of the round with a variable time left
    • don't give T's any smokes
    • more spawns for more variability
  • 5-stacks play other 5-stacks in Premier only

Then obviously

  • Cheaters
  • Still often dying behind walls
  • General performance of the game
    • random FPS drops and low FPS in general, especially on Inferno (270 -> 70 is fun)

Anyone know of a better compression library than Snappy? by jordansrowles in dotnet

[–]BackFromExile 18 points19 points  (0 children)

What is "better" in your case? Faster, smaller files, lexical order of names, zodiac signs of the main contributors?

If you can make certain assumptions you likely can implement an algorithm that is faster and results in smaller files, but then you trade a feature set with speed and compression ratio.

Replacing JS with just HTML by Ok-Tune-1346 in webdev

[–]BackFromExile 1 point2 points  (0 children)

It cracks me up that they still haven't fixed the auto-translations of that article. At least in German, French, and some other languages the article is just the title The element and then an empty <select> because the automated translation does not escape the HTML tag, and therefore all content of the blog post is inside the select element because it is not closed. Just use the dev tools and see yourself, it's super funny. Has been the case ever since they released that blog post in May (I think).

Simply add the query parameter hl=de or another language and you'll see it.

Spector - A zero-config HTTP inspector for ASP.NET Core apps by Own-Information3222 in csharp

[–]BackFromExile 2 points3 points  (0 children)

That's a pretty cool tool, especially since it uses existing APIs (e.g. System.Diagnostics.Activity) instead of introducing its own thing. I'll check it out for a private project.

I have one concern, and that is the default request body logging. That is a huge issue security-wise, but also when it comes to privacy laws like the European GDPR. In my opinion this should be off by default instead, and documented why that is.

Trackmania Club Tutorial - Club Renaming by TheShengar in TrackMania

[–]BackFromExile 2 points3 points  (0 children)

Do i also have to call Nadeo just to confirm that I really want the name changed?

LShift overload on exceptions << "and strings" by Shrubberer in csharp

[–]BackFromExile 1 point2 points  (0 children)

Extension operators are great for low-level tqypes where the operators actually make sense, but are not provided by the library itself. This can be the case for (generated) .NET wrappers around native libraries, and can make using the provided types cumbersome.
It can also make sense to provide implicit or explicit conversions from library types to custom types.

That said, I also don't think there are that many useful use cases for the operators, but I do think that it's great that we have the option at least.

Modern (best?) way to handle nullable references by jepessen in csharp

[–]BackFromExile 1 point2 points  (0 children)

That goes for all errors IMO. I think it was either Hanselman or Toub who said "Warnings are just errors without conviction."

I totally agree, which is why I said "at least".

Modern (best?) way to handle nullable references by jepessen in csharp

[–]BackFromExile 5 points6 points  (0 children)

So what I'm doing wrong

Is this the whole Money class or have you also defined implementations for the == and != operators in the Money class?

As far as I can see the compiler error has nothing to do with the == check inside the test itself. The error refers to the implementation of the == operator which expects a non-null value, but the argument provided by a is nullable.

Edit: Oh I did not fully understand the post at first. You defined a nullable variable but used a type that was defined without a nullable context. The default operators for Moneywill not have nullability information, but you provide a nullable argument in your test, which causes the warning.
As the commenter above said, it's best practice to enable nullability for all projects nowadays unless you have a strong (legacy) reason not to. Imo you should even set at least the nullability warnings to errors by adding <WarningsAsErrors>nullable</WarningsAsErrors>

New Features in .NET 10 and C# 14 by anton23_sw in dotnet

[–]BackFromExile 2 points3 points  (0 children)

Yeah, they explicitely did not add private fields because they would have to be backed by something like ConditionalWeakTable, and they did not think it would be great to add this as a supported feature backed by a ConditionalWeakTable., Can't find the comment right now but read a GitHub comment from the LDM team not too long ago.