diff --git a/src/Pure.DI/SourceGenerator.cs b/src/Pure.DI/SourceGenerator.cs index 0362ea80e..ec1fd9623 100644 --- a/src/Pure.DI/SourceGenerator.cs +++ b/src/Pure.DI/SourceGenerator.cs @@ -2,6 +2,8 @@ namespace Pure.DI; +using Exception = System.Exception; + [Generator(LanguageNames.CSharp)] public class SourceGenerator : IIncrementalGenerator { @@ -17,7 +19,14 @@ public void Initialize(IncrementalGeneratorInitializationContext context) { foreach (var apiSource in _generator.Api) { - initializationContext.AddSource(apiSource.HintName, apiSource.SourceText); + try + { + initializationContext.AddSource(apiSource.HintName, apiSource.SourceText); + } + catch + { + // ignored + } } });