@@ -103,11 +103,7 @@ private void Execute(SourceProductionContext spc,
103
103
var optimizationLevel = compilation . Options . OptimizationLevel ;
104
104
var useDI = configOptions . GetFLLUseDependencyInjection ( ) ;
105
105
106
- PluginClassInfo pluginInfo = null ;
107
- if ( ! useDI )
108
- {
109
- pluginInfo = GetValidPluginInfo ( pluginClasses , spc ) ;
110
- }
106
+ var pluginInfo = GetValidPluginInfo ( pluginClasses , spc , useDI ) ;
111
107
112
108
GenerateSource (
113
109
spc ,
@@ -463,7 +459,8 @@ private static PluginClassInfo GetPluginClassInfo(GeneratorSyntaxContext context
463
459
464
460
private static PluginClassInfo GetValidPluginInfo (
465
461
ImmutableArray < PluginClassInfo > pluginClasses ,
466
- SourceProductionContext context )
462
+ SourceProductionContext context ,
463
+ bool useDI )
467
464
{
468
465
// If p is null, this class does not implement IPluginI18n
469
466
var iPluginI18nClasses = pluginClasses . Where ( p => p != null ) . ToArray ( ) ;
@@ -476,6 +473,13 @@ private static PluginClassInfo GetValidPluginInfo(
476
473
return null ;
477
474
}
478
475
476
+ // If we use dependency injection, we do not need to check if there is a valid plugin context
477
+ // Also we do not need to return the plugin info
478
+ if ( useDI )
479
+ {
480
+ return null ;
481
+ }
482
+
479
483
// If p.PropertyName is null, this class does not have PluginInitContext property
480
484
var iPluginI18nClassesWithContext = iPluginI18nClasses . Where ( p => p . PropertyName != null ) . ToArray ( ) ;
481
485
if ( iPluginI18nClassesWithContext . Length == 0 )
0 commit comments