Skip to content

Commit c3261a3

Browse files
Merge pull request icsharpcode#3308 from tom-englert/dev/DependencyInjection
Migrate DI from Microsoft.VisualStudio.Composition to Microsoft.Extensions.DependencyInjection
2 parents 21e5d0f + 0be506b commit c3261a3

File tree

96 files changed

+311
-427
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+311
-427
lines changed

.editorconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,5 +147,3 @@ dotnet_naming_rule.private_fields_rule.symbols = private_fields_symbols
147147

148148
# MEF006: No importing constructor
149149
dotnet_diagnostic.MEF006.severity = silent
150-
# MEF002: Import attributes, to be removed after final DI migration
151-
dotnet_diagnostic.MEF002.severity = silent

Directory.Packages.props

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@
2323
<PackageVersion Include="Microsoft.DiaSymReader.Native" Version="17.0.0-beta1.21524.1" />
2424
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
2525
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
26+
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
2627
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
2728
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
2829
<PackageVersion Include="Microsoft.NETCore.ILAsm" Version="8.0.0" />
2930
<PackageVersion Include="Microsoft.NETCore.ILDAsm" Version="8.0.0" />
3031
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
31-
<PackageVersion Include="Microsoft.VisualStudio.Composition" Version="17.11.13" />
3232
<PackageVersion Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.135" />
3333
<PackageVersion Include="Mono.Cecil" Version="0.11.6" />
3434
<PackageVersion Include="NaturalSort.Extension" Version="4.3.0" />
@@ -38,15 +38,15 @@
3838
<PackageVersion Include="NUnit3TestAdapter" Version="4.6.0" />
3939
<PackageVersion Include="NuGet.Protocol" Version="6.11.1" />
4040
<PackageVersion Include="PowerShellStandard.Library" Version="5.1.1" />
41+
<PackageVersion Include="System.Composition.AttributedModel" Version="8.0.0" />
4142
<PackageVersion Include="System.Collections.Immutable" Version="8.0.0" />
42-
<PackageVersion Include="System.ComponentModel.Composition" Version="8.0.0" />
43-
<PackageVersion Include="System.Composition" Version="8.0.0" />
4443
<PackageVersion Include="System.Memory" Version="4.5.5" />
4544
<PackageVersion Include="System.Reflection.Metadata" Version="8.0.1" />
4645
<PackageVersion Include="System.Resources.Extensions" Version="8.0.0" />
4746
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
47+
<PackageVersion Include="TomsToolbox.Composition.MicrosoftExtensions" Version="2.20.0" />
4848
<PackageVersion Include="TomsToolbox.Wpf.Composition" Version="2.20.0" />
49-
<PackageVersion Include="TomsToolbox.Wpf.Composition.Mef" Version="2.20.0" />
49+
<PackageVersion Include="TomsToolbox.Wpf.Composition.AttributedModel" Version="2.20.0" />
5050
<PackageVersion Include="TomsToolbox.Wpf.Styles" Version="2.20.0" />
5151
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
5252
</ItemGroup>

ICSharpCode.ILSpyX/Analyzers/Builtin/AttributeAppliedToAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// DEALINGS IN THE SOFTWARE.
1818

1919
using System.Collections.Generic;
20-
using System.ComponentModel.Composition;
20+
using System.Composition;
2121
using System.Linq;
2222
using System.Reflection.Metadata;
2323
using System.Threading;
@@ -30,7 +30,7 @@
3030
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
3131
{
3232
[ExportAnalyzer(Header = "Applied To", Order = 10)]
33-
[PartCreationPolicy(CreationPolicy.Shared)]
33+
[Shared]
3434
class AttributeAppliedToAnalyzer : IAnalyzer
3535
{
3636
public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context)

ICSharpCode.ILSpyX/Analyzers/Builtin/EventImplementedByAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// DEALINGS IN THE SOFTWARE.
1818

1919
using System.Collections.Generic;
20-
using System.ComponentModel.Composition;
20+
using System.Composition;
2121
using System.Diagnostics;
2222
using System.Linq;
2323

@@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
2929
/// Shows events that implement an interface event.
3030
/// </summary>
3131
[ExportAnalyzer(Header = "Implemented By", Order = 10)]
32-
[PartCreationPolicy(CreationPolicy.Shared)]
32+
[Shared]
3333
class EventImplementedByAnalyzer : IAnalyzer
3434
{
3535
public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context)

ICSharpCode.ILSpyX/Analyzers/Builtin/EventOverriddenByAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// DEALINGS IN THE SOFTWARE.
1818

1919
using System.Collections.Generic;
20-
using System.ComponentModel.Composition;
20+
using System.Composition;
2121
using System.Diagnostics;
2222
using System.Linq;
2323

@@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
2929
/// Shows events that override an event.
3030
/// </summary>
3131
[ExportAnalyzer(Header = "Overridden By", Order = 20)]
32-
[PartCreationPolicy(CreationPolicy.Shared)]
32+
[Shared]
3333
class EventOverriddenByAnalyzer : IAnalyzer
3434
{
3535
public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context)

ICSharpCode.ILSpyX/Analyzers/Builtin/FieldAccessAnalyzer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
using System;
2020
using System.Collections.Generic;
21-
using System.ComponentModel.Composition;
21+
using System.Composition;
2222
using System.Diagnostics;
2323
using System.Linq;
2424
using System.Reflection.Metadata;
@@ -36,7 +36,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
3636
/// Finds methods where this field is read.
3737
/// </summary>
3838
[ExportAnalyzer(Header = "Assigned By", Order = 20)]
39-
[PartCreationPolicy(CreationPolicy.Shared)]
39+
[Shared]
4040
class AssignedByFieldAccessAnalyzer : FieldAccessAnalyzer
4141
{
4242
public AssignedByFieldAccessAnalyzer() : base(true) { }
@@ -46,7 +46,7 @@ public AssignedByFieldAccessAnalyzer() : base(true) { }
4646
/// Finds methods where this field is written.
4747
/// </summary>
4848
[ExportAnalyzer(Header = "Read By", Order = 10)]
49-
[PartCreationPolicy(CreationPolicy.Shared)]
49+
[Shared]
5050
class ReadByFieldAccessAnalyzer : FieldAccessAnalyzer
5151
{
5252
public ReadByFieldAccessAnalyzer() : base(false) { }

ICSharpCode.ILSpyX/Analyzers/Builtin/MemberImplementsInterfaceAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// DEALINGS IN THE SOFTWARE.
1818

1919
using System.Collections.Generic;
20-
using System.ComponentModel.Composition;
20+
using System.Composition;
2121
using System.Diagnostics;
2222
using System.Linq;
2323

@@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
2929
/// Shows members from all corresponding interfaces the selected member implements.
3030
/// </summary>
3131
[ExportAnalyzer(Header = "Implements", Order = 40)]
32-
[PartCreationPolicy(CreationPolicy.Shared)]
32+
[Shared]
3333
class MemberImplementsInterfaceAnalyzer : IAnalyzer
3434
{
3535
public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context)

ICSharpCode.ILSpyX/Analyzers/Builtin/MethodImplementedByAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// DEALINGS IN THE SOFTWARE.
1818

1919
using System.Collections.Generic;
20-
using System.ComponentModel.Composition;
20+
using System.Composition;
2121
using System.Diagnostics;
2222
using System.Linq;
2323

@@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
2929
/// Shows methods that implement an interface method.
3030
/// </summary>
3131
[ExportAnalyzer(Header = "Implemented By", Order = 40)]
32-
[PartCreationPolicy(CreationPolicy.Shared)]
32+
[Shared]
3333
class MethodImplementedByAnalyzer : IAnalyzer
3434
{
3535
public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context)

ICSharpCode.ILSpyX/Analyzers/Builtin/MethodOverriddenByAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
// DEALINGS IN THE SOFTWARE.
1818

1919
using System.Collections.Generic;
20-
using System.ComponentModel.Composition;
20+
using System.Composition;
2121
using System.Diagnostics;
2222
using System.Linq;
2323

@@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
2929
/// Shows methods that override a method.
3030
/// </summary>
3131
[ExportAnalyzer(Header = "Overridden By", Order = 30)]
32-
[PartCreationPolicy(CreationPolicy.Shared)]
32+
[Shared]
3333
class MethodOverriddenByAnalyzer : IAnalyzer
3434
{
3535
const GetMemberOptions Options = GetMemberOptions.IgnoreInheritedMembers | GetMemberOptions.ReturnMemberDefinitions;

ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsedByAnalyzer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
using System;
2020
using System.Collections.Generic;
21-
using System.ComponentModel.Composition;
21+
using System.Composition;
2222
using System.Diagnostics;
2323
using System.Linq;
2424
using System.Reflection.Metadata;
@@ -33,7 +33,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
3333
/// Shows entities that are used by a method.
3434
/// </summary>
3535
[ExportAnalyzer(Header = "Used By", Order = 20)]
36-
[PartCreationPolicy(CreationPolicy.Shared)]
36+
[Shared]
3737
class MethodUsedByAnalyzer : IAnalyzer
3838
{
3939
const GetMemberOptions Options = GetMemberOptions.IgnoreInheritedMembers | GetMemberOptions.ReturnMemberDefinitions;

0 commit comments

Comments
 (0)