jasonbock,
@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.

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@jasonbock are the packages by any chance targeting a newer or release version of .NET? A reproduction would be helpful.

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).

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@jasonbock I'll have a look tomorrow and report back. If I can repro I'll enter a ticket.

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@jasonbock Works on my machine. Make sure your friend is using the latest version of JetBrains Rider.

I’m using JetBrains Rider 2024.1.2.

Rocks Mocking library working in JetBrains Rider.

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.

khalidabuhakmeh,
@khalidabuhakmeh@mastodon.social avatar

@jasonbock Awesome! Yeah, older versions of Rider run with older SDK versions, so they can fail to run newer source generator targets in the IDE. The projects will still build, but you get strange editing/programming experiences.

winning GIF

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