From 0be506bd4ecfb9d9cadbe2bc8a70d8d0c6c876bf Mon Sep 17 00:00:00 2001 From: tom-englert Date: Tue, 22 Oct 2024 05:41:52 +0200 Subject: [PATCH] Get rid of the heavy System.ComponentModel.Composition, replace with the lightweight System.Composition.AttributedModel --- .editorconfig | 2 -- Directory.Packages.props | 7 +++---- .../Builtin/AttributeAppliedToAnalyzer.cs | 4 ++-- .../Builtin/EventImplementedByAnalyzer.cs | 4 ++-- .../Analyzers/Builtin/EventOverriddenByAnalyzer.cs | 4 ++-- .../Analyzers/Builtin/FieldAccessAnalyzer.cs | 6 +++--- .../Builtin/MemberImplementsInterfaceAnalyzer.cs | 4 ++-- .../Builtin/MethodImplementedByAnalyzer.cs | 4 ++-- .../Builtin/MethodOverriddenByAnalyzer.cs | 4 ++-- .../Analyzers/Builtin/MethodUsedByAnalyzer.cs | 4 ++-- .../Analyzers/Builtin/MethodUsesAnalyzer.cs | 4 ++-- .../Builtin/MethodVirtualUsedByAnalyzer.cs | 4 ++-- .../Builtin/PropertyImplementedByAnalyzer.cs | 4 ++-- .../Builtin/PropertyOverriddenByAnalyzer.cs | 4 ++-- .../Analyzers/Builtin/TypeExposedByAnalyzer.cs | 4 ++-- .../Builtin/TypeExtensionMethodsAnalyzer.cs | 4 ++-- .../Builtin/TypeInstantiatedByAnalyzer.cs | 4 ++-- .../Analyzers/Builtin/TypeUsedByAnalyzer.cs | 4 ++-- .../Analyzers/ExportAnalyzerAttribute.cs | 2 +- ICSharpCode.ILSpyX/ICSharpCode.ILSpyX.csproj | 3 +-- ILSpy.BamlDecompiler/BamlResourceNodeFactory.cs | 6 +++--- ILSpy.ReadyToRun/ReadyToRunLanguage.cs | 4 ++-- ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml.cs | 8 ++++---- ILSpy/AboutPage.cs | 4 ++-- ILSpy/Analyzers/AnalyzeCommand.cs | 4 ++-- ILSpy/Analyzers/AnalyzerTreeView.xaml.cs | 6 +++--- ILSpy/Analyzers/AnalyzerTreeViewModel.cs | 4 ++-- .../CopyAnalysisResultsContextMenuEntry.cs | 4 ++-- ILSpy/Analyzers/RemoveAnalyzeContextMenuEntry.cs | 4 ++-- ILSpy/AssemblyTree/AssemblyListPane.xaml.cs | 6 +++--- ILSpy/AssemblyTree/AssemblyTreeModel.cs | 4 ++-- ILSpy/Commands/BrowseBackCommand.cs | 5 ++--- ILSpy/Commands/BrowseForwardCommand.cs | 5 ++--- ILSpy/Commands/CheckForUpdatesCommand.cs | 4 ++-- .../CopyFullyQualifiedNameContextMenuEntry.cs | 4 ++-- ILSpy/Commands/DecompileAllCommand.cs | 9 ++++----- ILSpy/Commands/DecompileCommand.cs | 4 ++-- ILSpy/Commands/DecompileInNewViewCommand.cs | 5 ++--- ILSpy/Commands/DisassembleAllCommand.cs | 4 ++-- ILSpy/Commands/ExitCommand.cs | 4 ++-- ILSpy/Commands/ExportCommandAttribute.cs | 2 +- .../ExtractPackageEntryContextMenuEntry.cs | 4 ++-- ILSpy/Commands/GeneratePdbContextMenuEntry.cs | 6 +++--- ILSpy/Commands/ManageAssemblyListsCommand.cs | 4 ++-- ILSpy/Commands/OpenCommand.cs | 5 ++--- ILSpy/Commands/OpenFromGacCommand.cs | 5 ++--- ILSpy/Commands/Pdb2XmlCommand.cs | 6 +++--- ILSpy/Commands/RefreshCommand.cs | 5 ++--- ILSpy/Commands/RemoveAssembliesWithLoadErrors.cs | 8 +++----- ILSpy/Commands/SaveCodeContextMenuEntry.cs | 4 ++-- ILSpy/Commands/SaveCommand.cs | 5 ++--- ILSpy/Commands/ScopeSearchToAssembly.cs | 5 ++--- ILSpy/Commands/ScopeSearchToNamespace.cs | 5 ++--- ILSpy/Commands/SearchMsdnContextMenuEntry.cs | 4 ++-- ILSpy/Commands/SelectPdbContextMenuEntry.cs | 4 ++-- ILSpy/Commands/ShowCFGContextMenuEntry.cs | 4 ++-- ILSpy/Commands/SortAssemblyListCommand.cs | 6 +++--- ILSpy/ContextMenuEntry.cs | 2 +- ILSpy/Docking/CloseAllDocumentsCommand.cs | 6 +++--- ILSpy/ILSpy.csproj | 3 +-- ILSpy/Languages/CSharpILMixedLanguage.cs | 4 ++-- ILSpy/Languages/CSharpLanguage.cs | 7 +++---- ILSpy/Languages/ILLanguage.cs | 4 ++-- ILSpy/Metadata/GoToTokenCommand.cs | 6 +++--- ILSpy/Metadata/MetadataProtocolHandler.cs | 4 ++-- ILSpy/Options/DecompilerSettingsPanel.xaml.cs | 6 +++--- ILSpy/Options/DecompilerSettingsViewModel.cs | 4 ++-- ILSpy/Options/DisplaySettingsPanel.xaml.cs | 6 +++--- ILSpy/Options/DisplaySettingsViewModel.cs | 4 ++-- ILSpy/Options/MiscSettingsPanel.xaml.cs | 6 +++--- ILSpy/Options/MiscSettingsViewModel.cs | 4 ++-- ILSpy/Options/OptionsDialog.xaml.cs | 5 ++--- ILSpy/Search/SearchPane.xaml.cs | 8 ++++---- ILSpy/Search/SearchPaneModel.cs | 4 ++-- ILSpy/TextView/EditorCommands.cs | 6 +++--- ILSpy/TextView/FoldingCommands.cs | 6 +++--- ILSpy/TreeNodes/AssemblyTreeNode.cs | 14 +++++++------- .../ResourceNodes/CursorResourceEntryNode.cs | 4 ++-- .../ResourceNodes/IconResourceEntryNode.cs | 4 ++-- .../ResourceNodes/ImageListResourceEntryNode.cs | 4 ++-- .../ResourceNodes/ImageResourceEntryNode.cs | 4 ++-- .../ResourceNodes/ResourcesFileTreeNode.cs | 4 ++-- ILSpy/TreeNodes/ResourceNodes/XamlResourceNode.cs | 4 ++-- ILSpy/TreeNodes/ResourceNodes/XmlResourceNode.cs | 4 ++-- ILSpy/TreeNodes/ThreadingSupport.cs | 4 ++-- ILSpy/ViewModels/DebugStepsPaneModel.cs | 4 ++-- ILSpy/Views/DebugSteps.xaml.cs | 6 +++--- TestPlugin/AboutPageAddition.cs | 4 ++-- TestPlugin/ContextMenuCommand.cs | 4 ++-- TestPlugin/CustomLanguage.cs | 4 ++-- TestPlugin/CustomOptionPage.xaml.cs | 8 ++++---- TestPlugin/MainMenuCommand.cs | 4 ++-- TestPlugin/Readme.txt | 2 +- 93 files changed, 209 insertions(+), 228 deletions(-) diff --git a/.editorconfig b/.editorconfig index b2021e8c6..1ea262ade 100644 --- a/.editorconfig +++ b/.editorconfig @@ -147,5 +147,3 @@ dotnet_naming_rule.private_fields_rule.symbols = private_fields_symbols # MEF006: No importing constructor dotnet_diagnostic.MEF006.severity = silent -# MEF002: Import attributes, to be removed after final DI migration -dotnet_diagnostic.MEF002.severity = silent diff --git a/Directory.Packages.props b/Directory.Packages.props index f207629a4..054032035 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -23,7 +23,7 @@ - + @@ -38,16 +38,15 @@ + - - - + diff --git a/ICSharpCode.ILSpyX/Analyzers/Builtin/AttributeAppliedToAnalyzer.cs b/ICSharpCode.ILSpyX/Analyzers/Builtin/AttributeAppliedToAnalyzer.cs index f19b23e41..ba907ccb0 100644 --- a/ICSharpCode.ILSpyX/Analyzers/Builtin/AttributeAppliedToAnalyzer.cs +++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/AttributeAppliedToAnalyzer.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using System.Reflection.Metadata; using System.Threading; @@ -30,7 +30,7 @@ using ICSharpCode.Decompiler.Util; namespace ICSharpCode.ILSpyX.Analyzers.Builtin { [ExportAnalyzer(Header = "Applied To", Order = 10)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class AttributeAppliedToAnalyzer : IAnalyzer { public IEnumerable Analyze(ISymbol analyzedSymbol, AnalyzerContext context) diff --git a/ICSharpCode.ILSpyX/Analyzers/Builtin/EventImplementedByAnalyzer.cs b/ICSharpCode.ILSpyX/Analyzers/Builtin/EventImplementedByAnalyzer.cs index e01513d2a..01ac66cc1 100644 --- a/ICSharpCode.ILSpyX/Analyzers/Builtin/EventImplementedByAnalyzer.cs +++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/EventImplementedByAnalyzer.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.Linq; @@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin /// Shows events that implement an interface event. /// [ExportAnalyzer(Header = "Implemented By", Order = 10)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class EventImplementedByAnalyzer : IAnalyzer { public IEnumerable Analyze(ISymbol analyzedSymbol, AnalyzerContext context) diff --git a/ICSharpCode.ILSpyX/Analyzers/Builtin/EventOverriddenByAnalyzer.cs b/ICSharpCode.ILSpyX/Analyzers/Builtin/EventOverriddenByAnalyzer.cs index 55206ce81..bc6ea372a 100644 --- a/ICSharpCode.ILSpyX/Analyzers/Builtin/EventOverriddenByAnalyzer.cs +++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/EventOverriddenByAnalyzer.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.Linq; @@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin /// Shows events that override an event. /// [ExportAnalyzer(Header = "Overridden By", Order = 20)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class EventOverriddenByAnalyzer : IAnalyzer { public IEnumerable Analyze(ISymbol analyzedSymbol, AnalyzerContext context) diff --git a/ICSharpCode.ILSpyX/Analyzers/Builtin/FieldAccessAnalyzer.cs b/ICSharpCode.ILSpyX/Analyzers/Builtin/FieldAccessAnalyzer.cs index ad02b999f..64a0630da 100644 --- a/ICSharpCode.ILSpyX/Analyzers/Builtin/FieldAccessAnalyzer.cs +++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/FieldAccessAnalyzer.cs @@ -18,7 +18,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.Linq; using System.Reflection.Metadata; @@ -36,7 +36,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin /// Finds methods where this field is read. /// [ExportAnalyzer(Header = "Assigned By", Order = 20)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class AssignedByFieldAccessAnalyzer : FieldAccessAnalyzer { public AssignedByFieldAccessAnalyzer() : base(true) { } @@ -46,7 +46,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin /// Finds methods where this field is written. /// [ExportAnalyzer(Header = "Read By", Order = 10)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class ReadByFieldAccessAnalyzer : FieldAccessAnalyzer { public ReadByFieldAccessAnalyzer() : base(false) { } diff --git a/ICSharpCode.ILSpyX/Analyzers/Builtin/MemberImplementsInterfaceAnalyzer.cs b/ICSharpCode.ILSpyX/Analyzers/Builtin/MemberImplementsInterfaceAnalyzer.cs index 4090650d3..e5bab201d 100644 --- a/ICSharpCode.ILSpyX/Analyzers/Builtin/MemberImplementsInterfaceAnalyzer.cs +++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/MemberImplementsInterfaceAnalyzer.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.Linq; @@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin /// Shows members from all corresponding interfaces the selected member implements. /// [ExportAnalyzer(Header = "Implements", Order = 40)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class MemberImplementsInterfaceAnalyzer : IAnalyzer { public IEnumerable Analyze(ISymbol analyzedSymbol, AnalyzerContext context) diff --git a/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodImplementedByAnalyzer.cs b/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodImplementedByAnalyzer.cs index 644212fab..811d35f8f 100644 --- a/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodImplementedByAnalyzer.cs +++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodImplementedByAnalyzer.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.Linq; @@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin /// Shows methods that implement an interface method. /// [ExportAnalyzer(Header = "Implemented By", Order = 40)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class MethodImplementedByAnalyzer : IAnalyzer { public IEnumerable Analyze(ISymbol analyzedSymbol, AnalyzerContext context) diff --git a/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodOverriddenByAnalyzer.cs b/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodOverriddenByAnalyzer.cs index c2156d846..ee6390490 100644 --- a/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodOverriddenByAnalyzer.cs +++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodOverriddenByAnalyzer.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.Linq; @@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin /// Shows methods that override a method. /// [ExportAnalyzer(Header = "Overridden By", Order = 30)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class MethodOverriddenByAnalyzer : IAnalyzer { const GetMemberOptions Options = GetMemberOptions.IgnoreInheritedMembers | GetMemberOptions.ReturnMemberDefinitions; diff --git a/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsedByAnalyzer.cs b/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsedByAnalyzer.cs index a2cb79828..93c0dd395 100644 --- a/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsedByAnalyzer.cs +++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsedByAnalyzer.cs @@ -18,7 +18,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.Linq; using System.Reflection.Metadata; @@ -33,7 +33,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin /// Shows entities that are used by a method. /// [ExportAnalyzer(Header = "Used By", Order = 20)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class MethodUsedByAnalyzer : IAnalyzer { const GetMemberOptions Options = GetMemberOptions.IgnoreInheritedMembers | GetMemberOptions.ReturnMemberDefinitions; diff --git a/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsesAnalyzer.cs b/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsesAnalyzer.cs index 6c7576f7c..7f4ce9144 100644 --- a/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsesAnalyzer.cs +++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsesAnalyzer.cs @@ -18,7 +18,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using System.Reflection.Metadata; @@ -33,7 +33,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin /// Shows entities that are used by a method. /// [ExportAnalyzer(Header = "Uses", Order = 10)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class MethodUsesAnalyzer : IAnalyzer { public bool Show(ISymbol symbol) => symbol is IMethod method && method.HasBody; diff --git a/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodVirtualUsedByAnalyzer.cs b/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodVirtualUsedByAnalyzer.cs index 58d70f3da..41563988d 100644 --- a/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodVirtualUsedByAnalyzer.cs +++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodVirtualUsedByAnalyzer.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.Linq; using System.Reflection.Metadata; @@ -32,7 +32,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin /// Shows entities that are used by a method. /// [ExportAnalyzer(Header = "Used By", Order = 20)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class MethodVirtualUsedByAnalyzer : IAnalyzer { const GetMemberOptions Options = GetMemberOptions.IgnoreInheritedMembers | GetMemberOptions.ReturnMemberDefinitions; diff --git a/ICSharpCode.ILSpyX/Analyzers/Builtin/PropertyImplementedByAnalyzer.cs b/ICSharpCode.ILSpyX/Analyzers/Builtin/PropertyImplementedByAnalyzer.cs index 159d0cf5f..fb26a3f5d 100644 --- a/ICSharpCode.ILSpyX/Analyzers/Builtin/PropertyImplementedByAnalyzer.cs +++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/PropertyImplementedByAnalyzer.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.Linq; @@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin /// Shows properties that implement an interface property. /// [ExportAnalyzer(Header = "Implemented By", Order = 10)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class PropertyImplementedByAnalyzer : IAnalyzer { public IEnumerable Analyze(ISymbol analyzedSymbol, AnalyzerContext context) diff --git a/ICSharpCode.ILSpyX/Analyzers/Builtin/PropertyOverriddenByAnalyzer.cs b/ICSharpCode.ILSpyX/Analyzers/Builtin/PropertyOverriddenByAnalyzer.cs index da0f9f8ac..34bbab114 100644 --- a/ICSharpCode.ILSpyX/Analyzers/Builtin/PropertyOverriddenByAnalyzer.cs +++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/PropertyOverriddenByAnalyzer.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.Linq; @@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin /// Shows properties that override a property. /// [ExportAnalyzer(Header = "Overridden By", Order = 20)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class PropertyOverriddenByAnalyzer : IAnalyzer { public IEnumerable Analyze(ISymbol analyzedSymbol, AnalyzerContext context) diff --git a/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeExposedByAnalyzer.cs b/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeExposedByAnalyzer.cs index 3a2acc8a1..882b76ec8 100644 --- a/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeExposedByAnalyzer.cs +++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeExposedByAnalyzer.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using ICSharpCode.Decompiler.TypeSystem; @@ -28,7 +28,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin /// Finds all entities that expose a type. /// [ExportAnalyzer(Header = "Exposed By", Order = 40)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class TypeExposedByAnalyzer : IAnalyzer { public bool Show(ISymbol entity) => entity is ITypeDefinition; diff --git a/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeExtensionMethodsAnalyzer.cs b/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeExtensionMethodsAnalyzer.cs index 2e28cd526..fbf8470a5 100644 --- a/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeExtensionMethodsAnalyzer.cs +++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeExtensionMethodsAnalyzer.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using ICSharpCode.Decompiler.TypeSystem; @@ -28,7 +28,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin /// Finds all extension methods defined for a type. /// [ExportAnalyzer(Header = "Extension Methods", Order = 50)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class TypeExtensionMethodsAnalyzer : IAnalyzer { public bool Show(ISymbol symbol) => symbol is ITypeDefinition entity && !entity.IsStatic; diff --git a/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeInstantiatedByAnalyzer.cs b/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeInstantiatedByAnalyzer.cs index fba95c1dd..3145e0d9f 100644 --- a/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeInstantiatedByAnalyzer.cs +++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeInstantiatedByAnalyzer.cs @@ -18,7 +18,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.Linq; using System.Reflection.Metadata; @@ -33,7 +33,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin /// Shows methods that instantiate a type. /// [ExportAnalyzer(Header = "Instantiated By", Order = 20)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class TypeInstantiatedByAnalyzer : IAnalyzer { const GetMemberOptions Options = GetMemberOptions.IgnoreInheritedMembers | GetMemberOptions.ReturnMemberDefinitions; diff --git a/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeUsedByAnalyzer.cs b/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeUsedByAnalyzer.cs index b7a8a4147..b0fc53fa2 100644 --- a/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeUsedByAnalyzer.cs +++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeUsedByAnalyzer.cs @@ -19,7 +19,7 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.Linq; using System.Reflection.Metadata; @@ -35,7 +35,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin /// Shows entities that use a type. /// [ExportAnalyzer(Header = "Used By", Order = 30)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class TypeUsedByAnalyzer : IAnalyzer { public IEnumerable Analyze(ISymbol analyzedSymbol, AnalyzerContext context) diff --git a/ICSharpCode.ILSpyX/Analyzers/ExportAnalyzerAttribute.cs b/ICSharpCode.ILSpyX/Analyzers/ExportAnalyzerAttribute.cs index 628b41bc8..563d7a05d 100644 --- a/ICSharpCode.ILSpyX/Analyzers/ExportAnalyzerAttribute.cs +++ b/ICSharpCode.ILSpyX/Analyzers/ExportAnalyzerAttribute.cs @@ -18,7 +18,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using System.Reflection; diff --git a/ICSharpCode.ILSpyX/ICSharpCode.ILSpyX.csproj b/ICSharpCode.ILSpyX/ICSharpCode.ILSpyX.csproj index 21a9363b0..6ee7581b9 100644 --- a/ICSharpCode.ILSpyX/ICSharpCode.ILSpyX.csproj +++ b/ICSharpCode.ILSpyX/ICSharpCode.ILSpyX.csproj @@ -66,10 +66,9 @@ - + - diff --git a/ILSpy.BamlDecompiler/BamlResourceNodeFactory.cs b/ILSpy.BamlDecompiler/BamlResourceNodeFactory.cs index ecb1e25d1..29c54c100 100644 --- a/ILSpy.BamlDecompiler/BamlResourceNodeFactory.cs +++ b/ILSpy.BamlDecompiler/BamlResourceNodeFactory.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.ComponentModel.Composition; +using System.Composition; using System.IO; using ICSharpCode.BamlDecompiler; @@ -32,7 +32,7 @@ using ICSharpCode.ILSpyX.Abstractions; namespace ILSpy.BamlDecompiler { [Export(typeof(IResourceNodeFactory))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] public sealed class BamlResourceNodeFactory : IResourceNodeFactory { public ITreeNode CreateNode(Resource resource) @@ -45,7 +45,7 @@ namespace ILSpy.BamlDecompiler } [Export(typeof(IResourceFileHandler))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] public sealed class BamlResourceFileHandler : IResourceFileHandler { public string EntryType => "Page"; diff --git a/ILSpy.ReadyToRun/ReadyToRunLanguage.cs b/ILSpy.ReadyToRun/ReadyToRunLanguage.cs index 6b0bff738..78e478861 100644 --- a/ILSpy.ReadyToRun/ReadyToRunLanguage.cs +++ b/ILSpy.ReadyToRun/ReadyToRunLanguage.cs @@ -20,7 +20,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.IO; using System.Linq; @@ -96,7 +96,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun #endif [Export(typeof(Language))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] internal class ReadyToRunLanguage : Language { private static readonly ConditionalWeakTable readyToRunReaders = new ConditionalWeakTable(); diff --git a/ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml.cs b/ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml.cs index d48d55ec1..59aac573f 100644 --- a/ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml.cs +++ b/ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml.cs @@ -16,18 +16,18 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using ICSharpCode.ILSpy.Options; using ICSharpCode.ILSpy.Util; using TomsToolbox.Wpf; -using TomsToolbox.Wpf.Composition.Mef; +using TomsToolbox.Wpf.Composition.AttributedModel; namespace ICSharpCode.ILSpy.ReadyToRun { [DataTemplate(typeof(ReadyToRunOptionsViewModel))] - [PartCreationPolicy(CreationPolicy.NonShared)] + [NonShared] partial class ReadyToRunOptionPage { public ReadyToRunOptionPage() @@ -37,7 +37,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun } [ExportOptionPage(Order = 40)] - [PartCreationPolicy(CreationPolicy.NonShared)] + [NonShared] class ReadyToRunOptionsViewModel : ObservableObject, IOptionPage { private ReadyToRunOptions options; diff --git a/ILSpy/AboutPage.cs b/ILSpy/AboutPage.cs index 9d462e753..5683b253d 100644 --- a/ILSpy/AboutPage.cs +++ b/ILSpy/AboutPage.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.ComponentModel.Composition; +using System.Composition; using System.IO; using System.Text.RegularExpressions; using System.Windows; @@ -37,7 +37,7 @@ using ICSharpCode.ILSpyX.Settings; namespace ICSharpCode.ILSpy { [ExportMainMenuCommand(ParentMenuID = nameof(Resources._Help), Header = nameof(Resources._About), MenuOrder = 99999)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class AboutPage : SimpleCommand { public override void Execute(object parameter) diff --git a/ILSpy/Analyzers/AnalyzeCommand.cs b/ILSpy/Analyzers/AnalyzeCommand.cs index 9a24f29b2..e29dacb23 100644 --- a/ILSpy/Analyzers/AnalyzeCommand.cs +++ b/ILSpy/Analyzers/AnalyzeCommand.cs @@ -16,7 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using ICSharpCode.Decompiler.TypeSystem; @@ -26,7 +26,7 @@ using ICSharpCode.ILSpy.TreeNodes; namespace ICSharpCode.ILSpy.Analyzers { [ExportContextMenuEntry(Header = nameof(Resources.Analyze), Icon = "Images/Search", Category = nameof(Resources.Analyze), InputGestureText = "Ctrl+R", Order = 100)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] internal sealed class AnalyzeContextMenuCommand : IContextMenuEntry { private static readonly AnalyzerTreeViewModel AnalyzerTreeView = App.ExportProvider.GetExportedValue(); diff --git a/ILSpy/Analyzers/AnalyzerTreeView.xaml.cs b/ILSpy/Analyzers/AnalyzerTreeView.xaml.cs index bff239a46..af2b186eb 100644 --- a/ILSpy/Analyzers/AnalyzerTreeView.xaml.cs +++ b/ILSpy/Analyzers/AnalyzerTreeView.xaml.cs @@ -16,12 +16,12 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Windows.Controls; using ICSharpCode.ILSpyX.TreeView; -using TomsToolbox.Wpf.Composition.Mef; +using TomsToolbox.Wpf.Composition.AttributedModel; namespace ICSharpCode.ILSpy.Analyzers { @@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpy.Analyzers /// Interaction logic for AnalyzerTreeView.xaml /// [DataTemplate(typeof(AnalyzerTreeViewModel))] - [PartCreationPolicy(CreationPolicy.NonShared)] + [NonShared] [Export] public partial class AnalyzerTreeView { diff --git a/ILSpy/Analyzers/AnalyzerTreeViewModel.cs b/ILSpy/Analyzers/AnalyzerTreeViewModel.cs index 5c666d38f..ce45558b9 100644 --- a/ILSpy/Analyzers/AnalyzerTreeViewModel.cs +++ b/ILSpy/Analyzers/AnalyzerTreeViewModel.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using System.Windows; using System.Windows.Input; @@ -32,7 +32,7 @@ using TomsToolbox.Wpf; namespace ICSharpCode.ILSpy.Analyzers { [ExportToolPane] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] [Export] public class AnalyzerTreeViewModel : ToolPaneModel { diff --git a/ILSpy/Analyzers/CopyAnalysisResultsContextMenuEntry.cs b/ILSpy/Analyzers/CopyAnalysisResultsContextMenuEntry.cs index 5d0af2d66..c75447595 100644 --- a/ILSpy/Analyzers/CopyAnalysisResultsContextMenuEntry.cs +++ b/ILSpy/Analyzers/CopyAnalysisResultsContextMenuEntry.cs @@ -16,7 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using System.Text; using System.Windows; @@ -24,7 +24,7 @@ using System.Windows; namespace ICSharpCode.ILSpy.Analyzers { [ExportContextMenuEntry(Header = "Copy results", Category = "Analyze", Order = 200)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] internal sealed class CopyAnalysisResultsContextMenuEntry : IContextMenuEntry { public bool IsVisible(TextViewContext context) diff --git a/ILSpy/Analyzers/RemoveAnalyzeContextMenuEntry.cs b/ILSpy/Analyzers/RemoveAnalyzeContextMenuEntry.cs index 662f466de..811c52fc3 100644 --- a/ILSpy/Analyzers/RemoveAnalyzeContextMenuEntry.cs +++ b/ILSpy/Analyzers/RemoveAnalyzeContextMenuEntry.cs @@ -16,13 +16,13 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; namespace ICSharpCode.ILSpy.Analyzers { [ExportContextMenuEntry(Header = "Remove", Icon = "images/Delete", Category = "Analyze", Order = 200)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] internal sealed class RemoveAnalyzeContextMenuEntry : IContextMenuEntry { public bool IsVisible(TextViewContext context) diff --git a/ILSpy/AssemblyTree/AssemblyListPane.xaml.cs b/ILSpy/AssemblyTree/AssemblyListPane.xaml.cs index 93e78a75d..af7b14a91 100644 --- a/ILSpy/AssemblyTree/AssemblyListPane.xaml.cs +++ b/ILSpy/AssemblyTree/AssemblyListPane.xaml.cs @@ -16,14 +16,14 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Windows; using System.Windows.Threading; using ICSharpCode.ILSpy.ViewModels; using ICSharpCode.ILSpyX.TreeView; -using TomsToolbox.Wpf.Composition.Mef; +using TomsToolbox.Wpf.Composition.AttributedModel; namespace ICSharpCode.ILSpy.AssemblyTree { @@ -31,7 +31,7 @@ namespace ICSharpCode.ILSpy.AssemblyTree /// Interaction logic for AssemblyListPane.xaml /// [DataTemplate(typeof(AssemblyTreeModel))] - [PartCreationPolicy(CreationPolicy.NonShared)] + [NonShared] public partial class AssemblyListPane { public AssemblyListPane() diff --git a/ILSpy/AssemblyTree/AssemblyTreeModel.cs b/ILSpy/AssemblyTree/AssemblyTreeModel.cs index 33570c34f..954310192 100644 --- a/ILSpy/AssemblyTree/AssemblyTreeModel.cs +++ b/ILSpy/AssemblyTree/AssemblyTreeModel.cs @@ -20,7 +20,7 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; using System.ComponentModel; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; @@ -55,7 +55,7 @@ using TomsToolbox.Wpf; namespace ICSharpCode.ILSpy.AssemblyTree { [ExportToolPane] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] [Export] public class AssemblyTreeModel : ToolPaneModel { diff --git a/ILSpy/Commands/BrowseBackCommand.cs b/ILSpy/Commands/BrowseBackCommand.cs index ae53e19ef..d52f4d734 100644 --- a/ILSpy/Commands/BrowseBackCommand.cs +++ b/ILSpy/Commands/BrowseBackCommand.cs @@ -16,7 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Windows.Input; using ICSharpCode.ILSpy.AssemblyTree; @@ -25,12 +25,11 @@ using ICSharpCode.ILSpy.Properties; namespace ICSharpCode.ILSpy { [ExportToolbarCommand(ToolTip = nameof(Resources.Back), ToolbarIcon = "Images/Back", ToolbarCategory = nameof(Resources.Navigation), ToolbarOrder = 0)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class BrowseBackCommand : CommandWrapper { readonly AssemblyTreeModel assemblyTreeModel; - [ImportingConstructor] public BrowseBackCommand(AssemblyTreeModel assemblyTreeModel) : base(NavigationCommands.BrowseBack) { diff --git a/ILSpy/Commands/BrowseForwardCommand.cs b/ILSpy/Commands/BrowseForwardCommand.cs index ea86ebc11..1eb264856 100644 --- a/ILSpy/Commands/BrowseForwardCommand.cs +++ b/ILSpy/Commands/BrowseForwardCommand.cs @@ -16,7 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Windows.Input; using ICSharpCode.ILSpy.AssemblyTree; @@ -25,12 +25,11 @@ using ICSharpCode.ILSpy.Properties; namespace ICSharpCode.ILSpy { [ExportToolbarCommand(ToolTip = nameof(Resources.Forward), ToolbarIcon = "Images/Forward", ToolbarCategory = nameof(Resources.Navigation), ToolbarOrder = 1)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class BrowseForwardCommand : CommandWrapper { private readonly AssemblyTreeModel assemblyTreeModel; - [ImportingConstructor] public BrowseForwardCommand(AssemblyTreeModel assemblyTreeModel) : base(NavigationCommands.BrowseForward) { diff --git a/ILSpy/Commands/CheckForUpdatesCommand.cs b/ILSpy/Commands/CheckForUpdatesCommand.cs index 779f854a1..75ab702e7 100644 --- a/ILSpy/Commands/CheckForUpdatesCommand.cs +++ b/ILSpy/Commands/CheckForUpdatesCommand.cs @@ -17,14 +17,14 @@ // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using ICSharpCode.ILSpy.Properties; namespace ICSharpCode.ILSpy { [ExportMainMenuCommand(ParentMenuID = nameof(Resources._Help), Header = nameof(Resources._CheckUpdates), MenuOrder = 5000)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class CheckForUpdatesCommand : SimpleCommand { public override bool CanExecute(object parameter) diff --git a/ILSpy/Commands/CopyFullyQualifiedNameContextMenuEntry.cs b/ILSpy/Commands/CopyFullyQualifiedNameContextMenuEntry.cs index 47490e37b..5cb06a1ea 100644 --- a/ILSpy/Commands/CopyFullyQualifiedNameContextMenuEntry.cs +++ b/ILSpy/Commands/CopyFullyQualifiedNameContextMenuEntry.cs @@ -15,7 +15,7 @@ // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Windows; using ICSharpCode.ILSpy.Properties; @@ -24,7 +24,7 @@ using ICSharpCode.ILSpy.TreeNodes; namespace ICSharpCode.ILSpy { [ExportContextMenuEntry(Header = nameof(Resources.CopyName), Icon = "images/Copy", Order = 9999)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] public class CopyFullyQualifiedNameContextMenuEntry : IContextMenuEntry { public bool IsVisible(TextViewContext context) diff --git a/ILSpy/Commands/DecompileAllCommand.cs b/ILSpy/Commands/DecompileAllCommand.cs index d719fa3c4..72aae604c 100644 --- a/ILSpy/Commands/DecompileAllCommand.cs +++ b/ILSpy/Commands/DecompileAllCommand.cs @@ -21,7 +21,7 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; @@ -35,13 +35,12 @@ using ICSharpCode.ILSpyX; namespace ICSharpCode.ILSpy { [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.DEBUGDecompile), MenuCategory = nameof(Resources.Open), MenuOrder = 2.5)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class DecompileAllCommand : SimpleCommand { private readonly IReadOnlyCollection resourceFileHandlers; - [ImportingConstructor] - public DecompileAllCommand([ImportMany] IEnumerable resourceFileHandlers) + public DecompileAllCommand(IEnumerable resourceFileHandlers) { this.resourceFileHandlers = resourceFileHandlers.ToArray(); } @@ -96,7 +95,7 @@ namespace ICSharpCode.ILSpy } [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.DEBUGDecompile100x), MenuCategory = nameof(Resources.Open), MenuOrder = 2.6)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class Decompile100TimesCommand : SimpleCommand { public override void Execute(object parameter) diff --git a/ILSpy/Commands/DecompileCommand.cs b/ILSpy/Commands/DecompileCommand.cs index ec35a0cbe..13e8d429c 100644 --- a/ILSpy/Commands/DecompileCommand.cs +++ b/ILSpy/Commands/DecompileCommand.cs @@ -16,7 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using ICSharpCode.Decompiler.TypeSystem; @@ -26,7 +26,7 @@ using ICSharpCode.ILSpy.TreeNodes; namespace ICSharpCode.ILSpy.Commands { [ExportContextMenuEntry(Header = nameof(Resources.Decompile), Order = 10)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class DecompileCommand : IContextMenuEntry { public bool IsVisible(TextViewContext context) diff --git a/ILSpy/Commands/DecompileInNewViewCommand.cs b/ILSpy/Commands/DecompileInNewViewCommand.cs index 40df5145a..107a11b46 100644 --- a/ILSpy/Commands/DecompileInNewViewCommand.cs +++ b/ILSpy/Commands/DecompileInNewViewCommand.cs @@ -18,7 +18,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using System.Windows.Threading; @@ -34,12 +34,11 @@ using TomsToolbox.Essentials; namespace ICSharpCode.ILSpy.Commands { [ExportContextMenuEntry(Header = nameof(Resources.DecompileToNewPanel), InputGestureText = "MMB", Icon = "images/Search", Category = nameof(Resources.Analyze), Order = 90)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] internal sealed class DecompileInNewViewCommand : IContextMenuEntry { private readonly AssemblyTreeModel assemblyTreeModel; - [ImportingConstructor] public DecompileInNewViewCommand(AssemblyTreeModel assemblyTreeModel) { this.assemblyTreeModel = assemblyTreeModel; diff --git a/ILSpy/Commands/DisassembleAllCommand.cs b/ILSpy/Commands/DisassembleAllCommand.cs index 5ef572ee8..fea58925d 100644 --- a/ILSpy/Commands/DisassembleAllCommand.cs +++ b/ILSpy/Commands/DisassembleAllCommand.cs @@ -20,7 +20,7 @@ using System; using System.Collections.Concurrent; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.Threading.Tasks; @@ -30,7 +30,7 @@ using ICSharpCode.ILSpy.TextView; namespace ICSharpCode.ILSpy { [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.DEBUGDisassemble), MenuCategory = nameof(Resources.Open), MenuOrder = 2.5)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class DisassembleAllCommand : SimpleCommand { public override bool CanExecute(object parameter) diff --git a/ILSpy/Commands/ExitCommand.cs b/ILSpy/Commands/ExitCommand.cs index fb475ef01..1ba8a34e1 100644 --- a/ILSpy/Commands/ExitCommand.cs +++ b/ILSpy/Commands/ExitCommand.cs @@ -15,14 +15,14 @@ // FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using ICSharpCode.ILSpy.Properties; namespace ICSharpCode.ILSpy { [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.E_xit), MenuOrder = 99999, MenuCategory = nameof(Resources.Exit))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class ExitCommand : SimpleCommand { public override void Execute(object parameter) diff --git a/ILSpy/Commands/ExportCommandAttribute.cs b/ILSpy/Commands/ExportCommandAttribute.cs index 19d100fd4..f368807f5 100644 --- a/ILSpy/Commands/ExportCommandAttribute.cs +++ b/ILSpy/Commands/ExportCommandAttribute.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.ComponentModel.Composition; +using System.Composition; using System.Windows.Input; namespace ICSharpCode.ILSpy diff --git a/ILSpy/Commands/ExtractPackageEntryContextMenuEntry.cs b/ILSpy/Commands/ExtractPackageEntryContextMenuEntry.cs index 3f22fa1cd..2d558aca4 100644 --- a/ILSpy/Commands/ExtractPackageEntryContextMenuEntry.cs +++ b/ILSpy/Commands/ExtractPackageEntryContextMenuEntry.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.IO; using System.Linq; @@ -35,7 +35,7 @@ using Microsoft.Win32; namespace ICSharpCode.ILSpy { [ExportContextMenuEntry(Header = nameof(Resources.ExtractPackageEntry), Category = nameof(Resources.Save), Icon = "Images/Save")] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class ExtractPackageEntryContextMenuEntry : IContextMenuEntry { public void Execute(TextViewContext context) diff --git a/ILSpy/Commands/GeneratePdbContextMenuEntry.cs b/ILSpy/Commands/GeneratePdbContextMenuEntry.cs index f410e8ada..d31a3160c 100644 --- a/ILSpy/Commands/GeneratePdbContextMenuEntry.cs +++ b/ILSpy/Commands/GeneratePdbContextMenuEntry.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.IO; using System.Linq; @@ -40,7 +40,7 @@ using Microsoft.Win32; namespace ICSharpCode.ILSpy { [ExportContextMenuEntry(Header = nameof(Resources.GeneratePortable))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class GeneratePdbContextMenuEntry : IContextMenuEntry { public void Execute(TextViewContext context) @@ -107,7 +107,7 @@ namespace ICSharpCode.ILSpy } [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.GeneratePortable), MenuCategory = nameof(Resources.Save))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class GeneratePdbMainMenuEntry : SimpleCommand { public override bool CanExecute(object parameter) diff --git a/ILSpy/Commands/ManageAssemblyListsCommand.cs b/ILSpy/Commands/ManageAssemblyListsCommand.cs index 0f2240e14..63ab2f037 100644 --- a/ILSpy/Commands/ManageAssemblyListsCommand.cs +++ b/ILSpy/Commands/ManageAssemblyListsCommand.cs @@ -17,14 +17,14 @@ // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using ICSharpCode.ILSpy.Properties; namespace ICSharpCode.ILSpy { [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.ManageAssembly_Lists), MenuIcon = "Images/AssemblyList", MenuCategory = nameof(Resources.Open), MenuOrder = 1.7)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class ManageAssemblyListsCommand : SimpleCommand { public override void Execute(object parameter) diff --git a/ILSpy/Commands/OpenCommand.cs b/ILSpy/Commands/OpenCommand.cs index 06ac419e9..2ea160889 100644 --- a/ILSpy/Commands/OpenCommand.cs +++ b/ILSpy/Commands/OpenCommand.cs @@ -16,7 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Windows.Input; using ICSharpCode.ILSpy.AssemblyTree; @@ -28,12 +28,11 @@ namespace ICSharpCode.ILSpy { [ExportToolbarCommand(ToolTip = nameof(Resources.Open), ToolbarIcon = "Images/Open", ToolbarCategory = nameof(Resources.Open), ToolbarOrder = 0)] [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources._Open), MenuIcon = "Images/Open", MenuCategory = nameof(Resources.Open), MenuOrder = 0)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class OpenCommand : CommandWrapper { private readonly AssemblyTreeModel assemblyTreeModel; - [ImportingConstructor] public OpenCommand(AssemblyTreeModel assemblyTreeModel) : base(ApplicationCommands.Open) { diff --git a/ILSpy/Commands/OpenFromGacCommand.cs b/ILSpy/Commands/OpenFromGacCommand.cs index 9d1c31214..c7fd898d0 100644 --- a/ILSpy/Commands/OpenFromGacCommand.cs +++ b/ILSpy/Commands/OpenFromGacCommand.cs @@ -16,7 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using ICSharpCode.ILSpy.AppEnv; using ICSharpCode.ILSpy.AssemblyTree; @@ -25,12 +25,11 @@ using ICSharpCode.ILSpy.Properties; namespace ICSharpCode.ILSpy { [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.OpenFrom_GAC), MenuIcon = "Images/AssemblyListGAC", MenuCategory = nameof(Resources.Open), MenuOrder = 1)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class OpenFromGacCommand : SimpleCommand { private readonly AssemblyTreeModel assemblyTreeModel; - [ImportingConstructor] public OpenFromGacCommand(AssemblyTreeModel assemblyTreeModel) { this.assemblyTreeModel = assemblyTreeModel; diff --git a/ILSpy/Commands/Pdb2XmlCommand.cs b/ILSpy/Commands/Pdb2XmlCommand.cs index b624124cb..d4b9a7fae 100644 --- a/ILSpy/Commands/Pdb2XmlCommand.cs +++ b/ILSpy/Commands/Pdb2XmlCommand.cs @@ -19,7 +19,7 @@ #if DEBUG using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -35,7 +35,7 @@ using Microsoft.DiaSymReader.Tools; namespace ICSharpCode.ILSpy { [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.DEBUGDumpPDBAsXML), MenuCategory = nameof(Resources.Open), MenuOrder = 2.6)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class Pdb2XmlCommand : SimpleCommand { public override bool CanExecute(object parameter) @@ -72,7 +72,7 @@ namespace ICSharpCode.ILSpy } [ExportContextMenuEntry(Header = nameof(Resources.DEBUGDumpPDBAsXML))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class Pdb2XmlCommandContextMenuEntry : IContextMenuEntry { public void Execute(TextViewContext context) diff --git a/ILSpy/Commands/RefreshCommand.cs b/ILSpy/Commands/RefreshCommand.cs index e01e70f0e..d82ac11ab 100644 --- a/ILSpy/Commands/RefreshCommand.cs +++ b/ILSpy/Commands/RefreshCommand.cs @@ -16,7 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Windows.Input; using ICSharpCode.ILSpy.AssemblyTree; @@ -26,12 +26,11 @@ namespace ICSharpCode.ILSpy { [ExportToolbarCommand(ToolTip = nameof(Resources.RefreshCommand_ReloadAssemblies), ToolbarIcon = "Images/Refresh", ToolbarCategory = nameof(Resources.Open), ToolbarOrder = 2)] [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources._Reload), MenuIcon = "Images/Refresh", MenuCategory = nameof(Resources.Open), MenuOrder = 2)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class RefreshCommand : CommandWrapper { private readonly AssemblyTreeModel assemblyTreeModel; - [ImportingConstructor] public RefreshCommand(AssemblyTreeModel assemblyTreeModel) : base(NavigationCommands.Refresh) { diff --git a/ILSpy/Commands/RemoveAssembliesWithLoadErrors.cs b/ILSpy/Commands/RemoveAssembliesWithLoadErrors.cs index b0bc068c8..42673e99a 100644 --- a/ILSpy/Commands/RemoveAssembliesWithLoadErrors.cs +++ b/ILSpy/Commands/RemoveAssembliesWithLoadErrors.cs @@ -16,7 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using ICSharpCode.ILSpy.AssemblyTree; @@ -25,12 +25,11 @@ using ICSharpCode.ILSpy.Properties; namespace ICSharpCode.ILSpy { [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources._RemoveAssembliesWithLoadErrors), MenuCategory = nameof(Resources.Remove), MenuOrder = 2.6)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class RemoveAssembliesWithLoadErrors : SimpleCommand { private readonly AssemblyTreeModel assemblyTreeModel; - [ImportingConstructor] public RemoveAssembliesWithLoadErrors(AssemblyTreeModel assemblyTreeModel) { this.assemblyTreeModel = assemblyTreeModel; @@ -55,12 +54,11 @@ namespace ICSharpCode.ILSpy } [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.ClearAssemblyList), MenuCategory = nameof(Resources.Remove), MenuOrder = 2.6)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class ClearAssemblyList : SimpleCommand { private readonly AssemblyTreeModel assemblyTreeModel; - [ImportingConstructor] public ClearAssemblyList(AssemblyTreeModel assemblyTreeModel) { this.assemblyTreeModel = assemblyTreeModel; diff --git a/ILSpy/Commands/SaveCodeContextMenuEntry.cs b/ILSpy/Commands/SaveCodeContextMenuEntry.cs index c931ffe00..14f9fdf50 100644 --- a/ILSpy/Commands/SaveCodeContextMenuEntry.cs +++ b/ILSpy/Commands/SaveCodeContextMenuEntry.cs @@ -18,7 +18,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.IO; using System.Linq; using System.Windows; @@ -34,7 +34,7 @@ using Microsoft.Win32; namespace ICSharpCode.ILSpy.TextView { [ExportContextMenuEntry(Header = nameof(Resources._SaveCode), Category = nameof(Resources.Save), Icon = "Images/Save")] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class SaveCodeContextMenuEntry : IContextMenuEntry { public void Execute(TextViewContext context) diff --git a/ILSpy/Commands/SaveCommand.cs b/ILSpy/Commands/SaveCommand.cs index 9e43df69b..3b1927e21 100644 --- a/ILSpy/Commands/SaveCommand.cs +++ b/ILSpy/Commands/SaveCommand.cs @@ -16,7 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using System.Windows.Input; @@ -27,12 +27,11 @@ using ICSharpCode.ILSpy.TextView; namespace ICSharpCode.ILSpy { [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources._SaveCode), MenuIcon = "Images/Save", MenuCategory = nameof(Resources.Save), MenuOrder = 0)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class SaveCommand : CommandWrapper { private AssemblyTreeModel assemblyTreeModel; - [ImportingConstructor] public SaveCommand(AssemblyTreeModel assemblyTreeModel) : base(ApplicationCommands.Save) { diff --git a/ILSpy/Commands/ScopeSearchToAssembly.cs b/ILSpy/Commands/ScopeSearchToAssembly.cs index 27f3c79f4..e1a42dd87 100644 --- a/ILSpy/Commands/ScopeSearchToAssembly.cs +++ b/ILSpy/Commands/ScopeSearchToAssembly.cs @@ -18,7 +18,7 @@ #nullable enable using System; -using System.ComponentModel.Composition; +using System.Composition; using ICSharpCode.Decompiler.TypeSystem; using ICSharpCode.ILSpy.AppEnv; @@ -29,12 +29,11 @@ using ICSharpCode.ILSpy.TreeNodes; namespace ICSharpCode.ILSpy { [ExportContextMenuEntry(Header = nameof(Resources.ScopeSearchToThisAssembly), Category = nameof(Resources.Analyze), Order = 9999)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] public class ScopeSearchToAssembly : IContextMenuEntry { private readonly SearchPaneModel searchPane; - [ImportingConstructor] public ScopeSearchToAssembly(SearchPaneModel searchPane) { this.searchPane = searchPane; diff --git a/ILSpy/Commands/ScopeSearchToNamespace.cs b/ILSpy/Commands/ScopeSearchToNamespace.cs index 645f9d425..31dec0349 100644 --- a/ILSpy/Commands/ScopeSearchToNamespace.cs +++ b/ILSpy/Commands/ScopeSearchToNamespace.cs @@ -16,7 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. using System; -using System.ComponentModel.Composition; +using System.Composition; using ICSharpCode.Decompiler.TypeSystem; using ICSharpCode.ILSpy.AppEnv; @@ -27,12 +27,11 @@ using ICSharpCode.ILSpy.TreeNodes; namespace ICSharpCode.ILSpy { [ExportContextMenuEntry(Header = nameof(Resources.ScopeSearchToThisNamespace), Category = nameof(Resources.Analyze), Order = 9999)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] public class ScopeSearchToNamespace : IContextMenuEntry { private readonly SearchPaneModel searchPane; - [ImportingConstructor] public ScopeSearchToNamespace(SearchPaneModel searchPane) { this.searchPane = searchPane; diff --git a/ILSpy/Commands/SearchMsdnContextMenuEntry.cs b/ILSpy/Commands/SearchMsdnContextMenuEntry.cs index a49f1c456..3dfa67032 100644 --- a/ILSpy/Commands/SearchMsdnContextMenuEntry.cs +++ b/ILSpy/Commands/SearchMsdnContextMenuEntry.cs @@ -23,12 +23,12 @@ using ICSharpCode.ILSpy.Properties; using ICSharpCode.ILSpy.TreeNodes; namespace ICSharpCode.ILSpy { - using System.ComponentModel.Composition; + using System.Composition; using ICSharpCode.Decompiler.TypeSystem; [ExportContextMenuEntry(Header = nameof(Resources.SearchMSDN), Icon = "images/SearchMsdn", Order = 9999)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] internal sealed class SearchMsdnContextMenuEntry : IContextMenuEntry { private static string msdnAddress = "https://docs.microsoft.com/dotnet/api/{0}"; diff --git a/ILSpy/Commands/SelectPdbContextMenuEntry.cs b/ILSpy/Commands/SelectPdbContextMenuEntry.cs index db4fa7373..e64ec3881 100644 --- a/ILSpy/Commands/SelectPdbContextMenuEntry.cs +++ b/ILSpy/Commands/SelectPdbContextMenuEntry.cs @@ -16,7 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.IO; using System.Linq; @@ -28,7 +28,7 @@ using Microsoft.Win32; namespace ICSharpCode.ILSpy { [ExportContextMenuEntry(Header = nameof(Resources.SelectPDB))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class SelectPdbContextMenuEntry : IContextMenuEntry { public async void Execute(TextViewContext context) diff --git a/ILSpy/Commands/ShowCFGContextMenuEntry.cs b/ILSpy/Commands/ShowCFGContextMenuEntry.cs index 2067752cc..92d21c5cc 100644 --- a/ILSpy/Commands/ShowCFGContextMenuEntry.cs +++ b/ILSpy/Commands/ShowCFGContextMenuEntry.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Windows; using ICSharpCode.Decompiler.FlowAnalysis; @@ -11,7 +11,7 @@ namespace ICSharpCode.ILSpy.Commands { #if DEBUG [ExportContextMenuEntry(Header = "DEBUG -- Show CFG")] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] internal class ShowCFGContextMenuEntry : IContextMenuEntry { public void Execute(TextViewContext context) diff --git a/ILSpy/Commands/SortAssemblyListCommand.cs b/ILSpy/Commands/SortAssemblyListCommand.cs index 5b7dc67e1..f3a55682d 100644 --- a/ILSpy/Commands/SortAssemblyListCommand.cs +++ b/ILSpy/Commands/SortAssemblyListCommand.cs @@ -18,7 +18,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using ICSharpCode.ILSpy.Properties; using ICSharpCode.ILSpyX; @@ -28,7 +28,7 @@ namespace ICSharpCode.ILSpy { [ExportMainMenuCommand(ParentMenuID = nameof(Resources._View), Header = nameof(Resources.SortAssembly_listName), MenuIcon = "Images/Sort", MenuCategory = nameof(Resources.View))] [ExportToolbarCommand(ToolTip = nameof(Resources.SortAssemblyListName), ToolbarIcon = "Images/Sort", ToolbarCategory = nameof(Resources.View))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class SortAssemblyListCommand : SimpleCommand { public override void Execute(object parameter) @@ -39,7 +39,7 @@ namespace ICSharpCode.ILSpy [ExportMainMenuCommand(ParentMenuID = nameof(Resources._View), Header = nameof(Resources._CollapseTreeNodes), MenuIcon = "Images/CollapseAll", MenuCategory = nameof(Resources.View))] [ExportToolbarCommand(ToolTip = nameof(Resources.CollapseTreeNodes), ToolbarIcon = "Images/CollapseAll", ToolbarCategory = nameof(Resources.View))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class CollapseAllCommand : SimpleCommand { public override void Execute(object parameter) diff --git a/ILSpy/ContextMenuEntry.cs b/ILSpy/ContextMenuEntry.cs index 4da82c40d..5d80ca5f1 100644 --- a/ILSpy/ContextMenuEntry.cs +++ b/ILSpy/ContextMenuEntry.cs @@ -18,7 +18,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using System.Windows; using System.Windows.Controls; diff --git a/ILSpy/Docking/CloseAllDocumentsCommand.cs b/ILSpy/Docking/CloseAllDocumentsCommand.cs index 14169498f..c41f59943 100644 --- a/ILSpy/Docking/CloseAllDocumentsCommand.cs +++ b/ILSpy/Docking/CloseAllDocumentsCommand.cs @@ -1,11 +1,11 @@ -using System.ComponentModel.Composition; +using System.Composition; using ICSharpCode.ILSpy.Properties; namespace ICSharpCode.ILSpy.Docking { [ExportMainMenuCommand(Header = nameof(Resources.Window_CloseAllDocuments), ParentMenuID = nameof(Resources._Window))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class CloseAllDocumentsCommand : SimpleCommand { public override void Execute(object parameter) @@ -15,7 +15,7 @@ namespace ICSharpCode.ILSpy.Docking } [ExportMainMenuCommand(Header = nameof(Resources.Window_ResetLayout), ParentMenuID = nameof(Resources._Window))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class ResetLayoutCommand : SimpleCommand { public override void Execute(object parameter) diff --git a/ILSpy/ILSpy.csproj b/ILSpy/ILSpy.csproj index 5908e748d..6bd46530f 100644 --- a/ILSpy/ILSpy.csproj +++ b/ILSpy/ILSpy.csproj @@ -50,8 +50,7 @@ - - + diff --git a/ILSpy/Languages/CSharpILMixedLanguage.cs b/ILSpy/Languages/CSharpILMixedLanguage.cs index 4d3436d23..93752eaef 100644 --- a/ILSpy/Languages/CSharpILMixedLanguage.cs +++ b/ILSpy/Languages/CSharpILMixedLanguage.cs @@ -18,7 +18,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.IO; using System.Linq; @@ -42,7 +42,7 @@ namespace ICSharpCode.ILSpy using SequencePoint = ICSharpCode.Decompiler.DebugInfo.SequencePoint; [Export(typeof(Language))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class CSharpILMixedLanguage : ILLanguage { public override string Name => "IL with C#"; diff --git a/ILSpy/Languages/CSharpLanguage.cs b/ILSpy/Languages/CSharpLanguage.cs index 4607877b3..5725e0555 100644 --- a/ILSpy/Languages/CSharpLanguage.cs +++ b/ILSpy/Languages/CSharpLanguage.cs @@ -18,7 +18,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.IO; using System.Linq; using System.Reflection; @@ -52,7 +52,7 @@ namespace ICSharpCode.ILSpy /// please directly use the CSharpDecompiler class. /// [Export(typeof(Language))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] public class CSharpLanguage : Language { readonly IReadOnlyCollection resourceFileHandlers; @@ -61,8 +61,7 @@ namespace ICSharpCode.ILSpy bool showAllMembers = false; int transformCount = int.MaxValue; - [ImportingConstructor] - public CSharpLanguage([ImportMany] IEnumerable resourceFileHandlers) + public CSharpLanguage(IEnumerable resourceFileHandlers) { this.resourceFileHandlers = resourceFileHandlers.ToArray(); } diff --git a/ILSpy/Languages/ILLanguage.cs b/ILSpy/Languages/ILLanguage.cs index 5bd8ee4e4..a857268f1 100644 --- a/ILSpy/Languages/ILLanguage.cs +++ b/ILSpy/Languages/ILLanguage.cs @@ -18,7 +18,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using System.Reflection.Metadata; @@ -43,7 +43,7 @@ namespace ICSharpCode.ILSpy /// flat IL (detectControlStructure=false) and structured IL (detectControlStructure=true). /// [Export(typeof(Language))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] public class ILLanguage : Language { protected bool detectControlStructure = true; diff --git a/ILSpy/Metadata/GoToTokenCommand.cs b/ILSpy/Metadata/GoToTokenCommand.cs index 164f9b451..7a1cc3681 100644 --- a/ILSpy/Metadata/GoToTokenCommand.cs +++ b/ILSpy/Metadata/GoToTokenCommand.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using System.Reflection; using System.Reflection.Metadata.Ecma335; @@ -33,7 +33,7 @@ using TomsToolbox.Wpf; namespace ICSharpCode.ILSpy.Commands { [ExportContextMenuEntry(Header = nameof(Resources.GoToToken), Order = 10)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class GoToTokenCommand : IContextMenuEntry { public void Execute(TextViewContext context) @@ -71,7 +71,7 @@ namespace ICSharpCode.ILSpy.Commands } [ExportContextMenuEntry(Header = nameof(Resources.Copy), Order = 10)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class CopyCommand : IContextMenuEntry { public void Execute(TextViewContext context) diff --git a/ILSpy/Metadata/MetadataProtocolHandler.cs b/ILSpy/Metadata/MetadataProtocolHandler.cs index 8a50cac36..c3ffae68e 100644 --- a/ILSpy/Metadata/MetadataProtocolHandler.cs +++ b/ILSpy/Metadata/MetadataProtocolHandler.cs @@ -16,7 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using System.Reflection.Metadata; @@ -26,7 +26,7 @@ using ICSharpCode.ILSpy.TreeNodes; namespace ICSharpCode.ILSpy.Metadata { [Export(typeof(IProtocolHandler))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] class MetadataProtocolHandler : IProtocolHandler { public ILSpyTreeNode Resolve(string protocol, MetadataFile module, Handle handle, out bool newTabPage) diff --git a/ILSpy/Options/DecompilerSettingsPanel.xaml.cs b/ILSpy/Options/DecompilerSettingsPanel.xaml.cs index e65f72087..f6266559c 100644 --- a/ILSpy/Options/DecompilerSettingsPanel.xaml.cs +++ b/ILSpy/Options/DecompilerSettingsPanel.xaml.cs @@ -16,12 +16,12 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Xml.Linq; using ICSharpCode.ILSpyX.Settings; -using TomsToolbox.Wpf.Composition.Mef; +using TomsToolbox.Wpf.Composition.AttributedModel; namespace ICSharpCode.ILSpy.Options { @@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpy.Options /// Interaction logic for DecompilerSettingsPanel.xaml /// [DataTemplate(typeof(DecompilerSettingsViewModel))] - [PartCreationPolicy(CreationPolicy.NonShared)] + [NonShared] internal partial class DecompilerSettingsPanel { public DecompilerSettingsPanel() diff --git a/ILSpy/Options/DecompilerSettingsViewModel.cs b/ILSpy/Options/DecompilerSettingsViewModel.cs index 27cc520de..a01fa1587 100644 --- a/ILSpy/Options/DecompilerSettingsViewModel.cs +++ b/ILSpy/Options/DecompilerSettingsViewModel.cs @@ -18,7 +18,7 @@ using System.Collections.Generic; using System.ComponentModel; -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using System.Reflection; @@ -30,7 +30,7 @@ using TomsToolbox.Wpf; namespace ICSharpCode.ILSpy.Options { [ExportOptionPage(Order = 10)] - [PartCreationPolicy(CreationPolicy.NonShared)] + [NonShared] public sealed class DecompilerSettingsViewModel : ObservableObjectBase, IOptionPage { private static readonly PropertyInfo[] propertyInfos = typeof(Decompiler.DecompilerSettings).GetProperties() diff --git a/ILSpy/Options/DisplaySettingsPanel.xaml.cs b/ILSpy/Options/DisplaySettingsPanel.xaml.cs index 3b51a16ba..fdedbe557 100644 --- a/ILSpy/Options/DisplaySettingsPanel.xaml.cs +++ b/ILSpy/Options/DisplaySettingsPanel.xaml.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using System.Threading.Tasks; using System.Windows; @@ -29,7 +29,7 @@ using System.Xml.Linq; using ICSharpCode.ILSpyX.Settings; -using TomsToolbox.Wpf.Composition.Mef; +using TomsToolbox.Wpf.Composition.AttributedModel; using TomsToolbox.Wpf.Converters; namespace ICSharpCode.ILSpy.Options @@ -37,7 +37,7 @@ namespace ICSharpCode.ILSpy.Options /// /// Interaction logic for DisplaySettingsPanel.xaml /// - [PartCreationPolicy(CreationPolicy.NonShared)] + [NonShared] [DataTemplate(typeof(DisplaySettingsViewModel))] public partial class DisplaySettingsPanel { diff --git a/ILSpy/Options/DisplaySettingsViewModel.cs b/ILSpy/Options/DisplaySettingsViewModel.cs index 4d7c53f43..ad3361e51 100644 --- a/ILSpy/Options/DisplaySettingsViewModel.cs +++ b/ILSpy/Options/DisplaySettingsViewModel.cs @@ -2,7 +2,7 @@ using System.Windows.Media; using System.Xml.Linq; using System; -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using System.Threading.Tasks; using System.Windows; @@ -13,7 +13,7 @@ using ICSharpCode.ILSpy.Themes; namespace ICSharpCode.ILSpy.Options { [ExportOptionPage(Order = 20)] - [PartCreationPolicy(CreationPolicy.NonShared)] + [NonShared] public class DisplaySettingsViewModel : ObservableObject, IOptionPage { private DisplaySettings settings = new(); diff --git a/ILSpy/Options/MiscSettingsPanel.xaml.cs b/ILSpy/Options/MiscSettingsPanel.xaml.cs index d6c7c672d..504fef89b 100644 --- a/ILSpy/Options/MiscSettingsPanel.xaml.cs +++ b/ILSpy/Options/MiscSettingsPanel.xaml.cs @@ -16,11 +16,11 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Windows.Controls; using System.Xml.Linq; -using TomsToolbox.Wpf.Composition.Mef; +using TomsToolbox.Wpf.Composition.AttributedModel; namespace ICSharpCode.ILSpy.Options { @@ -28,7 +28,7 @@ namespace ICSharpCode.ILSpy.Options /// Interaction logic for MiscSettingsPanel.xaml /// [DataTemplate(typeof(MiscSettingsViewModel))] - [PartCreationPolicy(CreationPolicy.NonShared)] + [NonShared] public partial class MiscSettingsPanel { public MiscSettingsPanel() diff --git a/ILSpy/Options/MiscSettingsViewModel.cs b/ILSpy/Options/MiscSettingsViewModel.cs index 2ed4b9868..b3e55f816 100644 --- a/ILSpy/Options/MiscSettingsViewModel.cs +++ b/ILSpy/Options/MiscSettingsViewModel.cs @@ -16,7 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.IO; using System.Reflection; using System.Windows; @@ -33,7 +33,7 @@ using TomsToolbox.Wpf; namespace ICSharpCode.ILSpy.Options { [ExportOptionPage(Order = 30)] - [PartCreationPolicy(CreationPolicy.NonShared)] + [NonShared] public class MiscSettingsViewModel : ObservableObject, IOptionPage { private MiscSettings settings; diff --git a/ILSpy/Options/OptionsDialog.xaml.cs b/ILSpy/Options/OptionsDialog.xaml.cs index 783488175..1e56f8683 100644 --- a/ILSpy/Options/OptionsDialog.xaml.cs +++ b/ILSpy/Options/OptionsDialog.xaml.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.ComponentModel.Composition; +using System.Composition; using ICSharpCode.ILSpy.AssemblyTree; using ICSharpCode.ILSpy.Properties; @@ -58,12 +58,11 @@ namespace ICSharpCode.ILSpy.Options } [ExportMainMenuCommand(ParentMenuID = nameof(Resources._View), Header = nameof(Resources._Options), MenuCategory = nameof(Resources.Options), MenuOrder = 999)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class ShowOptionsCommand : SimpleCommand { private readonly AssemblyTreeModel assemblyTreeModel; - [ImportingConstructor] public ShowOptionsCommand(AssemblyTreeModel assemblyTreeModel) { this.assemblyTreeModel = assemblyTreeModel; diff --git a/ILSpy/Search/SearchPane.xaml.cs b/ILSpy/Search/SearchPane.xaml.cs index 4c21ac145..2702dac2f 100644 --- a/ILSpy/Search/SearchPane.xaml.cs +++ b/ILSpy/Search/SearchPane.xaml.cs @@ -21,7 +21,7 @@ using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.Text.RegularExpressions; using System.Threading; @@ -41,7 +41,7 @@ using ICSharpCode.ILSpyX.Search; using TomsToolbox.Essentials; using TomsToolbox.Wpf; -using TomsToolbox.Wpf.Composition.Mef; +using TomsToolbox.Wpf.Composition.AttributedModel; namespace ICSharpCode.ILSpy.Search { @@ -49,7 +49,7 @@ namespace ICSharpCode.ILSpy.Search /// Search pane /// [DataTemplate(typeof(SearchPaneModel))] - [PartCreationPolicy(CreationPolicy.NonShared)] + [NonShared] public partial class SearchPane { const int MAX_RESULTS = 1000; @@ -535,7 +535,7 @@ namespace ICSharpCode.ILSpy.Search } [ExportToolbarCommand(ToolTip = nameof(Properties.Resources.SearchCtrlShiftFOrCtrlE), ToolbarIcon = "Images/Search", ToolbarCategory = nameof(Properties.Resources.View), ToolbarOrder = 100)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class ShowSearchCommand : CommandWrapper { public ShowSearchCommand() diff --git a/ILSpy/Search/SearchPaneModel.cs b/ILSpy/Search/SearchPaneModel.cs index b3bc30c40..d598c0359 100644 --- a/ILSpy/Search/SearchPaneModel.cs +++ b/ILSpy/Search/SearchPaneModel.cs @@ -16,7 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Windows.Input; using System.Windows.Media; @@ -33,7 +33,7 @@ namespace ICSharpCode.ILSpy.Search } [ExportToolPane] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] [Export] public class SearchPaneModel : ToolPaneModel { diff --git a/ILSpy/TextView/EditorCommands.cs b/ILSpy/TextView/EditorCommands.cs index 0f6b5e646..2e32d019f 100644 --- a/ILSpy/TextView/EditorCommands.cs +++ b/ILSpy/TextView/EditorCommands.cs @@ -16,14 +16,14 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using ICSharpCode.ILSpy.Properties; namespace ICSharpCode.ILSpy.TextView { [ExportContextMenuEntry(Header = nameof(Resources.Copy), Category = nameof(Resources.Editor))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class CopyContextMenuEntry : IContextMenuEntry { public bool IsVisible(TextViewContext context) @@ -43,7 +43,7 @@ namespace ICSharpCode.ILSpy.TextView } [ExportContextMenuEntry(Header = nameof(Resources.Select), Category = nameof(Resources.Editor))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class SelectAllContextMenuEntry : IContextMenuEntry { public bool IsVisible(TextViewContext context) diff --git a/ILSpy/TextView/FoldingCommands.cs b/ILSpy/TextView/FoldingCommands.cs index c061c543e..fd2566381 100644 --- a/ILSpy/TextView/FoldingCommands.cs +++ b/ILSpy/TextView/FoldingCommands.cs @@ -16,7 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using ICSharpCode.AvalonEdit; @@ -26,7 +26,7 @@ using ICSharpCode.ILSpy.Properties; namespace ICSharpCode.ILSpy.TextView { [ExportContextMenuEntryAttribute(Header = nameof(Resources.ToggleFolding), Category = nameof(Resources.Folding))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] internal sealed class ToggleAllContextMenuEntry : IContextMenuEntry { public bool IsVisible(TextViewContext context) @@ -63,7 +63,7 @@ namespace ICSharpCode.ILSpy.TextView } [ExportContextMenuEntryAttribute(Header = nameof(Resources._ToggleFolding), Category = nameof(Resources.Folding))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] internal sealed class ToggleContextMenuEntry : IContextMenuEntry { public bool IsVisible(TextViewContext context) diff --git a/ILSpy/TreeNodes/AssemblyTreeNode.cs b/ILSpy/TreeNodes/AssemblyTreeNode.cs index b822a9ced..ac1187d36 100644 --- a/ILSpy/TreeNodes/AssemblyTreeNode.cs +++ b/ILSpy/TreeNodes/AssemblyTreeNode.cs @@ -18,7 +18,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -580,7 +580,7 @@ namespace ICSharpCode.ILSpy.TreeNodes } [ExportContextMenuEntry(Header = nameof(Resources._Remove), Icon = "images/Delete")] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class RemoveAssembly : IContextMenuEntry { public bool IsVisible(TextViewContext context) @@ -607,7 +607,7 @@ namespace ICSharpCode.ILSpy.TreeNodes } [ExportContextMenuEntry(Header = nameof(Resources._Reload), Icon = "images/Refresh")] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class ReloadAssembly : IContextMenuEntry { public bool IsVisible(TextViewContext context) @@ -642,7 +642,7 @@ namespace ICSharpCode.ILSpy.TreeNodes } [ExportContextMenuEntry(Header = nameof(Resources._LoadDependencies), Category = nameof(Resources.Dependencies))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class LoadDependencies : IContextMenuEntry { public bool IsVisible(TextViewContext context) @@ -682,7 +682,7 @@ namespace ICSharpCode.ILSpy.TreeNodes } [ExportContextMenuEntry(Header = nameof(Resources._AddMainList), Category = nameof(Resources.Dependencies))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class AddToMainList : IContextMenuEntry { public bool IsVisible(TextViewContext context) @@ -717,7 +717,7 @@ namespace ICSharpCode.ILSpy.TreeNodes } [ExportContextMenuEntry(Header = nameof(Resources._OpenContainingFolder), Category = nameof(Resources.Shell))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class OpenContainingFolder : IContextMenuEntry { public bool IsVisible(TextViewContext context) @@ -770,7 +770,7 @@ namespace ICSharpCode.ILSpy.TreeNodes } [ExportContextMenuEntry(Header = nameof(Resources._OpenCommandLineHere), Category = nameof(Resources.Shell))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class OpenCmdHere : IContextMenuEntry { public bool IsVisible(TextViewContext context) diff --git a/ILSpy/TreeNodes/ResourceNodes/CursorResourceEntryNode.cs b/ILSpy/TreeNodes/ResourceNodes/CursorResourceEntryNode.cs index 993c22bdf..e81ba4674 100644 --- a/ILSpy/TreeNodes/ResourceNodes/CursorResourceEntryNode.cs +++ b/ILSpy/TreeNodes/ResourceNodes/CursorResourceEntryNode.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.ComponentModel.Composition; +using System.Composition; using System.IO; using System.Windows.Controls; using System.Windows.Media.Imaging; @@ -31,7 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions; namespace ICSharpCode.ILSpy.TreeNodes { [Export(typeof(IResourceNodeFactory))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class CursorResourceNodeFactory : IResourceNodeFactory { static readonly string[] imageFileExtensions = { ".cur" }; diff --git a/ILSpy/TreeNodes/ResourceNodes/IconResourceEntryNode.cs b/ILSpy/TreeNodes/ResourceNodes/IconResourceEntryNode.cs index 075aa1ca0..e6720c7e7 100644 --- a/ILSpy/TreeNodes/ResourceNodes/IconResourceEntryNode.cs +++ b/ILSpy/TreeNodes/ResourceNodes/IconResourceEntryNode.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.ComponentModel.Composition; +using System.Composition; using System.IO; using System.Windows.Controls; using System.Windows.Media.Imaging; @@ -31,7 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions; namespace ICSharpCode.ILSpy.TreeNodes { [Export(typeof(IResourceNodeFactory))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class IconResourceNodeFactory : IResourceNodeFactory { public ITreeNode CreateNode(Resource resource) diff --git a/ILSpy/TreeNodes/ResourceNodes/ImageListResourceEntryNode.cs b/ILSpy/TreeNodes/ResourceNodes/ImageListResourceEntryNode.cs index 7a3d9c795..08a1062bc 100644 --- a/ILSpy/TreeNodes/ResourceNodes/ImageListResourceEntryNode.cs +++ b/ILSpy/TreeNodes/ResourceNodes/ImageListResourceEntryNode.cs @@ -16,7 +16,7 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Drawing; using System.IO; using System.Windows.Forms; @@ -28,7 +28,7 @@ using ICSharpCode.ILSpyX.Abstractions; namespace ICSharpCode.ILSpy.TreeNodes { [Export(typeof(IResourceNodeFactory))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class ImageListResourceEntryNodeFactory : IResourceNodeFactory { public ITreeNode CreateNode(Resource resource) diff --git a/ILSpy/TreeNodes/ResourceNodes/ImageResourceEntryNode.cs b/ILSpy/TreeNodes/ResourceNodes/ImageResourceEntryNode.cs index cad4098eb..f33d3126c 100644 --- a/ILSpy/TreeNodes/ResourceNodes/ImageResourceEntryNode.cs +++ b/ILSpy/TreeNodes/ResourceNodes/ImageResourceEntryNode.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.ComponentModel.Composition; +using System.Composition; using System.IO; using System.Windows.Controls; using System.Windows.Media.Imaging; @@ -31,7 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions; namespace ICSharpCode.ILSpy.TreeNodes { [Export(typeof(IResourceNodeFactory))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class ImageResourceNodeFactory : IResourceNodeFactory { static readonly string[] imageFileExtensions = { ".png", ".gif", ".bmp", ".jpg" }; diff --git a/ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs b/ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs index 324390af2..dec51e183 100644 --- a/ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs +++ b/ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs @@ -19,7 +19,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.ComponentModel.Composition; +using System.Composition; using System.IO; using System.Linq; @@ -38,7 +38,7 @@ using Microsoft.Win32; namespace ICSharpCode.ILSpy.TreeNodes { [Export(typeof(IResourceNodeFactory))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class ResourcesFileTreeNodeFactory : IResourceNodeFactory { public ITreeNode CreateNode(Resource resource) diff --git a/ILSpy/TreeNodes/ResourceNodes/XamlResourceNode.cs b/ILSpy/TreeNodes/ResourceNodes/XamlResourceNode.cs index e017948df..342b2dec7 100644 --- a/ILSpy/TreeNodes/ResourceNodes/XamlResourceNode.cs +++ b/ILSpy/TreeNodes/ResourceNodes/XamlResourceNode.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.ComponentModel.Composition; +using System.Composition; using System.IO; using System.Threading.Tasks; @@ -31,7 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions; namespace ICSharpCode.ILSpy.Xaml { [Export(typeof(IResourceNodeFactory))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class XamlResourceNodeFactory : IResourceNodeFactory { public ITreeNode CreateNode(Resource resource) diff --git a/ILSpy/TreeNodes/ResourceNodes/XmlResourceNode.cs b/ILSpy/TreeNodes/ResourceNodes/XmlResourceNode.cs index 740947602..c2e09d5f8 100644 --- a/ILSpy/TreeNodes/ResourceNodes/XmlResourceNode.cs +++ b/ILSpy/TreeNodes/ResourceNodes/XmlResourceNode.cs @@ -17,7 +17,7 @@ // DEALINGS IN THE SOFTWARE. using System; -using System.ComponentModel.Composition; +using System.Composition; using System.IO; using System.Threading.Tasks; @@ -31,7 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions; namespace ICSharpCode.ILSpy.Xaml { [Export(typeof(IResourceNodeFactory))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class XmlResourceNodeFactory : IResourceNodeFactory { private readonly static string[] xmlFileExtensions = { ".xml", ".xsd", ".xslt" }; diff --git a/ILSpy/TreeNodes/ThreadingSupport.cs b/ILSpy/TreeNodes/ThreadingSupport.cs index ce1d87515..c5d5ced63 100644 --- a/ILSpy/TreeNodes/ThreadingSupport.cs +++ b/ILSpy/TreeNodes/ThreadingSupport.cs @@ -18,7 +18,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel.Composition; +using System.Composition; using System.Diagnostics; using System.Linq; using System.Text; @@ -172,7 +172,7 @@ namespace ICSharpCode.ILSpy.TreeNodes } [ExportContextMenuEntry(Header = nameof(Resources.CopyErrorMessage))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] sealed class CopyErrorMessageContextMenu : IContextMenuEntry { public bool IsVisible(TextViewContext context) diff --git a/ILSpy/ViewModels/DebugStepsPaneModel.cs b/ILSpy/ViewModels/DebugStepsPaneModel.cs index 406f047a8..566786fa1 100644 --- a/ILSpy/ViewModels/DebugStepsPaneModel.cs +++ b/ILSpy/ViewModels/DebugStepsPaneModel.cs @@ -16,14 +16,14 @@ // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -using System.ComponentModel.Composition; +using System.Composition; using System.Windows; namespace ICSharpCode.ILSpy.ViewModels { #if DEBUG [ExportToolPane] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] #endif public class DebugStepsPaneModel : ToolPaneModel { diff --git a/ILSpy/Views/DebugSteps.xaml.cs b/ILSpy/Views/DebugSteps.xaml.cs index edd16a6d6..7957802e5 100644 --- a/ILSpy/Views/DebugSteps.xaml.cs +++ b/ILSpy/Views/DebugSteps.xaml.cs @@ -1,6 +1,6 @@ using System; using System.ComponentModel; -using System.ComponentModel.Composition; +using System.Composition; using System.Windows; using System.Windows.Controls; using System.Windows.Input; @@ -10,12 +10,12 @@ using ICSharpCode.Decompiler.IL.Transforms; using ICSharpCode.ILSpy.Docking; using ICSharpCode.ILSpy.ViewModels; -using TomsToolbox.Wpf.Composition.Mef; +using TomsToolbox.Wpf.Composition.AttributedModel; namespace ICSharpCode.ILSpy { [DataTemplate(typeof(DebugStepsPaneModel))] - [PartCreationPolicy(CreationPolicy.NonShared)] + [NonShared] public partial class DebugSteps : UserControl { static readonly ILAstWritingOptions writingOptions = new ILAstWritingOptions { diff --git a/TestPlugin/AboutPageAddition.cs b/TestPlugin/AboutPageAddition.cs index 4088b2f92..3a2baba5e 100644 --- a/TestPlugin/AboutPageAddition.cs +++ b/TestPlugin/AboutPageAddition.cs @@ -1,7 +1,7 @@ // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under MIT X11 license (for details please see \doc\license.txt) -using System.ComponentModel.Composition; +using System.Composition; using System.Windows; using System.Windows.Media; @@ -11,7 +11,7 @@ using ICSharpCode.ILSpy; namespace TestPlugin { [Export(typeof(IAboutPageAddition))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] public class AboutPageAddition : IAboutPageAddition { public void Write(ISmartTextOutput textOutput) diff --git a/TestPlugin/ContextMenuCommand.cs b/TestPlugin/ContextMenuCommand.cs index dad7dc3f6..e7f4319fa 100644 --- a/TestPlugin/ContextMenuCommand.cs +++ b/TestPlugin/ContextMenuCommand.cs @@ -1,7 +1,7 @@ // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under MIT X11 license (for details please see \doc\license.txt) -using System.ComponentModel.Composition; +using System.Composition; using System.Linq; using ICSharpCode.ILSpy; @@ -10,7 +10,7 @@ using ICSharpCode.ILSpy.TreeNodes; namespace TestPlugin { [ExportContextMenuEntryAttribute(Header = "_Save Assembly")] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] public class SaveAssembly : IContextMenuEntry { public bool IsVisible(TextViewContext context) diff --git a/TestPlugin/CustomLanguage.cs b/TestPlugin/CustomLanguage.cs index 7e38fdffe..07b512ee2 100644 --- a/TestPlugin/CustomLanguage.cs +++ b/TestPlugin/CustomLanguage.cs @@ -1,7 +1,7 @@ // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under MIT X11 license (for details please see \doc\license.txt) -using System.ComponentModel.Composition; +using System.Composition; using System.Reflection.Metadata; using System.Windows.Controls; @@ -15,7 +15,7 @@ namespace TestPlugin /// Adds a new language to the decompiler. /// [Export(typeof(Language))] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] public class CustomLanguage : Language { public override string Name { diff --git a/TestPlugin/CustomOptionPage.xaml.cs b/TestPlugin/CustomOptionPage.xaml.cs index c550e02c0..95116a743 100644 --- a/TestPlugin/CustomOptionPage.xaml.cs +++ b/TestPlugin/CustomOptionPage.xaml.cs @@ -1,19 +1,19 @@ // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under MIT X11 license (for details please see \doc\license.txt) -using System.ComponentModel.Composition; +using System.Composition; using System.Xml.Linq; using ICSharpCode.ILSpy.Options; using ICSharpCode.ILSpy.Util; using TomsToolbox.Wpf; -using TomsToolbox.Wpf.Composition.Mef; +using TomsToolbox.Wpf.Composition.AttributedModel; namespace TestPlugin { [DataTemplate(typeof(CustomOptionsViewModel))] - [PartCreationPolicy(CreationPolicy.NonShared)] + [NonShared] partial class CustomOptionPage { public CustomOptionPage() @@ -23,7 +23,7 @@ namespace TestPlugin } [ExportOptionPage(Order = 0)] - [PartCreationPolicy(CreationPolicy.NonShared)] + [NonShared] class CustomOptionsViewModel : ObservableObject, IOptionPage { private Options options; diff --git a/TestPlugin/MainMenuCommand.cs b/TestPlugin/MainMenuCommand.cs index 8c28e7fe1..cddde39fd 100644 --- a/TestPlugin/MainMenuCommand.cs +++ b/TestPlugin/MainMenuCommand.cs @@ -1,7 +1,7 @@ // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // This code is distributed under MIT X11 license (for details please see \doc\license.txt) -using System.ComponentModel.Composition; +using System.Composition; using ICSharpCode.ILSpy; @@ -18,7 +18,7 @@ namespace TestPlugin // ToolbarCategory: optional, used for grouping related toolbar items together. A separator is added between different groups. // ToolbarOrder: controls the order in which the items appear (items are sorted by this value) [ExportToolbarCommand(ToolTip = "Clears the current assembly list", ToolbarIcon = "Clear.png", ToolbarCategory = "Open", ToolbarOrder = 1.5)] - [PartCreationPolicy(CreationPolicy.Shared)] + [Shared] public class UnloadAllAssembliesCommand : SimpleCommand { public override void Execute(object parameter) diff --git a/TestPlugin/Readme.txt b/TestPlugin/Readme.txt index ab910e57a..2863fd664 100644 --- a/TestPlugin/Readme.txt +++ b/TestPlugin/Readme.txt @@ -1,7 +1,7 @@ ILSpy uses MEF (Managed Extensibility Framework) for plugins. Plugins must be placed in the same directory as ILSpy.exe, and must be called "*.Plugin.dll". -To write a plugin, you need to add a reference to ILSpy.exe and to System.ComponentModel.Composition. +To write a plugin, you need to add a reference to ILSpy.exe and to System.Composition.AttributedModel. Depending on what your plugin is doing, you might also need references to the other libraries shipping with ILSpy. Plugins work by exporting types for certain extension points.