bradwilson, (edited ) to dotnet
@bradwilson@mastodon.social avatar

If I'm writing an analyzer to say "stop doing X in xUnit.net v2 because it's been removed in v3", should that be INFO or WARNING by default?

xunit, to dotnet
@xunit@dotnet.social avatar

We just shipped v2 Core Framework 2.7.1, Analyzers 1.12.0, and Visual Studio adapter 2.5.8. This includes a few new assertion overloads, four new analyzers (and two new suppressors), and a handful of bug fixes.

Enjoy!

Release notes:

https://xunit.net/releases/v2/2.7.1
https://xunit.net/releases/analyzers/1.12.0
https://xunit.net/releases/visualstudio/2.5.8

bradwilson, to CSharp
@bradwilson@mastodon.social avatar

I want to see if it's possible to replace runtime reflection in @xunit v3 with source generators (for better performance and to support NativeAOT), but I think I've already hit the first blocking point: no support for ? Only and ?

robrich, to dotnet
@robrich@hachyderm.io avatar

https://github.com/KirillOsenkov/RoslynQuoter - given some code, get the code to generate it. This is brilliant @KirillOsenkov.

bradwilson, to dotnet
@bradwilson@mastodon.social avatar

I have taken to doing something I normally don't like. The analyzer tests for @xunit are out-of-our-control slow because of the time spent to invoke and get the results from the analyzer.

So I've been combining tests that might've been separate, with "this line is bad, these lines are fine" by way of putting them all in one test, but only expecting a subset to trigger the diagnostic. 😣

Example: https://github.com/xunit/xunit.analyzers/blob/01f4b5f74e81efb5b3e2141ded37a6fef6ae59eb/src/xunit.analyzers.tests/Analyzers/X1000/DoNotUseBlockingTaskOperationsTests.cs#L27-L45

bradwilson, to random
@bradwilson@mastodon.social avatar

CI build time climb when introducing multiple version support for @xunit . ⏱️

bradwilson, to random
@bradwilson@mastodon.social avatar

The hardest part about writing analyzers is that you only think you know where all the edge cases are, but they let people type literally anything into an IDE these days. 😭😂

bradwilson, to dotnet
@bradwilson@mastodon.social avatar

There is an unfortunate side-effect of writing with respect to compatibility.

The @xunit analyzers target Microsoft.CodeAnalysis 4.2.0 because that's what in VS 2022 17.2, which is currently still in LTS support.

CodeAnalysis 4.2.0 doesn't support C# 12. There are analyzers that are broken because of this, when used with C# 12 language features, and we can't fix them unless we're willing to throw away compatibility with everything before VS 2022 17.8.

xunit, to dotnet
@xunit@dotnet.social avatar

The next release of xunit.analyzers will move the minimum version of VS 2022 to 17.2. We currently have VS 2022 RTM as the minimum, but Microsoft stopped supporting RTM in July of this year. https://learn.microsoft.com/en-us/visualstudio/productinfo/vs-servicing#long-term-servicing-channel-ltsc-support

bradwilson, to random
@bradwilson@mastodon.social avatar

gripe:

Why doesn't editor.ReplaceNode() take a collection of nodes to use as a replacement? Instead I have to write:

editor.InsertAfter(oldNode, newNodes);
editor.RemoveNode(oldNode);

And then as a bonus, it destroys some of the trivia along the way (like deleting a blank line that it shouldn't delete). (That part may be my fault, I haven't figured out whether I've actually fixed my other bug yet.)

bradwilson, to dotnet
@bradwilson@mastodon.social avatar

I think I'd expect the call to ReplaceNode to have failed if it wasn't able to replace the node, but Roslyn isn't always helpful in that regard. Normally I'd dig into this in the debugger via the unit test, but the unit test passes. So I'm a bit stumped about what to do next. I'm not sure how to debug this indirectly (i.e., let it fail "for real" inside Visual Studio and debug it there), since it doesn't actually throw in a catchable way.

Any Roslyn experts here?

3/3

cincura_net, to CSharp
@cincura_net@mas.to avatar

Blogged: WUG: Na co mám/můžu použít Roslyn (Olomouc)

https://www.tabsoverspaces.com/id/233926

khalidabuhakmeh, to CSharp
@khalidabuhakmeh@mastodon.social avatar

TIL that source generators can generate design time AND compile time artifacts independently. 🤯

khalidabuhakmeh, to CSharp
@khalidabuhakmeh@mastodon.social avatar

When creating a analyzer, On the DiagnosticDescriptor, you can set a helpLinkUri property that will help folks understand the reasoning behind the analyzer.

Tools like will surface the link in the UI.

khalidabuhakmeh, to dotnet
@khalidabuhakmeh@mastodon.social avatar

Just so many little improvements in the latest bring me so much joy. The way source generators and analyzers look in the solution view is one of them.

maartenballiauw, to dotnet
@maartenballiauw@mastodon.online avatar

How do you debug source generators? 🤔🪲

In this post by @khalidabuhakmeh, learn how to debug generated sources, as well as the source generator itself – with the debugger, and with snapshot testing.

https://jb.gg/8zeywx

bradwilson, to dotnet
@bradwilson@mastodon.social avatar

Having one of those "what the heck is wrong?!" moments.

I wrote a Roslyn analyzer. Tests work great.

I wrote the fixer for that diagnostic reported above. Test fails. Set breakpoints, and RegisterCodeFixesAsync never gets called, despite being set for the same descriptor. Same pattern I use with every other fixer, but this one is just silently... not doing anything.

Very confused and frustrated right now. Might have to ship this analyzer without a fix.

image/png
image/png
image/png

khalidabuhakmeh, to dotnet
@khalidabuhakmeh@mastodon.social avatar

So far, the big-ticket items for 8 seem to be:

  • C# 12 language enhancements
  • Authentication changes
  • Blaaaaaaaaaaaaaaaaaaaaaazor updates,
  • Ahead of Time compilation (AOT) and trimming
  • Roslyn, Roslyn, (analyzers)

Smaller items:

  • Rate limiting fixes/improvements
  • Linux package acquisition
  • More OTel
  • Host Improvements (Host)
  • Low-level intrinsic enhancements
  • NuGet improvements
FlashOWare, to programming

We're continuing our journey of building a -based tool that globalizes using directives.

Tune in on Wednesday, 07 June at 17:00 UTC on either our Twitch or YouTube channel.

https://www.youtube.com/watch?v=dUbnuY6Pp4s

FlashOWare, to programming

Episode 08 of is coming up!

We complete the local using directive counter of our tool and start to globalize top-level usings with .

https://www.youtube.com/watch?v=vJHDnuefqk0

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