0

I have a block of code which uses a NuGet package by Syncfusion, which is currently broken, for which I have opened a ticket. I'd like to tell the compiler to consider the code broken and skip compiling it both to mark it as broken for other developers, and to optimize the code so the compiler doesn't add in something that's not working. Comments are somewhat alright, but they're not really something with a standardized format, which is what I'd like, in order to search the entire codebase for code tagged as broken if needed in the future. Is there any way to do that?

xNefas
  • 27
  • 2
  • 2
    How about [conditional compilation](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives#conditional-compilation)? – Sweeper Aug 04 '23 at 09:21
  • https://learn.microsoft.com/en-us/visualstudio/ide/using-the-task-list?view=vs-2022 and https://stackoverflow.com/questions/5380460/how-do-i-add-a-high-priority-todo-comment-in-visual-studio – Martheen Aug 04 '23 at 09:21
  • I considered using an #if statement, but it didn't feel very elegant either, I was hoping to use an attribute that takes a code block as its argument and globally communicates that that block of code is broken. Also, the Task List is definitely a handy little tool, thanks for that, not what I was looking for but I'll still make use of it :) – xNefas Aug 04 '23 at 09:30
  • 1. You want to exclude some code from compilation, because it is broken _and_ you want to mark it as such, so it is easy to be found again. So, I think not "either-or" but _both_ suggestions of conditional compilation and Task List together would be just perfect for this. 2. In your shoes, I'd also consider that if it was broken once, it could break again. So, I'd create Unit Tests that ensure the 3rd Party behaves like I expect it to. Especially they should all turn green after I upgrade the NuGet to a Version that includes that specific fix. – Fildor Aug 04 '23 at 10:00
  • 1
    I would second the conditional compilation suggestion. With plenty of comments that describe the issue and action plan, so the code can be enabled again with confidence that it works. Or removed when it is found 5 year later and the issue is moot. – JonasH Aug 04 '23 at 10:44
  • @Fildor-standswithMods as much as I'd love to add unit tests, the company where I work at prioritizes pushing out code asap over pushing out robust code. If It depended on me, everything would be a state machine and I'd try to make everything as modular as possible :p – xNefas Aug 04 '23 at 14:03

0 Answers0