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.
Pair admit drug dealing after undercover police search and raid on home
Nicole Kidman displays her trim figure in a chic knitted co-ord at swanky Chanel dinner in Biarritz
I've guarded presidents for 20 years. Trump faces two drastic Secret Service changes after WHCD nightmare
Why Vance left before Trump and shooter's 'Indian wife': Truth behind alarming White House Correspondents' Dinner conspiracy theories
Gunshots leave 2,600 plates stone cold as DC's cursed hotel reveals what happened to the unserved feast
King bids to heal UK's 'special relationship' with US in historic Congress speech after Trump's repeated attacks on Starmer
King arrives in US for state visit: Charles and Camilla's plane lands at Joint Base Andrews before they head to meet Trump and First Lady at White House
‘AI deflation’ comes to India’s tech services giants and puts downward pressure on revenue
AI is beginning to make a dent in the business models of India’s big four technology services giants…
King Charles need not worry about his safety meeting Trump - the late Queen survived 'far more worrying' state visits, ROBERT HARDMAN tells first ever live episode of Palace Confidential
Chelmsford school 'making improvements' after head dismissed following 'harmful behaviour' problems
Nigel Farage vows to fight 'utterly ridiculous' plans to change Essex councils
Labour accused of attack on aspiration as ministers restrict Margaret Thatcher's flagship Right to Buy policy - with new council houses now banned from being sold off for 35 years
UEFA 'investigating referee over sexual assault of a teenage boy' before officiating match in the UK
Moment grinning murderer is arrested after battering pensioner, 79, to death while on bail for threatening to kill two young women - as he is jailed for at least 20 years
Town centre pub puts rumours of closure to rest after new manager takes over
Town centre pub puts rumours of closure to rest after new manager takes over
Elon Musk and OpenAI CEO Sam Altman Head To Court
Read more of this story at Slashdot.