hadashiA / VContainer

The extra fast, minimum code size, GC-free DI (Dependency Injection) library running on Unity Game Engine.
https://vcontainer.hadashikick.jp
MIT License
1.97k stars 172 forks source link

SourceGenerator Error #518

Closed zhuxianzhiniko closed 1 year ago

zhuxianzhiniko commented 1 year ago

Hi, after I use [Inject] for Field Injection, SourceGenerator will have a reference exception.

After I tested, I found that this error will appear as long as I use namespace. If I remove the namespace, SourceGenerator can work normally.

Log: Container.SourceGenerator\VContainer.SourceGenerator.VContainerSourceGenerator\TestGeneratedInjector.g.cs(18,39): error CS0246: The type or namespace name 'TestNamespace' could not be found (are you missing a using directive or an assembly reference? )

VContainer :1.13.2 Unity: 2022.2.19f1

This is a minimal case VContainerTest.zip

zhuxianzhiniko commented 1 year ago

I found that it can be easily fixed.

Just modify VContainerSourceGenerator.cs, line 222

fieldSymbol.Type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat);

hadashiA commented 1 year ago

Fixed in #532. Thanks for the report.