@@ -296,6 +296,7 @@ public partial class SampleViewModel
296
296
}
297
297
298
298
[ TestMethod ]
299
+ [ Ignore ( "The generator should just not trigger at all in this scenario, update this after migrating diagnostics" ) ]
299
300
public void UnsupportedCSharpLanguageVersion_FromObservableValidatorValidateAllPropertiesGenerator ( )
300
301
{
301
302
string source = @"
@@ -311,9 +312,9 @@ public partial class SampleViewModel : ObservableValidator
311
312
}
312
313
}" ;
313
314
315
+ // Compilation should be fine on C# 7.3 as well (the generator just doesn't trigger)
314
316
VerifyGeneratedDiagnostics < ObservableValidatorValidateAllPropertiesGenerator > (
315
- CSharpSyntaxTree . ParseText ( source , CSharpParseOptions . Default . WithLanguageVersion ( LanguageVersion . CSharp7_3 ) ) ,
316
- "MVVMTK0008" ) ;
317
+ CSharpSyntaxTree . ParseText ( source , CSharpParseOptions . Default . WithLanguageVersion ( LanguageVersion . CSharp7_3 ) ) ) ;
317
318
318
319
VerifySuccessfulGeneration ( source ) ;
319
320
}
@@ -362,9 +363,10 @@ public void Receive(MyMessage message)
362
363
}
363
364
}" ;
364
365
366
+ // This should run fine on C# 8.0 too, as it doesn't use any newer features. Additionally, when not supported this
367
+ // generator should just not run, not cause issues. The MVVM Toolkit has a reflection-based fallback path for this.
365
368
VerifyGeneratedDiagnostics < IMessengerRegisterAllGenerator > (
366
- CSharpSyntaxTree . ParseText ( source , CSharpParseOptions . Default . WithLanguageVersion ( LanguageVersion . CSharp7_3 ) ) ,
367
- "MVVMTK0008" ) ;
369
+ CSharpSyntaxTree . ParseText ( source , CSharpParseOptions . Default . WithLanguageVersion ( LanguageVersion . CSharp8 ) ) ) ;
368
370
369
371
VerifySuccessfulGeneration ( source ) ;
370
372
}
@@ -1496,11 +1498,11 @@ private static void VerifyGeneratedDiagnostics<TGenerator>(SyntaxTree syntaxTree
1496
1498
}
1497
1499
1498
1500
/// <summary>
1499
- /// Verifies the output of a source generator .
1501
+ /// Verifies the output of one or more source generators .
1500
1502
/// </summary>
1501
- /// <typeparam name="TGenerator">The generator type to use.</typeparam>
1502
1503
/// <param name="syntaxTree">The input source tree to process.</param>
1503
- /// <param name="diagnosticsIds">The diagnostic ids to expect for the input source code.</param>
1504
+ /// <param name="generators">The generators to apply to the input syntax tree.</param>
1505
+ /// <param name="generatorDiagnosticsIds">The diagnostic ids to expect for the input source code.</param>
1504
1506
private static void VerifyGeneratedDiagnostics ( SyntaxTree syntaxTree , IIncrementalGenerator [ ] generators , string [ ] generatorDiagnosticsIds )
1505
1507
{
1506
1508
Type observableObjectType = typeof ( ObservableObject ) ;
0 commit comments