You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The various codegen attributes don't need to ship in productio assemblies. They cause little harm, but still get enumerated and, as with #3261, can even cause (admitted small) perf hits.
We should put ConditionalAttributes on these attributes. .NET does that for SuppressMessageAttribute, for example. Only when CODE_ANALYSIS is passed - during code analysis - is the attribute even included. It's elided for normally compiled code. We could do the same with a CODEGEN symbol or something that autorest.csharp itself could pass, such that any scripts/MSBuild target - however it's called - uses it.
The text was updated successfully, but these errors were encountered:
heaths
changed the title
This should fix https://github.com/Azure/autorest.csharp/issues/3261 as well, since https://github.com/dotnet/roslyn-analyzers/pull/6114 fixed this in the newer NetAnalyzers. While my attempt to fix this in https://github.com/Azure/autorest.csharp/pull/3262 is still a valid solution, it has a non-obvious bug tail that is probably not worth the time.
Add ConditionalAttribute to codegen attributes
Apr 26, 2023
The various codegen attributes don't need to ship in productio assemblies. They cause little harm, but still get enumerated and, as with #3261, can even cause (admitted small) perf hits.
We should put
ConditionalAttribute
s on these attributes. .NET does that forSuppressMessageAttribute
, for example. Only whenCODE_ANALYSIS
is passed - during code analysis - is the attribute even included. It's elided for normally compiled code. We could do the same with aCODEGEN
symbol or something that autorest.csharp itself could pass, such that any scripts/MSBuild target - however it's called - uses it.This would make the code a little leaner.
See Azure/azure-sdk-for-net#35376 (comment) for context.
The text was updated successfully, but these errors were encountered: