VContainerAnalyzer 0.6.0

dotnet add package VContainerAnalyzer --version 0.6.0
                    
NuGet\Install-Package VContainerAnalyzer -Version 0.6.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="VContainerAnalyzer" Version="0.6.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="VContainerAnalyzer" Version="0.6.0" />
                    
Directory.Packages.props
<PackageReference Include="VContainerAnalyzer">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add VContainerAnalyzer --version 0.6.0
                    
#r "nuget: VContainerAnalyzer, 0.6.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package VContainerAnalyzer@0.6.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=VContainerAnalyzer&version=0.6.0
                    
Install as a Cake Addin
#tool nuget:?package=VContainerAnalyzer&version=0.6.0
                    
Install as a Cake Tool

VContainerAnalyzer

Test NuGet

Roslyn Analyzer for detecting coding errors in Unity projects using VContainer.

This is in a very early stage of development. Please use with caution.

Setup

Unity Package Manager

VContainerAnalyzer can be set up via Unity Package Manager by following the steps below.

  1. Open the Package Manager in the UnityEditor.
  2. Select the + button in the upper left corner.
  3. Select Add package from git URL.
  4. Enter https://github.com/VeyronSakai/VContainerAnalyzer.git?path=VContainerAnalyzer.Unity/Assets/Plugins/VContainerAnalyzer#0.5.8 and Select Add button.
  5. Add VContainer.Analyzer to the Assembly Definition References of the asmdef to which you want to apply Analyzer.

.unitypackage

VContainerAnalyzer can be set up by using the .unitypackage available at Releases.

Rules

VContainer0001

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.

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.

VContainer0002

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.

Contribution

Bugs and new feature suggestions are welcome in issues and Pull Requests.


Analyzer based on the Roslyn Analyzer Template.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.6.0 111 1/7/2025
0.5.7 180 4/30/2024
0.5.6 141 4/22/2024
0.5.5 135 4/22/2024
0.5.4 116 4/19/2024
0.5.3 123 4/19/2024
0.5.2 130 4/19/2024
0.5.1 126 4/18/2024
0.5.0 118 4/18/2024
0.4.2 145 4/17/2024
0.4.1 159 4/14/2024
0.4.0 132 4/14/2024
0.3.3 151 4/10/2024
0.3.2 153 4/10/2024
0.3.1 156 4/10/2024
0.2.6 149 4/9/2024
0.2.5 156 4/9/2024
0.2.4 166 4/9/2024
0.2.3 194 4/9/2024
0.2.2 200 4/9/2024
0.2.1 158 4/9/2024
0.2.0 176 4/9/2024
0.1.5 197 4/8/2024
0.1.4 204 4/8/2024
0.1.3 156 4/8/2024
0.1.0 199 4/7/2024