相关疑难解决方法(0)

Visual Studio忽略#if DEBUG/RELEASE范围内的代码,不检查错误或自动完成

我已经写了#if DEBUG,#else,#endif的代码片段中,我注意到的Visual Studio不会让我用自动完成履行部分类型的成员名称,它不检查灰色激活代码错误.我发现再次关注的唯一方法是将构建模式从Debug切换到Release.但这很不方便,感觉有更好的方法.

例:

#if DEBUG
    throw;
#else
    throw new exc // I want to use autocomplete here but can't because it's greyed out
#endif
Run Code Online (Sandbox Code Playgroud)

如何让VS停止忽略其他配置范围内的其他代码#if DEBUG

c# preprocessor-directive visual-studio-2017 visual-studio-2019

6
推荐指数
1
解决办法
969
查看次数