Skip code, or make code debug/production only [DotNet Development] (Debugging Tips!)

preview_player
Показать описание
Debugging Tips Video! Learn how to turn code on/off using attach to process, preprocessors, and cursor dragging from a breakpoint.
Рекомендации по теме
Комментарии
Автор

I disagree with using ifdef debug type conditionals. Those are just landmines in large codebases. Prefer using a design where you can have feature flags that you explicitly turn on in the setup/config. Debugger.IsAttached, OK, have done that one to add diagnostic traces. Trace listeners are also a good idea to make use of that you can enable/disable on demand.

Norman_Fleming