@@ -1054,7 +1054,7 @@ private CSharpDirective() { }
10541054 "sdk" => Sdk . Parse ( errors , sourceFile , span , directiveKind , directiveText ) ,
10551055 "property" => Property . Parse ( errors , sourceFile , span , directiveKind , directiveText ) ,
10561056 "package" => Package . Parse ( errors , sourceFile , span , directiveKind , directiveText ) ,
1057- "project" => Project . Parse ( errors , sourceFile , span , directiveText ) ,
1057+ "project" => Project . Parse ( errors , sourceFile , span , directiveKind , directiveText ) ,
10581058 _ => ReportError < Named > ( errors , sourceFile , span , string . Format ( CliCommandStrings . UnrecognizedDirective , directiveKind , sourceFile . GetLocationString ( span ) ) ) ,
10591059 } ;
10601060 }
@@ -1213,8 +1213,13 @@ public sealed class Project : Named
12131213 {
12141214 private Project ( ) { }
12151215
1216- public static Project Parse ( ImmutableArray < SimpleDiagnostic > . Builder ? errors , SourceFile sourceFile , TextSpan span , string directiveText )
1216+ public static new Project ? Parse ( ImmutableArray < SimpleDiagnostic > . Builder ? errors , SourceFile sourceFile , TextSpan span , string directiveKind , string directiveText )
12171217 {
1218+ if ( directiveText . IsWhiteSpace ( ) )
1219+ {
1220+ return ReportError < Project ? > ( errors , sourceFile , span , string . Format ( CliCommandStrings . MissingDirectiveName , directiveKind , sourceFile . GetLocationString ( span ) ) ) ;
1221+ }
1222+
12181223 try
12191224 {
12201225 // If the path is a directory like '../lib', transform it to a project file path like '../lib/lib.csproj'.
0 commit comments