Roslyn Analyzer for detecting coding errors in Unity projects using VContainer.
Warning
This is in a very early stage of development. Please use with caution.
VContainerAnalyzer can be set up via Unity Package Manager by following the steps below.
- Open the Package Manager in the UnityEditor.
- Select the + button in the upper left corner.
- Select
Add package from git URL
. - Enter
https://github.com/VeyronSakai/VContainerAnalyzer.git?path=VContainerAnalyzer.Unity/Assets/Plugins/VContainerAnalyzer#0.5.8
and SelectAdd
button. - Add
VContainer.Analyzer
to the Assembly Definition References of the asmdef to which you want to apply Analyzer.
VContainerAnalyzer can be set up by using the .unitypackage available at Releases.
Topic | Value |
---|---|
Id | VContainer0001 |
Severity | Error |
Enabled | True |
Category | Usage |
An error occurs if the constructor of a class registered by the Register()
or RegisterEntryPoint()
or UseEntryPoints()
methods in the Lifetime class does not have an Attribute that extends PreserveAttribute
such
as InjectAttribute
.
See the VContainer documentation for more information.
Caution
Analysis is not supported for System class inheriting from Unity.Entities.SystemBase. This is because VContainer's ECS support is beta. Also, currently the analysis is performed without considering link.xml.
Topic | Value |
---|---|
Id | VContainer0002 |
Severity | Warning |
Enabled | True |
Category | Usage |
Warning occurs when using Property/Field Injection.
public class FieldInjectionSandbox
{
[Inject] private IService _field;
}
public class PropertyInjectionSandbox
{
[Inject] private IService Property { get; set; }
}
See the VContainer documentation for more information.
Bugs and new feature suggestions are welcome in issues and Pull Requests.
Analyzer based on the Roslyn Analyzer Template.