Trump's subtle but friendly move that immediately broke royal protocol with King Charles
Sickening new claims about men being gang raped and women killed in 'sex games' at Epstein's Zorro ranch come to light in new documentary
Barclays takes £228m hit from collapse of specialist lender
Melania Trump stuns in yellow skirt suit as she joins husband Donald to greet King Charles and Queen Camilla for state visit
Tees Transporter Bridge and ex-working men's club among sites at risk of decay as Victorian Society reveals UK's most endangered buildings
I'm looking for a WIFE, says Christine McGuinness, Paddy's 'five-star lesbian' ex three years after their 'toxic' divorce
Plug-in hybrid cars cost £4,000 MORE than a fully-electric equivalent
Alice Springs cops reveal missing Sharon, 5, was led off into the dark holding the hand of violent ex-con, 47 - as detectives identify sinister crime scene nearby
Chocolate thief banned from every Co-op in Essex
Two left seriously injured in 'hit-and-run' Wickford crash
Forget the Costa del Sol... Dortmund and Cork are this year's cheapest summer spots with fares as low as £72
Trump Administration Will Pay More Energy Firms to Cancel Wind Farms
Read more of this story at Slashdot.
Father, 44, who lost five stone on fat jabs issues warning after 'trapped wind' was sign his gallbladder had turned septic
Sophie Habboo says she was willing to have an emergency C-section without being properly numbed as she and Jamie Laing recall 'intense and emotional' birth of their son Ziggy
Starmer's day of reckoning: PM ready to order Labour backbenchers to vote against Mandelson sleaze probe that could force him from office
Rebel Wilson is asked 'did you just make that up?' as she steps into the witness box at Charlotte MacInnes defamation trial
CodeSOD: Lint Brush Off
A few years back, C# added the concept of "primary constructors". Instead of declaring the storage for class members and then initializing them in the constructor, you can annotate the class itself with the required fields, and C# automatically generates a constructor for you. It's all very TypeScript and very Microsoft, and certainly cuts down on some boilerplate.
Esben B's team isn't really using them in many places, but they are using a linter which is opinionated about them. So this in-line constructor causes the linter to complain:
public DocumentNetworkController(ILookupClient service)The linter wants you to switch this to a primary constructor. Esben didn't want to do that, and didn't want to change the global linter configuration, and so added a pragma to disable that particular warning:
#pragma warning disable IDE0290 // Use primary constructor public DocumentNetworkController(ILookupClient service) #pragma warning restore IDE0290The linter didn't like this. It threw a new warning: that this suppression wasn't needed. Which was news to Esben, as clearly the suppression was needed if you wanted to make the warnings go away. The obvious solution was to disable the warning that you didn't need to disable the warning:
#pragma warning disable IDE0079, IDE0290 // Use primary constructor public DocumentNetworkController(ILookupClient service) #pragma warning restore IDE0290, IDE0079Except this doesn't work. These pragmas take effect on the next line, which means you can't disable IDE0079 on the same line as IDE0290 and expect it to work. Which means the final version of the code looked like this:
#pragma warning disable IDE0079 // Disable warning about not needed supression #pragma warning disable IDE0290 // Use primary constructor public DocumentNetworkController(ILookupClient service) #pragma warning restore IDE0290, IDE0079Esben writes:
So the nice recommendation to use a primary ctor ended up with 3 lines of annoying boilerplate code. Good times \o/
While yes, this is frustrating, I will say there's an element of "when the table saw keeps taking fingers off, that may be more of a you problem." I don't know the details, so I can't say, "just change the linter config or adopt its recommendation" and claim that the problem goes away, but when the tool hurts you, it's a definite sign of one of two things: it's either the wrong tool, or you're using it wrong.