@@ -118,7 +118,7 @@ public async Task Test(bool commitChanges)
118118
119119 await localWorkspace . ChangeSolutionAsync ( localWorkspace . CurrentSolution
120120 . AddTestProject ( "proj" , out var projectId )
121- . AddTestDocument ( "test.cs" , " class C { }", out var documentId ) . Project . Solution ) ;
121+ . AddTestDocument ( "class C { }" , "test.cs ", out var documentId ) . Project . Solution ) ;
122122
123123 var solution = localWorkspace . CurrentSolution ;
124124 var project = solution . GetRequiredProject ( projectId ) ;
@@ -156,24 +156,57 @@ await localWorkspace.ChangeSolutionAsync(localWorkspace.CurrentSolution
156156
157157 // EmitSolutionUpdate
158158
159- var diagnosticDescriptor1 = EditAndContinueDiagnosticDescriptors . GetDescriptor ( EditAndContinueErrorCode . ErrorReadingFile ) ;
159+ var errorReadingFileDescriptor = EditAndContinueDiagnosticDescriptors . GetDescriptor ( EditAndContinueErrorCode . ErrorReadingFile ) ;
160+ var moduleErrorDescriptor = EditAndContinueDiagnosticDescriptors . GetModuleDiagnosticDescriptor ( Contracts . EditAndContinue . ManagedHotReloadAvailabilityStatus . Optimized ) ;
161+ var syntaxErrorDescriptor = new DiagnosticDescriptor ( "CS0001" , "Syntax error" , "Syntax error" , "Compiler" , DiagnosticSeverity . Error , isEnabledByDefault : true ) ;
162+ var compilerHiddenDescriptor = new DiagnosticDescriptor ( "CS0002" , "Hidden" , "Emit Hidden" , "Compiler" , DiagnosticSeverity . Hidden , isEnabledByDefault : true ) ;
163+ var compilerInfoDescriptor = new DiagnosticDescriptor ( "CS0003" , "Info" , "Emit Info" , "Compiler" , DiagnosticSeverity . Info , isEnabledByDefault : true ) ;
164+ var compilerWarningDescriptor = new DiagnosticDescriptor ( "CS0004" , "Emit Warning" , "Emit Warning" , "Compiler" , DiagnosticSeverity . Warning , isEnabledByDefault : true ) ;
165+ var compilerErrorDescriptor = new DiagnosticDescriptor ( "CS0005" , "Emit Error" , "Emit Error" , "Compiler" , DiagnosticSeverity . Error , isEnabledByDefault : true ) ;
160166
161167 mockEncService . EmitSolutionUpdateImpl = ( solution , _ , _ ) =>
162168 {
163169 var syntaxTree = solution . GetRequiredDocument ( documentId ) . GetSyntaxTreeSynchronously ( CancellationToken . None ) ! ;
164170
165- var documentDiagnostic = CodeAnalysis . Diagnostic . Create ( diagnosticDescriptor1 , Location . Create ( syntaxTree , TextSpan . FromBounds ( 1 , 2 ) ) , [ "doc" , "error 1" ] ) ;
166- var projectDiagnostic = CodeAnalysis . Diagnostic . Create ( diagnosticDescriptor1 , Location . None , [ "proj" , "error 2" ] ) ;
167- var syntaxError = CodeAnalysis . Diagnostic . Create ( diagnosticDescriptor1 , Location . Create ( syntaxTree , TextSpan . FromBounds ( 1 , 2 ) ) , [ "doc" , "syntax error 3" ] ) ;
171+ var documentDiagnostic = CodeAnalysis . Diagnostic . Create ( errorReadingFileDescriptor , Location . Create ( syntaxTree , TextSpan . FromBounds ( 1 , 2 ) ) , [ "doc" , "error 1" ] ) ;
172+ var projectDiagnostic = CodeAnalysis . Diagnostic . Create ( errorReadingFileDescriptor , Location . None , [ "proj" , "error 2" ] ) ;
173+ var moduleError = CodeAnalysis . Diagnostic . Create ( moduleErrorDescriptor , Location . None , [ "proj" , "module error" ] ) ;
174+ var syntaxError = CodeAnalysis . Diagnostic . Create ( syntaxErrorDescriptor , Location . Create ( syntaxTree , TextSpan . FromBounds ( 1 , 2 ) ) ) ;
175+ var compilerDocHidden = CodeAnalysis . Diagnostic . Create ( compilerHiddenDescriptor , Location . Create ( syntaxTree , TextSpan . FromBounds ( 1 , 2 ) ) ) ;
176+ var compilerDocInfo = CodeAnalysis . Diagnostic . Create ( compilerInfoDescriptor , Location . Create ( syntaxTree , TextSpan . FromBounds ( 1 , 2 ) ) ) ;
177+ var compilerDocWarning = CodeAnalysis . Diagnostic . Create ( compilerWarningDescriptor , Location . Create ( syntaxTree , TextSpan . FromBounds ( 1 , 2 ) ) ) ;
178+ var compilerDocError = CodeAnalysis . Diagnostic . Create ( compilerErrorDescriptor , Location . Create ( syntaxTree , TextSpan . FromBounds ( 1 , 2 ) ) ) ;
179+ var compilerProjectHidden = CodeAnalysis . Diagnostic . Create ( compilerHiddenDescriptor , Location . None ) ;
180+ var compilerProjectInfo = CodeAnalysis . Diagnostic . Create ( compilerInfoDescriptor , Location . None ) ;
181+ var compilerProjectWarning = CodeAnalysis . Diagnostic . Create ( compilerWarningDescriptor , Location . None ) ;
182+ var compilerProjectError = CodeAnalysis . Diagnostic . Create ( compilerErrorDescriptor , Location . None ) ;
168183 var rudeEditDiagnostic = new RudeEditDiagnostic ( RudeEditKind . Delete , TextSpan . FromBounds ( 2 , 3 ) , arguments : [ "x" ] ) . ToDiagnostic ( syntaxTree ) ;
169184 var deletedDocumentRudeEdit = new RudeEditDiagnostic ( RudeEditKind . Delete , TextSpan . FromBounds ( 2 , 3 ) , arguments : [ "<deleted>" ] ) . ToDiagnostic ( tree : null ) ;
170185
171186 return new ( )
172187 {
173188 Solution = solution ,
174189 ModuleUpdates = new ModuleUpdates ( ModuleUpdateStatus . Ready , [ ] ) ,
175- Diagnostics = [ new ProjectDiagnostics ( project . Id , [ documentDiagnostic , projectDiagnostic ] ) ] ,
176- RudeEdits = [ new ProjectDiagnostics ( project . Id , [ rudeEditDiagnostic , deletedDocumentRudeEdit ] ) ] ,
190+ Diagnostics =
191+ [
192+ new ProjectDiagnostics (
193+ project . Id ,
194+ [
195+ documentDiagnostic ,
196+ projectDiagnostic ,
197+ moduleError ,
198+ rudeEditDiagnostic ,
199+ deletedDocumentRudeEdit ,
200+ compilerDocError ,
201+ compilerDocWarning ,
202+ compilerDocHidden ,
203+ compilerDocInfo ,
204+ compilerProjectError ,
205+ compilerProjectWarning ,
206+ compilerProjectHidden ,
207+ compilerProjectInfo ,
208+ ] )
209+ ] ,
177210 SyntaxError = syntaxError ,
178211 ProjectsToRebuild = [ project . Id ] ,
179212 ProjectsToRestart = ImmutableDictionary < ProjectId , ImmutableArray < ProjectId > > . Empty . Add ( project . Id , [ ] )
@@ -186,18 +219,28 @@ await localWorkspace.ChangeSolutionAsync(localWorkspace.CurrentSolution
186219
187220 AssertEx . Equal (
188221 [
189- $ "Error ENC0033: { project . FilePath } (0, 0, 0, 0): { string . Format ( FeaturesResources . Deleting_0_requires_restarting_the_application , "<deleted>" ) } ",
190222 $ "Error ENC1001: { document . FilePath } (0, 1, 0, 2): { string . Format ( FeaturesResources . ErrorReadingFile , "doc" , "error 1" ) } ",
191- $ "Error ENC1001: { project . FilePath } (0, 0, 0, 0): { string . Format ( FeaturesResources . ErrorReadingFile , "proj" , "error 2" ) } "
223+ $ "Error ENC1001: { project . FilePath } (0, 0, 0, 0): { string . Format ( FeaturesResources . ErrorReadingFile , "proj" , "error 2" ) } ",
224+ $ "Error ENC2012: { project . FilePath } (0, 0, 0, 0): { string . Format ( FeaturesResources . EditAndContinueDisallowedByProject , "proj" , "module error" ) } ",
225+ $ "Error ENC0033: { project . FilePath } (0, 0, 0, 0): { string . Format ( FeaturesResources . Deleting_0_requires_restarting_the_application , "<deleted>" ) } ",
226+ $ "Error CS0005: { document . FilePath } (0, 1, 0, 2): Emit Error",
227+ $ "Warning CS0004: { document . FilePath } (0, 1, 0, 2): Emit Warning",
228+ $ "Error CS0005: { project . FilePath } (0, 0, 0, 0): Emit Error",
229+ $ "Warning CS0004: { project . FilePath } (0, 0, 0, 0): Emit Warning",
192230 ] , sessionState . ApplyChangesDiagnostics . Select ( Inspect ) ) ;
193231
194232 AssertEx . Equal (
195233 [
196- $ "Error ENC1001: { document . FilePath } (0, 1, 0, 2): { string . Format ( FeaturesResources . ErrorReadingFile , "doc" , "error 1" ) } ",
197- $ "Error ENC1001: { project . FilePath } (0, 0, 0, 0): { string . Format ( FeaturesResources . ErrorReadingFile , "proj" , "error 2" ) } ",
198- $ "Error ENC1001 : { document . FilePath } (0, 1 , 0, 2 ): { string . Format ( FeaturesResources . ErrorReadingFile , "doc " , "syntax error 3 " ) } ",
234+ $ "RestartRequired ENC1001: { document . FilePath } (0, 1, 0, 2): { string . Format ( FeaturesResources . ErrorReadingFile , "doc" , "error 1" ) } ",
235+ $ "RestartRequired ENC1001: { project . FilePath } (0, 0, 0, 0): { string . Format ( FeaturesResources . ErrorReadingFile , "proj" , "error 2" ) } ",
236+ $ "RestartRequired ENC2012 : { project . FilePath } (0, 0 , 0, 0 ): { string . Format ( FeaturesResources . EditAndContinueDisallowedByProject , "proj " , "module error" ) } ",
199237 $ "RestartRequired ENC0033: { document . FilePath } (0, 2, 0, 3): { string . Format ( FeaturesResources . Deleting_0_requires_restarting_the_application , "x" ) } ",
200238 $ "RestartRequired ENC0033: { project . FilePath } (0, 0, 0, 0): { string . Format ( FeaturesResources . Deleting_0_requires_restarting_the_application , "<deleted>" ) } ",
239+ $ "Error CS0005: { document . FilePath } (0, 1, 0, 2): Emit Error",
240+ $ "Warning CS0004: { document . FilePath } (0, 1, 0, 2): Emit Warning",
241+ $ "Error CS0005: { project . FilePath } (0, 0, 0, 0): Emit Error",
242+ $ "Warning CS0004: { project . FilePath } (0, 0, 0, 0): Emit Warning",
243+ $ "Error CS0001: { document . FilePath } (0, 1, 0, 2): Syntax error",
201244 ] , updates . Diagnostics . Select ( Inspect ) ) ;
202245
203246 Assert . True ( sessionState . IsSessionActive ) ;
0 commit comments