When you use VS help on removing unused 'using's, some of 'em should not be removed, because they are used in a different configuration (RELESE, DEBUG, etc), but not needed in current one.
I suggest some mark for such using 'never remove it!'. Suggestions:
using Abc.Def;// KEEP!
[Keep]using Abc.Def;
using! Abc.Def;
We have many variants.
OFFTOP: usings are such a clumsy idea! Why they are not kept at project level? Why they are needed in every single file? (I speak not about ambiguous cases)
@WrongBit From the language's standpoint using preprocessor directives should be more than enough to address this case.
using System;
#if DEBUG
using Abc.Def;
#endif
Currently, analyzer and compiler see each configuration separately. Putting the using into #if will let it ignored in other configurations.
You may also be able to surround it with #warning disable or similar.
This is not a language request. Transferring to roslyn.
Why they are needed in every single file? (I speak not about ambiguous cases)
Because then your code changes meaning based on config settings to your compiler.
Duplicate of #24084
Most helpful comment
Currently, analyzer and compiler see each configuration separately. Putting the
usinginto#ifwill let it ignored in other configurations.