Skip to content

Commit

Permalink
#73 Code generation errors when using Unity
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolayPianikov committed Nov 13, 2024
1 parent f83f669 commit a108277
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Pure.DI/SourceGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Pure.DI;

using Exception = System.Exception;

[Generator(LanguageNames.CSharp)]
public class SourceGenerator : IIncrementalGenerator
{
Expand All @@ -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
}
}
});

Expand Down

0 comments on commit a108277

Please sign in to comment.