@@ -1488,9 +1488,11 @@ internal async Task TestSourceGenerationExecution_RazorGeneratorAlwaysRuns_Other
14881488 var globalOptionService = workspace . ExportProvider . GetExportedValue < IGlobalOptionService > ( ) ;
14891489 globalOptionService . SetGlobalOption ( WorkspaceConfigurationOptionsStorage . SourceGeneratorExecution , executionPreference ) ;
14901490
1491- var callCount = 0 ;
1492- var generator1 = new CallbackGenerator ( ( ) => ( "hintName.cs" , "// callCount: " + callCount ++ ) ) ;
1493- var generator2 = new Microsoft . NET . Sdk . Razor . SourceGenerators . RazorSourceGenerator ( ) ;
1491+ var callBackCallCount = 0 ;
1492+ var generator1 = new CallbackGenerator ( ( ) => ( "hintName.cs" , "// callCount: " + callBackCallCount ++ ) ) ;
1493+
1494+ var razorCallCount = 0 ;
1495+ var generator2 = new Microsoft . NET . Sdk . Razor . SourceGenerators . RazorSourceGenerator ( ( c ) => c . AddSource ( "file.cs" , "// callCount: " + razorCallCount ++ ) ) ;
14941496
14951497 var projectId = ProjectId . CreateNewId ( ) ;
14961498 var project = workspace . CurrentSolution
@@ -1512,19 +1514,22 @@ await ValidateSourceGeneratorDocuments(expectedCallback: 0,
15121514 // Now, make a simple edit to the main document.
15131515 Contract . ThrowIfFalse ( workspace . TryApplyChanges ( workspace . CurrentSolution . WithDocumentText ( tempDoc . Id , SourceText . From ( "// new text" ) ) ) ) ;
15141516
1515- await ValidateSourceGeneratorDocuments ( expectedCallback : executionPreference == SourceGeneratorExecutionPreference . Automatic ? 1 : 0 ,
1516- expectedRazor : 1 ) ;
1517+ await ValidateSourceGeneratorDocuments (
1518+ expectedCallback : executionPreference == SourceGeneratorExecutionPreference . Automatic ? 1 : 0 ,
1519+ expectedRazor : 1 ) ;
15171520
15181521 // Get the documents again and ensure nothing ran
1519- await ValidateSourceGeneratorDocuments ( expectedCallback : executionPreference == SourceGeneratorExecutionPreference . Automatic ? 1 : 0 ,
1520- expectedRazor : 1 ) ;
1522+ await ValidateSourceGeneratorDocuments (
1523+ expectedCallback : executionPreference == SourceGeneratorExecutionPreference . Automatic ? 1 : 0 ,
1524+ expectedRazor : 1 ) ;
15211525
15221526 // Make another change, but this time enqueue an update too
15231527 Contract . ThrowIfFalse ( workspace . TryApplyChanges ( workspace . CurrentSolution . WithDocumentText ( tempDoc . Id , SourceText . From ( "// more new text" ) ) ) ) ;
15241528 workspace . EnqueueUpdateSourceGeneratorVersion ( projectId : null , forceRegeneration : false ) ;
15251529
1526- await ValidateSourceGeneratorDocuments ( expectedCallback : executionPreference == SourceGeneratorExecutionPreference . Automatic ? 2 : 1 ,
1527- expectedRazor : 2 ) ;
1530+ await ValidateSourceGeneratorDocuments (
1531+ expectedCallback : executionPreference == SourceGeneratorExecutionPreference . Automatic ? 2 : 1 ,
1532+ expectedRazor : 2 ) ;
15281533
15291534 async Task ValidateSourceGeneratorDocuments ( int expectedCallback , int expectedRazor )
15301535 {
0 commit comments