Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,5 @@ dotnet_diagnostic.CA1707.severity = none # CA1707: Identifiers sh
dotnet_diagnostic.CA1724.severity = none # CA1724: Type names should not match namespaces
dotnet_diagnostic.CA1822.severity = none # CA1822: Mark members as static
dotnet_diagnostic.CA1873.severity = none # CA1873: Evaluation of this argument may be expensive and unnecessary if logging is disabled

dotnet_diagnostic.MA0002.severity = none # MA0002: IEqualityComparer<string> or IComparer<string> is missing
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ jobs:
- uses: actions/checkout@v7

- name: Setup .NET
uses: actions/setup-dotnet@v5
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x

- name: Setup .NET
uses: actions/setup-dotnet@v5
uses: actions/setup-dotnet@v6
with:
dotnet-quality: 'preview'
dotnet-version: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:
- uses: actions/checkout@v7

- name: Setup .NET
uses: actions/setup-dotnet@v5
uses: actions/setup-dotnet@v6
with:
dotnet-version: |
8.0.x
9.0.x
10.0.x

- name: Setup .NET
uses: actions/setup-dotnet@v5
uses: actions/setup-dotnet@v6
with:
dotnet-quality: 'preview'
dotnet-version: |
Expand Down
32 changes: 16 additions & 16 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,42 @@

<ItemGroup>
<PackageVersion Include="AssemblyMetadata.Generators" Version="2.2.0" />
<PackageVersion Include="Immediate.Handlers" Version="3.10.0" />
<PackageVersion Include="Immediate.Handlers" Version="3.11.1" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="5.6.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing" Version="1.1.4" />
<PackageVersion Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.9.0" />
<PackageVersion Include="Scriban" Version="7.2.5" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="10.1.7" />
<PackageVersion Include="System.Threading.Tasks.Extensions" Version="4.6.3" />
<PackageVersion Include="Verify.SourceGenerators" Version="2.5.0" />
<PackageVersion Include="Verify.XunitV3" Version="31.22.0" />
<PackageVersion Include="Verify.XunitV3" Version="31.27.0" />
<PackageVersion Include="xunit.v3.mtp-v2" Version="3.2.2" />
</ItemGroup>

<!-- II.Shared dependencies -->
<ItemGroup Condition=" '$(TargetFramework)' == 'net11.0' ">
<PackageVersion Include="Basic.Reference.Assemblies.Net110" Version="1.8.9" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="11.0.0-preview.5.26302.115" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="11.0.0-preview.5.26302.115" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.Testing" Version="10.7.0" />
<PackageVersion Include="Basic.Reference.Assemblies.Net110" Version="1.8.10" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="11.0.0-preview.6.26359.118" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="11.0.0-preview.6.26359.118" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.Testing" Version="10.8.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net10.0' ">
<PackageVersion Include="Basic.Reference.Assemblies.Net100" Version="1.8.9" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.9" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.Testing" Version="10.6.0" />
<PackageVersion Include="Basic.Reference.Assemblies.Net100" Version="1.8.10" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="10.0.10" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.10" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.Testing" Version="10.8.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net9.0' ">
<PackageVersion Include="Basic.Reference.Assemblies.Net90" Version="1.8.9" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.17" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.17" />
<PackageVersion Include="Basic.Reference.Assemblies.Net90" Version="1.8.10" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.18" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.18" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.Testing" Version="9.10.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
<PackageVersion Include="Basic.Reference.Assemblies.Net80" Version="1.8.9" />
<PackageVersion Include="Basic.Reference.Assemblies.Net80" Version="1.8.10" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Diagnostics.Testing" Version="8.10.0" />
Expand Down Expand Up @@ -84,8 +84,8 @@

<ItemGroup>
<GlobalPackageReference Include="DotNet.ReproducibleBuilds" Version="2.0.5" PrivateAssets="All" />
<GlobalPackageReference Include="Meziantou.Analyzer" Version="3.0.122" PrivateAssets="All" />
<GlobalPackageReference Include="Meziantou.Polyfill" Version="1.0.157" PrivateAssets="All" />
<GlobalPackageReference Include="Meziantou.Analyzer" Version="3.0.126" PrivateAssets="All" />
<GlobalPackageReference Include="Meziantou.Polyfill" Version="1.0.158" PrivateAssets="All" />
<GlobalPackageReference Include="MinVer" Version="7.0.0" PrivateAssets="All" />
</ItemGroup>
</Project>
4 changes: 2 additions & 2 deletions src/Immediate.Injections.Analyzers/RegisterTypeAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ public sealed class RegisterTypeAnalyzer : DiagnosticAnalyzer
defaultSeverity: DiagnosticSeverity.Error,
isEnabledByDefault: true,
description:
"`Factory` specifies a factory method used for the service registration. "
+ "MSDI does not support registering open-generic services with a factory method.",
"`Factory` specifies a factory method used for the service registration. "
+ "MSDI does not support registering open-generic services with a factory method.",
customTags: [WellKnownDiagnosticTags.NotConfigurable]
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ private static EquatableReadOnlyList<RegisterClass> TransformRegisterClass1(Gene
{
TypeArguments:
[
INamedTypeSymbol serviceSymbol,
INamedTypeSymbol serviceSymbol,
],
})
{
Expand Down Expand Up @@ -405,8 +405,8 @@ private static EquatableReadOnlyList<RegisterClass> TransformRegisterClass2(Gene
{
TypeArguments:
[
INamedTypeSymbol serviceSymbol,
INamedTypeSymbol implementationSymbol
INamedTypeSymbol serviceSymbol,
INamedTypeSymbol implementationSymbol,
],
}
|| !SymbolEqualityComparer.Default.Equals(implementationSymbol.OriginalDefinition, targetSymbol))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public async Task ValidAddServicesMethod(string framework)
Assert.Equal(
[
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.ServiceCollectionExtensions.g.cs",
"Immediate.Handlers.Generators/Immediate.Handlers.Generators.ImmediateHandlersGenerator/IH.ServiceCollectionExtensions.g.cs",
],
result.GeneratedTrees.Select(t => t.FilePath.Replace('\\', '/'))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ ReadOnlySpan<string> skippedSteps
TrackedOutputSteps: { } outputSteps,
TrackedSteps: { } trackedSteps,
},
_
_
],
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public static void CallMe(IServiceCollection services)
[
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.ServiceCollectionExtensions.g.cs",
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.RegisterServicesMethods.g.cs",
"Immediate.Handlers.Generators/Immediate.Handlers.Generators.ImmediateHandlersGenerator/IH.ServiceCollectionExtensions.g.cs",
],
result.GeneratedTrees.Select(t => t.FilePath.Replace('\\', '/'))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class Service<T> : IService<T>
[
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.ServiceCollectionExtensions.g.cs",
$"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.Register{lifetime}`0.g.cs",
"Immediate.Handlers.Generators/Immediate.Handlers.Generators.ImmediateHandlersGenerator/IH.ServiceCollectionExtensions.g.cs",
],
result.GeneratedTrees.Select(t => t.FilePath.Replace('\\', '/'))
);
Expand Down Expand Up @@ -58,6 +59,7 @@ public class Service<T> : IService<T>
[
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.ServiceCollectionExtensions.g.cs",
$"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.Register{lifetime}`0.g.cs",
"Immediate.Handlers.Generators/Immediate.Handlers.Generators.ImmediateHandlersGenerator/IH.ServiceCollectionExtensions.g.cs",
],
result.GeneratedTrees.Select(t => t.FilePath.Replace('\\', '/'))
);
Expand Down Expand Up @@ -90,6 +92,7 @@ public class Service<T> : IService<T>
[
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.ServiceCollectionExtensions.g.cs",
$"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.Register{lifetime}`0.g.cs",
"Immediate.Handlers.Generators/Immediate.Handlers.Generators.ImmediateHandlersGenerator/IH.ServiceCollectionExtensions.g.cs",
],
result.GeneratedTrees.Select(t => t.FilePath.Replace('\\', '/'))
);
Expand Down Expand Up @@ -124,6 +127,7 @@ public class Service<T1, T2> : IService0, IService1<T1>, IService2<T1, T2>
[
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.ServiceCollectionExtensions.g.cs",
$"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.Register{lifetime}`0.g.cs",
"Immediate.Handlers.Generators/Immediate.Handlers.Generators.ImmediateHandlersGenerator/IH.ServiceCollectionExtensions.g.cs",
],
result.GeneratedTrees.Select(t => t.FilePath.Replace('\\', '/'))
);
Expand Down Expand Up @@ -157,6 +161,7 @@ public class Service<T> : IService1<T>, IService2<int>
[
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.ServiceCollectionExtensions.g.cs",
$"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.Register{lifetime}`0.g.cs",
"Immediate.Handlers.Generators/Immediate.Handlers.Generators.ImmediateHandlersGenerator/IH.ServiceCollectionExtensions.g.cs",
],
result.GeneratedTrees.Select(t => t.FilePath.Replace('\\', '/'))
);
Expand Down Expand Up @@ -186,6 +191,7 @@ public class Service<T> : IService<T>
Assert.Equal(
[
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.ServiceCollectionExtensions.g.cs",
"Immediate.Handlers.Generators/Immediate.Handlers.Generators.ImmediateHandlersGenerator/IH.ServiceCollectionExtensions.g.cs",
],
result.GeneratedTrees.Select(t => t.FilePath.Replace('\\', '/'))
);
Expand Down Expand Up @@ -217,6 +223,7 @@ public sealed class Service<T> : IService<T>
Assert.Equal(
[
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.ServiceCollectionExtensions.g.cs",
"Immediate.Handlers.Generators/Immediate.Handlers.Generators.ImmediateHandlersGenerator/IH.ServiceCollectionExtensions.g.cs",
],
result.GeneratedTrees.Select(t => t.FilePath.Replace('\\', '/'))
);
Expand Down Expand Up @@ -252,6 +259,7 @@ public static Service<T> BuildService(IServiceProvider sp)
Assert.Equal(
[
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.ServiceCollectionExtensions.g.cs",
"Immediate.Handlers.Generators/Immediate.Handlers.Generators.ImmediateHandlersGenerator/IH.ServiceCollectionExtensions.g.cs",
],
result.GeneratedTrees.Select(t => t.FilePath.Replace('\\', '/'))
);
Expand Down Expand Up @@ -282,6 +290,7 @@ public sealed class Service<T> : IService<T>
[
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.ServiceCollectionExtensions.g.cs",
$"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.Register{lifetime}`0.g.cs",
"Immediate.Handlers.Generators/Immediate.Handlers.Generators.ImmediateHandlersGenerator/IH.ServiceCollectionExtensions.g.cs",
],
result.GeneratedTrees.Select(t => t.FilePath.Replace('\\', '/'))
);
Expand Down Expand Up @@ -312,6 +321,7 @@ public sealed class Service<T> : IService<T>
[
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.ServiceCollectionExtensions.g.cs",
$"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.Register{lifetime}`0.g.cs",
"Immediate.Handlers.Generators/Immediate.Handlers.Generators.ImmediateHandlersGenerator/IH.ServiceCollectionExtensions.g.cs",
],
result.GeneratedTrees.Select(t => t.FilePath.Replace('\\', '/'))
);
Expand Down Expand Up @@ -342,6 +352,7 @@ public sealed class Service<T> : IService<T>
[
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.ServiceCollectionExtensions.g.cs",
$"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.Register{lifetime}`0.g.cs",
"Immediate.Handlers.Generators/Immediate.Handlers.Generators.ImmediateHandlersGenerator/IH.ServiceCollectionExtensions.g.cs",
],
result.GeneratedTrees.Select(t => t.FilePath.Replace('\\', '/'))
);
Expand Down Expand Up @@ -372,6 +383,7 @@ public sealed class Service<T> : IService<T>
[
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.ServiceCollectionExtensions.g.cs",
$"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.Register{lifetime}`0.g.cs",
"Immediate.Handlers.Generators/Immediate.Handlers.Generators.ImmediateHandlersGenerator/IH.ServiceCollectionExtensions.g.cs",
],
result.GeneratedTrees.Select(t => t.FilePath.Replace('\\', '/'))
);
Expand Down Expand Up @@ -402,6 +414,7 @@ public sealed class Service<T> : IService<T>
[
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.ServiceCollectionExtensions.g.cs",
$"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.Register{lifetime}`0.g.cs",
"Immediate.Handlers.Generators/Immediate.Handlers.Generators.ImmediateHandlersGenerator/IH.ServiceCollectionExtensions.g.cs",
],
result.GeneratedTrees.Select(t => t.FilePath.Replace('\\', '/'))
);
Expand Down Expand Up @@ -434,6 +447,7 @@ public sealed class Service<T> : IService<T>
[
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.ServiceCollectionExtensions.g.cs",
$"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.Register{lifetime}`0.g.cs",
"Immediate.Handlers.Generators/Immediate.Handlers.Generators.ImmediateHandlersGenerator/IH.ServiceCollectionExtensions.g.cs",
],
result.GeneratedTrees.Select(t => t.FilePath.Replace('\\', '/'))
);
Expand Down Expand Up @@ -466,6 +480,7 @@ public sealed class Service<T> : IService<T>
[
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.ServiceCollectionExtensions.g.cs",
$"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.Register{lifetime}`0.g.cs",
"Immediate.Handlers.Generators/Immediate.Handlers.Generators.ImmediateHandlersGenerator/IH.ServiceCollectionExtensions.g.cs",
],
result.GeneratedTrees.Select(t => t.FilePath.Replace('\\', '/'))
);
Expand Down Expand Up @@ -498,6 +513,7 @@ public sealed class Service<T> : IService<T>
[
"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.ServiceCollectionExtensions.g.cs",
$"Immediate.Injections.Generators/Immediate.Injections.Generators.ImmediateInjectionsGenerator/II.Register{lifetime}`0.g.cs",
"Immediate.Handlers.Generators/Immediate.Handlers.Generators.ImmediateHandlersGenerator/IH.ServiceCollectionExtensions.g.cs",
],
result.GeneratedTrees.Select(t => t.FilePath.Replace('\\', '/'))
);
Expand Down
Loading