@jasonbock@mstdn.social
@jasonbock@mstdn.social avatar

jasonbock

@jasonbock@mstdn.social

Living in reality. Writing code. Playing music. Husband + father. Staff Software Engineer at Rocket Mortgage (opinions are my own). Author of books. Speaker. Cyclist. And more!

This profile is from a federated server and may be incomplete. Browse more on the original instance.

fahrni, to random
@fahrni@curmudgeon.cafe avatar

WHOA!

jasonbock,
@jasonbock@mstdn.social avatar

@fahrni Whoa....what?

jasonbock,
@jasonbock@mstdn.social avatar

@fahrni Oh, TFG is now a convicted felon, NICE!

jasonbock, to random
@jasonbock@mstdn.social avatar

Just saw a very weird issue with C# source generators in Rider.

  • Reference a NuGet package that does source generation
  • Write code that will trigger the generation of source.

What happens is that Rider doesn't "see" the new generated type, BUT, a build works, and the test runs as well.

The only way my co-worker got around this was to use EmitCompilerGeneratedFiles. (I don't use Rider, I use VS, and everything works fine there).

Tagging @khalidabuhakmeh for visibility.

jasonbock,
@jasonbock@mstdn.social avatar

@khalidabuhakmeh It's my Rocks mocking package - https://www.nuget.org/packages/Rocks, and that targets NS 2.0. The test project targets .NET 8.

I'll look at getting a repro on Monday (I don't even have Rider installed on my work laptop so I need to see if I can repro it as well).

jasonbock,
@jasonbock@mstdn.social avatar

@khalidabuhakmeh thanks, I'll talk to him on Monday and see what version he's on.

jasonbock,
@jasonbock@mstdn.social avatar

@khalidabuhakmeh had a couple of Rider + Mac users try a solution out. Seems like updating both Rider and the .NET 8 SDK to their latest versions got everything working as expected.

jasonbock, to random
@jasonbock@mstdn.social avatar

My older son wants to start working out at a fitness center. They require that you pay from a checking account; you can't use a credit card. This is not a small business either.

I'm sitting there thinking absolutely NOT. No way would I allow that access.

Am I missing something?

jasonbock, to random
@jasonbock@mstdn.social avatar

I just pushed 8.0.0-alpha.1 of Rocks, my .NET mocking library. Hopefully it'll be even faster now :)

https://www.nuget.org/packages/Rocks
https://github.com/JasonBock/Rocks

jasonbock, to random
@jasonbock@mstdn.social avatar

I'm being very lazy today.

fahrni, to random
@fahrni@curmudgeon.cafe avatar

“My friends. You bow to no one.”

😭

jasonbock,
@jasonbock@mstdn.social avatar

@fahrni Out of all 3 movies, that's the one that always hits.

jasonbock, to random
@jasonbock@mstdn.social avatar

Doing some assembly generation, and stumbled across Cecilifier (https://cecilifier.me). Give it some C#, it'll generate C# to generate the original C# code using Mono.Cecil.

It's not perfect, but it's pretty helpful.

jasonmalinowski, to random

I'm finding myself having to implement my own RPC system, so naturally we're calling it JasonRPC. Since that won't be confusing at all when spoken.

jasonbock,
@jasonbock@mstdn.social avatar

@jasonmalinowski I refuse to call "JSON" "Jason". It's pronounced "Jay-SAN".

jasonbock,
@jasonbock@mstdn.social avatar

@bitbonk @jasonmalinowski If there was a thumbs down on Mastodon I would've used it already.

jasonbock, to random
@jasonbock@mstdn.social avatar

TIL (meaning, Tonight I Learned) that you can declare non-optional parameters after optional ones in C#.

Just create an indexer with optional parameters:

int this[int a, string b = "b"] { get; set; }

The IL for the set method is this:

instance void set_Item (
int32 a,
[opt] string b,
int32 'value'
) cil managed
{
.param [2] = "b"
}

Note that the "value" is after b.

fahrni, to random
@fahrni@curmudgeon.cafe avatar

I just did some BMI calculations, which are BS, because I wanted to see what would put me in the healthy weight category. I’m 6’3” and weigh 310 at the moment. I’m morbidly obese, I know that.

So, to get healthy I put in 220 for my weight, still overweight. Wat? Ok, how about 200? Nope, overweight.

So, I put in my high school weight of 150. Ahhh, healthy weight.

Perfect! Now all I have to do is lose more than half my current weight. 🤣

jasonbock,
@jasonbock@mstdn.social avatar

@fahrni BMI is bullshit. I believe The Rock would be considered obese by that number.

I'm all for losing weight because, yes, there are advantages. I'm back on the train of trying to do it myself, and make slow but steady progress. But I don't bother with BMI. More about, how many calories am I taking in? What am I eating? How much am I exercising? etc.

khalidabuhakmeh, to dotnet
@khalidabuhakmeh@mastodon.social avatar

Can a source generator in #dotnet see referenced assemblies and their types?

jasonbock,
@jasonbock@mstdn.social avatar
jasonbock,
@jasonbock@mstdn.social avatar

@khalidabuhakmeh @rockylhotka ... you mean types defined in referenced assemblies that are not actually used in the current compilation?

jasonbock,
@jasonbock@mstdn.social avatar

@khalidabuhakmeh @rockylhotka the link I sent seems to suggest that it is possible. Though I'd really want to understand why that would want to be done. Unless they are looking for a specific type, then GetTypeByMetadataName() may be the ticket.

jasonbock,
@jasonbock@mstdn.social avatar

@khalidabuhakmeh @davidwengier @rockylhotka @jasonmalinowski it's a tough, but fair, group of Jasons

khalidabuhakmeh, to CSharp
@khalidabuhakmeh@mastodon.social avatar

I think should introduce the concept of global pure functions. And yes, I know exists.

The ceremony of encapsulating static types for static methods is just that, ceremony.

jasonbock,
@jasonbock@mstdn.social avatar

@khalidabuhakmeh Add a global static using?

peterdrake, to CSharp
@peterdrake@qoto.org avatar

"A dynamic type tells the compiler to relax." -C# 10 in a Nutshell

#csharp

jasonbock,
@jasonbock@mstdn.social avatar

@peterdrake given what the compiler does with invocations on a dynamic, I beg to differ 🙂

jasonbock, to random
@jasonbock@mstdn.social avatar

Does anyone know if there's a new roadmap for .NET? .NET 8's release is coming in 3 months, and after that...I can't find anything about future plans other than this:

https://github.com/dotnet/core/blob/main/roadmap.md

jasonbock, to random
@jasonbock@mstdn.social avatar

Here's what will be shipping in C# 12 (and won't be):

https://github.com/dotnet/csharplang/blob/main/meetings/2023/LDM-2023-07-17.md

jasonbock, to random
@jasonbock@mstdn.social avatar

I have a BlueSky invite code.

If I know you, let me know if you want it.

bitbonk, to programming
@bitbonk@mastodon.social avatar

The code that needs to be written to generate complex C# code with source generators becomes hard to read and maintain very quickly.

Wouldn't it make sense to have some sort of templating engine, like Razor or Mustache, but for C# source code?

Maybe it even already exists?

jasonbock,
@jasonbock@mstdn.social avatar

@bitbonk dunno, I've personally never used Scriban :). I know others who have tried it and they seem to like it. For SGs, using raw string literals does most of what I need.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • thenastyranch
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • ngwrru68w68
  • provamag3
  • magazineikmin
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • JUstTest
  • All magazines