dotnet/roslyn

#if has same scope as other directive in C# scripting

オープン

#57,467 opened on 2021/10/29

 (4 件のコメント) (0 件のリアクション) (0 人の担当者)C# (4,257 件のフォーク)batch import
Area-CompilersArea-InteractiveBughelp wanted

Repository metrics

Stars
 (20,414 個のスター)
PR merge metrics
 (平均マージ 6d 17h) (30d で 256 merged PRs)

説明

ITNOA

Version Used: Latest version

Steps to Reproduce:

As you can see https://github.com/cake-build/cake/issues/1766#issuecomment-333958357, If you write below code

#if (FOO)
#r ".\Newtonsoft.Json.dll"
#endif


Console.WriteLine(
    Newtonsoft.Json.JsonConvert.SerializeObject(
            new {
                Hello = "World"
            }
        )
    );

Expected Behavior: Load Newtonsoft.Json.dll if FOO is defined, otherwise Newtonsoft.Json.dll must not be load

Actual Behavior: it works regardless #if define FOO or not, so would seem as #r is processed at same scope as #if/#define

コントリビューターガイド