diff --git a/.editorconfig b/.editorconfig
index b7d98cfea..63a46acc9 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -12,7 +12,7 @@ indent_size = 2
[*.{yml,yaml}]
indent_style = space
indent_size = 2
-[*.csproj]
+[*.{csproj,props}]
indent_style = space
indent_size = 2
[*.config]
@@ -119,3 +119,8 @@ csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false
+
+# Errors and warnings
+
+# MEF006: No importing constructor
+dotnet_diagnostic.MEF006.severity = silent
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 1b73cb5e7..cc543f59b 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -45,9 +45,11 @@
-
-
+
+
+
+
\ No newline at end of file
diff --git a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.ruleset b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.ruleset
index 61afdc893..053189fe1 100644
--- a/ICSharpCode.Decompiler/ICSharpCode.Decompiler.ruleset
+++ b/ICSharpCode.Decompiler/ICSharpCode.Decompiler.ruleset
@@ -80,7 +80,6 @@
-
\ No newline at end of file
diff --git a/ICSharpCode.ILSpyX/Analyzers/Builtin/AttributeAppliedToAnalyzer.cs b/ICSharpCode.ILSpyX/Analyzers/Builtin/AttributeAppliedToAnalyzer.cs
index fa925c9b4..f19b23e41 100644
--- a/ICSharpCode.ILSpyX/Analyzers/Builtin/AttributeAppliedToAnalyzer.cs
+++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/AttributeAppliedToAnalyzer.cs
@@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.Linq;
using System.Reflection.Metadata;
using System.Threading;
@@ -29,6 +30,7 @@ using ICSharpCode.Decompiler.Util;
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
[ExportAnalyzer(Header = "Applied To", Order = 10)]
+ [PartCreationPolicy(CreationPolicy.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 e928f531a..e01513d2a 100644
--- a/ICSharpCode.ILSpyX/Analyzers/Builtin/EventImplementedByAnalyzer.cs
+++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/EventImplementedByAnalyzer.cs
@@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
@@ -28,6 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows events that implement an interface event.
///
[ExportAnalyzer(Header = "Implemented By", Order = 10)]
+ [PartCreationPolicy(CreationPolicy.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 5db8f0841..55206ce81 100644
--- a/ICSharpCode.ILSpyX/Analyzers/Builtin/EventOverriddenByAnalyzer.cs
+++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/EventOverriddenByAnalyzer.cs
@@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
@@ -28,6 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows events that override an event.
///
[ExportAnalyzer(Header = "Overridden By", Order = 20)]
+ [PartCreationPolicy(CreationPolicy.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 ba829b0fc..ad02b999f 100644
--- a/ICSharpCode.ILSpyX/Analyzers/Builtin/FieldAccessAnalyzer.cs
+++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/FieldAccessAnalyzer.cs
@@ -18,6 +18,7 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
using System.Reflection.Metadata;
@@ -35,6 +36,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Finds methods where this field is read.
///
[ExportAnalyzer(Header = "Assigned By", Order = 20)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
class AssignedByFieldAccessAnalyzer : FieldAccessAnalyzer
{
public AssignedByFieldAccessAnalyzer() : base(true) { }
@@ -44,6 +46,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Finds methods where this field is written.
///
[ExportAnalyzer(Header = "Read By", Order = 10)]
+ [PartCreationPolicy(CreationPolicy.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 a25d48d86..4090650d3 100644
--- a/ICSharpCode.ILSpyX/Analyzers/Builtin/MemberImplementsInterfaceAnalyzer.cs
+++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/MemberImplementsInterfaceAnalyzer.cs
@@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
@@ -28,6 +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)]
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 89da791ed..644212fab 100644
--- a/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodImplementedByAnalyzer.cs
+++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodImplementedByAnalyzer.cs
@@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
@@ -28,6 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows methods that implement an interface method.
///
[ExportAnalyzer(Header = "Implemented By", Order = 40)]
+ [PartCreationPolicy(CreationPolicy.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 ab9c4fe71..c2156d846 100644
--- a/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodOverriddenByAnalyzer.cs
+++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodOverriddenByAnalyzer.cs
@@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
@@ -28,6 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows methods that override a method.
///
[ExportAnalyzer(Header = "Overridden By", Order = 30)]
+ [PartCreationPolicy(CreationPolicy.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 702d77a7d..a2cb79828 100644
--- a/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsedByAnalyzer.cs
+++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsedByAnalyzer.cs
@@ -18,6 +18,7 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
using System.Reflection.Metadata;
@@ -32,6 +33,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows entities that are used by a method.
///
[ExportAnalyzer(Header = "Used By", Order = 20)]
+ [PartCreationPolicy(CreationPolicy.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 2b361ec00..6c7576f7c 100644
--- a/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsesAnalyzer.cs
+++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsesAnalyzer.cs
@@ -18,6 +18,7 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.Linq;
using System.Reflection.Metadata;
@@ -32,6 +33,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows entities that are used by a method.
///
[ExportAnalyzer(Header = "Uses", Order = 10)]
+ [PartCreationPolicy(CreationPolicy.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 a24787a88..58d70f3da 100644
--- a/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodVirtualUsedByAnalyzer.cs
+++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/MethodVirtualUsedByAnalyzer.cs
@@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
using System.Reflection.Metadata;
@@ -31,6 +32,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows entities that are used by a method.
///
[ExportAnalyzer(Header = "Used By", Order = 20)]
+ [PartCreationPolicy(CreationPolicy.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 4188822f4..159d0cf5f 100644
--- a/ICSharpCode.ILSpyX/Analyzers/Builtin/PropertyImplementedByAnalyzer.cs
+++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/PropertyImplementedByAnalyzer.cs
@@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
@@ -28,6 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows properties that implement an interface property.
///
[ExportAnalyzer(Header = "Implemented By", Order = 10)]
+ [PartCreationPolicy(CreationPolicy.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 1eb0d4a00..da0f9f8ac 100644
--- a/ICSharpCode.ILSpyX/Analyzers/Builtin/PropertyOverriddenByAnalyzer.cs
+++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/PropertyOverriddenByAnalyzer.cs
@@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
@@ -28,6 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows properties that override a property.
///
[ExportAnalyzer(Header = "Overridden By", Order = 20)]
+ [PartCreationPolicy(CreationPolicy.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 3f4fd59b2..bfb240bf1 100644
--- a/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeExposedByAnalyzer.cs
+++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeExposedByAnalyzer.cs
@@ -22,12 +22,15 @@ using System.Diagnostics;
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
+ using System.ComponentModel.Composition;
+
using ICSharpCode.Decompiler.TypeSystem;
///
/// Finds all entities that expose a type.
///
[ExportAnalyzer(Header = "Exposed By", Order = 40)]
+ [PartCreationPolicy(CreationPolicy.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 b55711021..2e28cd526 100644
--- a/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeExtensionMethodsAnalyzer.cs
+++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeExtensionMethodsAnalyzer.cs
@@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using ICSharpCode.Decompiler.TypeSystem;
@@ -27,6 +28,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Finds all extension methods defined for a type.
///
[ExportAnalyzer(Header = "Extension Methods", Order = 50)]
+ [PartCreationPolicy(CreationPolicy.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 603f3e5b0..03bf39155 100644
--- a/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeInstantiatedByAnalyzer.cs
+++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeInstantiatedByAnalyzer.cs
@@ -18,6 +18,7 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
using System.Reflection.Metadata;
@@ -33,6 +34,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows methods that instantiate a type.
///
[ExportAnalyzer(Header = "Instantiated By", Order = 20)]
+ [PartCreationPolicy(CreationPolicy.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 e4a10801f..b7a8a4147 100644
--- a/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeUsedByAnalyzer.cs
+++ b/ICSharpCode.ILSpyX/Analyzers/Builtin/TypeUsedByAnalyzer.cs
@@ -19,6 +19,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
using System.Reflection.Metadata;
@@ -34,6 +35,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows entities that use a type.
///
[ExportAnalyzer(Header = "Used By", Order = 30)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
class TypeUsedByAnalyzer : IAnalyzer
{
public IEnumerable Analyze(ISymbol analyzedSymbol, AnalyzerContext context)
diff --git a/ILSpy.BamlDecompiler/BamlResourceNodeFactory.cs b/ILSpy.BamlDecompiler/BamlResourceNodeFactory.cs
index 32f71afa9..ecb1e25d1 100644
--- a/ILSpy.BamlDecompiler/BamlResourceNodeFactory.cs
+++ b/ILSpy.BamlDecompiler/BamlResourceNodeFactory.cs
@@ -32,6 +32,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ILSpy.BamlDecompiler
{
[Export(typeof(IResourceNodeFactory))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
public sealed class BamlResourceNodeFactory : IResourceNodeFactory
{
public ITreeNode CreateNode(Resource resource)
@@ -44,6 +45,7 @@ namespace ILSpy.BamlDecompiler
}
[Export(typeof(IResourceFileHandler))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
public sealed class BamlResourceFileHandler : IResourceFileHandler
{
public string EntryType => "Page";
diff --git a/ILSpy.ReadyToRun/ReadyToRunLanguage.cs b/ILSpy.ReadyToRun/ReadyToRunLanguage.cs
index cadd1217b..410e49b67 100644
--- a/ILSpy.ReadyToRun/ReadyToRunLanguage.cs
+++ b/ILSpy.ReadyToRun/ReadyToRunLanguage.cs
@@ -95,6 +95,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun
#endif
[Export(typeof(Language))]
+ [PartCreationPolicy(CreationPolicy.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 53da7a71f..fbe046ea4 100644
--- a/ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml.cs
+++ b/ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml.cs
@@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System.ComponentModel;
+using System.ComponentModel.Composition;
using System.Windows.Controls;
using System.Xml.Linq;
@@ -26,6 +27,7 @@ using ICSharpCode.ILSpyX.Settings;
namespace ICSharpCode.ILSpy.ReadyToRun
{
[ExportOptionPage(Title = nameof(global::ILSpy.ReadyToRun.Properties.Resources.ReadyToRun), Order = 40)]
+ [PartCreationPolicy(CreationPolicy.NonShared)]
partial class ReadyToRunOptionPage : UserControl, IOptionPage
{
public ReadyToRunOptionPage()
diff --git a/ILSpy/AboutPage.cs b/ILSpy/AboutPage.cs
index b796fa362..43303bf88 100644
--- a/ILSpy/AboutPage.cs
+++ b/ILSpy/AboutPage.cs
@@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
+using System.ComponentModel.Composition;
using System.IO;
using System.Text.RegularExpressions;
using System.Windows;
@@ -36,6 +37,7 @@ using ICSharpCode.ILSpyX.Settings;
namespace ICSharpCode.ILSpy
{
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._Help), Header = nameof(Resources._About), MenuOrder = 99999)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class AboutPage : SimpleCommand
{
public override void Execute(object parameter)
diff --git a/ILSpy/Analyzers/AnalyzeCommand.cs b/ILSpy/Analyzers/AnalyzeCommand.cs
index e221235e8..854aa565c 100644
--- a/ILSpy/Analyzers/AnalyzeCommand.cs
+++ b/ILSpy/Analyzers/AnalyzeCommand.cs
@@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
+using System.ComponentModel.Composition;
using System.Linq;
using ICSharpCode.Decompiler.Metadata;
@@ -27,6 +28,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)]
internal sealed class AnalyzeCommand : SimpleCommand, IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
diff --git a/ILSpy/Analyzers/CopyAnalysisResultsContextMenuEntry.cs b/ILSpy/Analyzers/CopyAnalysisResultsContextMenuEntry.cs
index 1e2566b68..5d0af2d66 100644
--- a/ILSpy/Analyzers/CopyAnalysisResultsContextMenuEntry.cs
+++ b/ILSpy/Analyzers/CopyAnalysisResultsContextMenuEntry.cs
@@ -16,6 +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.Linq;
using System.Text;
using System.Windows;
@@ -23,6 +24,7 @@ using System.Windows;
namespace ICSharpCode.ILSpy.Analyzers
{
[ExportContextMenuEntry(Header = "Copy results", Category = "Analyze", Order = 200)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
internal sealed class CopyAnalysisResultsContextMenuEntry : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
diff --git a/ILSpy/Analyzers/RemoveAnalyzeContextMenuEntry.cs b/ILSpy/Analyzers/RemoveAnalyzeContextMenuEntry.cs
index d3ed19a46..662f466de 100644
--- a/ILSpy/Analyzers/RemoveAnalyzeContextMenuEntry.cs
+++ b/ILSpy/Analyzers/RemoveAnalyzeContextMenuEntry.cs
@@ -16,11 +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.Linq;
namespace ICSharpCode.ILSpy.Analyzers
{
[ExportContextMenuEntry(Header = "Remove", Icon = "images/Delete", Category = "Analyze", Order = 200)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
internal sealed class RemoveAnalyzeContextMenuEntry : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
diff --git a/ILSpy/Commands/BrowseBackCommand.cs b/ILSpy/Commands/BrowseBackCommand.cs
index bb8580495..cf424cbd4 100644
--- a/ILSpy/Commands/BrowseBackCommand.cs
+++ b/ILSpy/Commands/BrowseBackCommand.cs
@@ -16,6 +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.Windows.Input;
using ICSharpCode.ILSpy.Properties;
@@ -23,6 +24,7 @@ using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy
{
[ExportToolbarCommand(ToolTip = nameof(Resources.Back), ToolbarIcon = "Images/Back", ToolbarCategory = nameof(Resources.Navigation), ToolbarOrder = 0)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class BrowseBackCommand : CommandWrapper
{
public BrowseBackCommand()
diff --git a/ILSpy/Commands/BrowseForwardCommand.cs b/ILSpy/Commands/BrowseForwardCommand.cs
index 5935bd666..3a8276457 100644
--- a/ILSpy/Commands/BrowseForwardCommand.cs
+++ b/ILSpy/Commands/BrowseForwardCommand.cs
@@ -16,6 +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.Windows.Input;
using ICSharpCode.ILSpy.Properties;
@@ -23,6 +24,7 @@ using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy
{
[ExportToolbarCommand(ToolTip = nameof(Resources.Forward), ToolbarIcon = "Images/Forward", ToolbarCategory = nameof(Resources.Navigation), ToolbarOrder = 1)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class BrowseForwardCommand : CommandWrapper
{
public BrowseForwardCommand()
diff --git a/ILSpy/Commands/CheckForUpdatesCommand.cs b/ILSpy/Commands/CheckForUpdatesCommand.cs
index 011d68241..58438c604 100644
--- a/ILSpy/Commands/CheckForUpdatesCommand.cs
+++ b/ILSpy/Commands/CheckForUpdatesCommand.cs
@@ -17,12 +17,15 @@
// DEALINGS IN THE SOFTWARE.
+using System.ComponentModel.Composition;
+
using ICSharpCode.ILSpy.Properties;
using ICSharpCode.ILSpyX.Settings;
namespace ICSharpCode.ILSpy
{
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._Help), Header = nameof(Resources._CheckUpdates), MenuOrder = 5000)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class CheckForUpdatesCommand : SimpleCommand
{
public override bool CanExecute(object parameter)
diff --git a/ILSpy/Commands/CopyFullyQualifiedNameContextMenuEntry.cs b/ILSpy/Commands/CopyFullyQualifiedNameContextMenuEntry.cs
index 0a197035c..47490e37b 100644
--- a/ILSpy/Commands/CopyFullyQualifiedNameContextMenuEntry.cs
+++ b/ILSpy/Commands/CopyFullyQualifiedNameContextMenuEntry.cs
@@ -15,6 +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.Windows;
using ICSharpCode.ILSpy.Properties;
@@ -23,6 +24,7 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy
{
[ExportContextMenuEntry(Header = nameof(Resources.CopyName), Icon = "images/Copy", Order = 9999)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
public class CopyFullyQualifiedNameContextMenuEntry : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
diff --git a/ILSpy/Commands/DecompileAllCommand.cs b/ILSpy/Commands/DecompileAllCommand.cs
index 7bc61a167..b6ccb0bd6 100644
--- a/ILSpy/Commands/DecompileAllCommand.cs
+++ b/ILSpy/Commands/DecompileAllCommand.cs
@@ -20,6 +20,7 @@
using System;
using System.Collections.Concurrent;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
@@ -34,6 +35,7 @@ using TomsToolbox.Essentials;
namespace ICSharpCode.ILSpy
{
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.DEBUGDecompile), MenuCategory = nameof(Resources.Open), MenuOrder = 2.5)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class DecompileAllCommand : SimpleCommand
{
public override bool CanExecute(object parameter)
@@ -86,6 +88,7 @@ namespace ICSharpCode.ILSpy
}
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.DEBUGDecompile100x), MenuCategory = nameof(Resources.Open), MenuOrder = 2.6)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class Decompile100TimesCommand : SimpleCommand
{
public override void Execute(object parameter)
diff --git a/ILSpy/Commands/DecompileCommand.cs b/ILSpy/Commands/DecompileCommand.cs
index ff0a995df..0a7d1a385 100644
--- a/ILSpy/Commands/DecompileCommand.cs
+++ b/ILSpy/Commands/DecompileCommand.cs
@@ -16,6 +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.Linq;
using ICSharpCode.Decompiler.TypeSystem;
@@ -25,6 +26,7 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy.Commands
{
[ExportContextMenuEntry(Header = nameof(Resources.Decompile), Order = 10)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
class DecompileCommand : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
diff --git a/ILSpy/Commands/DecompileInNewViewCommand.cs b/ILSpy/Commands/DecompileInNewViewCommand.cs
index 744c1ecc9..07e9bebcb 100644
--- a/ILSpy/Commands/DecompileInNewViewCommand.cs
+++ b/ILSpy/Commands/DecompileInNewViewCommand.cs
@@ -18,6 +18,7 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.Linq;
using System.Windows.Threading;
@@ -30,6 +31,7 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy.Commands
{
[ExportContextMenuEntry(Header = nameof(Resources.DecompileToNewPanel), InputGestureText = "MMB", Icon = "images/Search", Category = nameof(Resources.Analyze), Order = 90)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
internal sealed class DecompileInNewViewCommand : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
diff --git a/ILSpy/Commands/DisassembleAllCommand.cs b/ILSpy/Commands/DisassembleAllCommand.cs
index 34f7f8575..fc44d405a 100644
--- a/ILSpy/Commands/DisassembleAllCommand.cs
+++ b/ILSpy/Commands/DisassembleAllCommand.cs
@@ -20,6 +20,7 @@
using System;
using System.Collections.Concurrent;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Threading.Tasks;
@@ -30,6 +31,7 @@ using ICSharpCode.ILSpyX;
namespace ICSharpCode.ILSpy
{
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.DEBUGDisassemble), MenuCategory = nameof(Resources.Open), MenuOrder = 2.5)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class DisassembleAllCommand : SimpleCommand
{
public override bool CanExecute(object parameter)
diff --git a/ILSpy/Commands/ExitCommand.cs b/ILSpy/Commands/ExitCommand.cs
index bbb68122c..fb475ef01 100644
--- a/ILSpy/Commands/ExitCommand.cs
+++ b/ILSpy/Commands/ExitCommand.cs
@@ -15,11 +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 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)]
sealed class ExitCommand : SimpleCommand
{
public override void Execute(object parameter)
diff --git a/ILSpy/Commands/ExtractPackageEntryContextMenuEntry.cs b/ILSpy/Commands/ExtractPackageEntryContextMenuEntry.cs
index 57076e517..3f22fa1cd 100644
--- a/ILSpy/Commands/ExtractPackageEntryContextMenuEntry.cs
+++ b/ILSpy/Commands/ExtractPackageEntryContextMenuEntry.cs
@@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.IO;
using System.Linq;
@@ -34,6 +35,7 @@ using Microsoft.Win32;
namespace ICSharpCode.ILSpy
{
[ExportContextMenuEntry(Header = nameof(Resources.ExtractPackageEntry), Category = nameof(Resources.Save), Icon = "Images/Save")]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class ExtractPackageEntryContextMenuEntry : IContextMenuEntry
{
public void Execute(TextViewContext context)
diff --git a/ILSpy/Commands/GeneratePdbContextMenuEntry.cs b/ILSpy/Commands/GeneratePdbContextMenuEntry.cs
index 773c7cd4c..b7c3997d0 100644
--- a/ILSpy/Commands/GeneratePdbContextMenuEntry.cs
+++ b/ILSpy/Commands/GeneratePdbContextMenuEntry.cs
@@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.IO;
using System.Linq;
@@ -38,6 +39,7 @@ using Microsoft.Win32;
namespace ICSharpCode.ILSpy
{
[ExportContextMenuEntry(Header = nameof(Resources.GeneratePortable))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
class GeneratePdbContextMenuEntry : IContextMenuEntry
{
public void Execute(TextViewContext context)
@@ -103,6 +105,7 @@ namespace ICSharpCode.ILSpy
}
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.GeneratePortable), MenuCategory = nameof(Resources.Save))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
class GeneratePdbMainMenuEntry : SimpleCommand
{
public override bool CanExecute(object parameter)
diff --git a/ILSpy/Commands/ManageAssemblyListsCommand.cs b/ILSpy/Commands/ManageAssemblyListsCommand.cs
index ec58ff59d..0f2240e14 100644
--- a/ILSpy/Commands/ManageAssemblyListsCommand.cs
+++ b/ILSpy/Commands/ManageAssemblyListsCommand.cs
@@ -17,11 +17,14 @@
// DEALINGS IN THE SOFTWARE.
+using System.ComponentModel.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)]
sealed class ManageAssemblyListsCommand : SimpleCommand
{
public override void Execute(object parameter)
diff --git a/ILSpy/Commands/OpenCommand.cs b/ILSpy/Commands/OpenCommand.cs
index a1663a499..7c66ac43a 100644
--- a/ILSpy/Commands/OpenCommand.cs
+++ b/ILSpy/Commands/OpenCommand.cs
@@ -16,6 +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.Windows.Input;
using ICSharpCode.ILSpy.Properties;
@@ -24,6 +25,7 @@ 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)]
sealed class OpenCommand : CommandWrapper
{
public OpenCommand()
diff --git a/ILSpy/Commands/OpenFromGacCommand.cs b/ILSpy/Commands/OpenFromGacCommand.cs
index a077ceb9d..393e00eeb 100644
--- a/ILSpy/Commands/OpenFromGacCommand.cs
+++ b/ILSpy/Commands/OpenFromGacCommand.cs
@@ -16,12 +16,15 @@
// 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 ICSharpCode.ILSpy.AppEnv;
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)]
sealed class OpenFromGacCommand : SimpleCommand
{
public override bool CanExecute(object parameter)
diff --git a/ILSpy/Commands/Pdb2XmlCommand.cs b/ILSpy/Commands/Pdb2XmlCommand.cs
index f64478feb..c69777370 100644
--- a/ILSpy/Commands/Pdb2XmlCommand.cs
+++ b/ILSpy/Commands/Pdb2XmlCommand.cs
@@ -19,6 +19,7 @@
#if DEBUG
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
@@ -34,6 +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)]
sealed class Pdb2XmlCommand : SimpleCommand
{
public override bool CanExecute(object parameter)
@@ -70,6 +72,7 @@ namespace ICSharpCode.ILSpy
}
[ExportContextMenuEntry(Header = nameof(Resources.DEBUGDumpPDBAsXML))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
class Pdb2XmlCommandContextMenuEntry : IContextMenuEntry
{
public void Execute(TextViewContext context)
diff --git a/ILSpy/Commands/RefreshCommand.cs b/ILSpy/Commands/RefreshCommand.cs
index 3e188a7e6..cfb03bf34 100644
--- a/ILSpy/Commands/RefreshCommand.cs
+++ b/ILSpy/Commands/RefreshCommand.cs
@@ -16,6 +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.Windows.Input;
using ICSharpCode.ILSpy.Properties;
@@ -24,6 +25,7 @@ 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)]
sealed class RefreshCommand : CommandWrapper
{
public RefreshCommand()
diff --git a/ILSpy/Commands/RemoveAssembliesWithLoadErrors.cs b/ILSpy/Commands/RemoveAssembliesWithLoadErrors.cs
index a2a4430be..c8696104b 100644
--- a/ILSpy/Commands/RemoveAssembliesWithLoadErrors.cs
+++ b/ILSpy/Commands/RemoveAssembliesWithLoadErrors.cs
@@ -16,6 +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.Linq;
using ICSharpCode.ILSpy.Properties;
@@ -23,6 +24,7 @@ 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)]
class RemoveAssembliesWithLoadErrors : SimpleCommand
{
public override bool CanExecute(object parameter)
@@ -44,6 +46,7 @@ namespace ICSharpCode.ILSpy
}
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.ClearAssemblyList), MenuCategory = nameof(Resources.Remove), MenuOrder = 2.6)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
class ClearAssemblyList : SimpleCommand
{
public override bool CanExecute(object parameter)
diff --git a/ILSpy/Commands/SaveCodeContextMenuEntry.cs b/ILSpy/Commands/SaveCodeContextMenuEntry.cs
index 5ce79ee10..897e6f12c 100644
--- a/ILSpy/Commands/SaveCodeContextMenuEntry.cs
+++ b/ILSpy/Commands/SaveCodeContextMenuEntry.cs
@@ -30,10 +30,12 @@ using ICSharpCode.ILSpy.ViewModels;
using Microsoft.Win32;
using ICSharpCode.ILSpyX.TreeView;
+using System.ComponentModel.Composition;
namespace ICSharpCode.ILSpy.TextView
{
[ExportContextMenuEntry(Header = nameof(Resources._SaveCode), Category = nameof(Resources.Save), Icon = "Images/Save")]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class SaveCodeContextMenuEntry : IContextMenuEntry
{
public void Execute(TextViewContext context)
diff --git a/ILSpy/Commands/SaveCommand.cs b/ILSpy/Commands/SaveCommand.cs
index 9f07f518f..8b8871e0a 100644
--- a/ILSpy/Commands/SaveCommand.cs
+++ b/ILSpy/Commands/SaveCommand.cs
@@ -16,6 +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.Windows.Input;
using ICSharpCode.ILSpy.Properties;
@@ -23,6 +24,7 @@ using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy
{
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources._SaveCode), MenuIcon = "Images/Save", MenuCategory = nameof(Resources.Save), MenuOrder = 0)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class SaveCommand : CommandWrapper
{
public SaveCommand()
diff --git a/ILSpy/Commands/ScopeSearchToAssembly.cs b/ILSpy/Commands/ScopeSearchToAssembly.cs
index 1ec6ef73b..3d8a10397 100644
--- a/ILSpy/Commands/ScopeSearchToAssembly.cs
+++ b/ILSpy/Commands/ScopeSearchToAssembly.cs
@@ -18,6 +18,7 @@
#nullable enable
using System;
+using System.ComponentModel.Composition;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpy.AppEnv;
@@ -27,6 +28,7 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy
{
[ExportContextMenuEntry(Header = nameof(Resources.ScopeSearchToThisAssembly), Category = nameof(Resources.Analyze), Order = 9999)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
public class ScopeSearchToAssembly : IContextMenuEntry
{
public void Execute(TextViewContext context)
diff --git a/ILSpy/Commands/ScopeSearchToNamespace.cs b/ILSpy/Commands/ScopeSearchToNamespace.cs
index 11a411ed6..c6be0a9db 100644
--- a/ILSpy/Commands/ScopeSearchToNamespace.cs
+++ b/ILSpy/Commands/ScopeSearchToNamespace.cs
@@ -16,6 +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 ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpy.AppEnv;
@@ -25,6 +26,7 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy
{
[ExportContextMenuEntry(Header = nameof(Resources.ScopeSearchToThisNamespace), Category = nameof(Resources.Analyze), Order = 9999)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
public class ScopeSearchToNamespace : IContextMenuEntry
{
public void Execute(TextViewContext context)
diff --git a/ILSpy/Commands/SearchMsdnContextMenuEntry.cs b/ILSpy/Commands/SearchMsdnContextMenuEntry.cs
index 08c7f5a42..a49f1c456 100644
--- a/ILSpy/Commands/SearchMsdnContextMenuEntry.cs
+++ b/ILSpy/Commands/SearchMsdnContextMenuEntry.cs
@@ -23,9 +23,12 @@ using ICSharpCode.ILSpy.Properties;
using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy
{
+ using System.ComponentModel.Composition;
+
using ICSharpCode.Decompiler.TypeSystem;
[ExportContextMenuEntry(Header = nameof(Resources.SearchMSDN), Icon = "images/SearchMsdn", Order = 9999)]
+ [PartCreationPolicy(CreationPolicy.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 1d8da975f..061ff7e6b 100644
--- a/ILSpy/Commands/SelectPdbContextMenuEntry.cs
+++ b/ILSpy/Commands/SelectPdbContextMenuEntry.cs
@@ -16,6 +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.IO;
using System.Linq;
@@ -27,6 +28,7 @@ using Microsoft.Win32;
namespace ICSharpCode.ILSpy
{
[ExportContextMenuEntry(Header = nameof(Resources.SelectPDB))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
class SelectPdbContextMenuEntry : IContextMenuEntry
{
public async void Execute(TextViewContext context)
diff --git a/ILSpy/Commands/ShowCFGContextMenuEntry.cs b/ILSpy/Commands/ShowCFGContextMenuEntry.cs
index a3e2b4e29..b4e8be003 100644
--- a/ILSpy/Commands/ShowCFGContextMenuEntry.cs
+++ b/ILSpy/Commands/ShowCFGContextMenuEntry.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.Windows;
using ICSharpCode.Decompiler.FlowAnalysis;
@@ -11,6 +12,7 @@ namespace ICSharpCode.ILSpy.Commands
{
#if DEBUG
[ExportContextMenuEntry(Header = "DEBUG -- Show CFG")]
+ [PartCreationPolicy(CreationPolicy.Shared)]
internal class ShowCFGContextMenuEntry : IContextMenuEntry
{
public void Execute(TextViewContext context)
diff --git a/ILSpy/Commands/SortAssemblyListCommand.cs b/ILSpy/Commands/SortAssemblyListCommand.cs
index 110a60b8a..7621778a7 100644
--- a/ILSpy/Commands/SortAssemblyListCommand.cs
+++ b/ILSpy/Commands/SortAssemblyListCommand.cs
@@ -18,6 +18,7 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using ICSharpCode.ILSpy.Properties;
using ICSharpCode.ILSpyX;
@@ -27,6 +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)]
sealed class SortAssemblyListCommand : SimpleCommand, IComparer
{
public override void Execute(object parameter)
@@ -43,6 +45,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)]
sealed class CollapseAllCommand : SimpleCommand
{
public override void Execute(object parameter)
diff --git a/ILSpy/Docking/CloseAllDocumentsCommand.cs b/ILSpy/Docking/CloseAllDocumentsCommand.cs
index fc33eb8cd..2c0ceb41b 100644
--- a/ILSpy/Docking/CloseAllDocumentsCommand.cs
+++ b/ILSpy/Docking/CloseAllDocumentsCommand.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -9,6 +10,7 @@ using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy.Docking
{
[ExportMainMenuCommand(Header = nameof(Resources.Window_CloseAllDocuments), ParentMenuID = nameof(Resources._Window))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
class CloseAllDocumentsCommand : SimpleCommand
{
public override void Execute(object parameter)
@@ -18,6 +20,7 @@ namespace ICSharpCode.ILSpy.Docking
}
[ExportMainMenuCommand(Header = nameof(Resources.Window_ResetLayout), ParentMenuID = nameof(Resources._Window))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
class ResetLayoutCommand : SimpleCommand
{
public override void Execute(object parameter)
diff --git a/ILSpy/ExportProviderAdapter.cs b/ILSpy/ExportProviderAdapter.cs
index 555352fc4..81bc7bfbf 100644
--- a/ILSpy/ExportProviderAdapter.cs
+++ b/ILSpy/ExportProviderAdapter.cs
@@ -15,7 +15,7 @@ namespace ICSharpCode.ILSpy;
///
/// Adapter for Microsoft.VisualStudio.Composition. to .
///
-public class ExportProviderAdapter : IExportProvider
+public sealed class ExportProviderAdapter : IExportProvider
{
private static readonly Type DefaultMetadataType = typeof(Dictionary);
@@ -42,10 +42,7 @@ public class ExportProviderAdapter : IExportProvider
return _exportProvider.GetExportedValues(contractName).SingleOrDefault();
}
-#pragma warning disable CS8769 // Nullability of reference types in type of parameter doesn't match implemented member (possibly because of nullability attributes).
- // can't apply NotNullWhen here, because ICSharpCode.Decompiler defines a duplicate attribute, and uses InternalsVisibleTo("ILSpy"), so this attribute is now ambiguous!
- bool IExportProvider.TryGetExportedValue(string? contractName, /*[NotNullWhen(true)]*/ out T? value) where T : class
-#pragma warning restore CS8769 // Nullability of reference types in type of parameter doesn't match implemented member (possibly because of nullability attributes).
+ bool IExportProvider.TryGetExportedValue(string? contractName, [NotNullWhen(true)] out T? value) where T : class
{
value = _exportProvider.GetExportedValues(contractName).SingleOrDefault();
diff --git a/ILSpy/ILSpy.csproj b/ILSpy/ILSpy.csproj
index 5bbadbe1b..b7657c891 100644
--- a/ILSpy/ILSpy.csproj
+++ b/ILSpy/ILSpy.csproj
@@ -50,7 +50,6 @@
-
@@ -92,8 +91,8 @@
-
-
+
+
diff --git a/ILSpy/Languages/CSharpILMixedLanguage.cs b/ILSpy/Languages/CSharpILMixedLanguage.cs
index 6ad3bb54e..31975cc24 100644
--- a/ILSpy/Languages/CSharpILMixedLanguage.cs
+++ b/ILSpy/Languages/CSharpILMixedLanguage.cs
@@ -42,6 +42,7 @@ namespace ICSharpCode.ILSpy
using SequencePoint = ICSharpCode.Decompiler.DebugInfo.SequencePoint;
[Export(typeof(Language))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
class CSharpILMixedLanguage : ILLanguage
{
public override string Name => "IL with C#";
diff --git a/ILSpy/Languages/CSharpLanguage.cs b/ILSpy/Languages/CSharpLanguage.cs
index 6e8296241..dcf7e91a2 100644
--- a/ILSpy/Languages/CSharpLanguage.cs
+++ b/ILSpy/Languages/CSharpLanguage.cs
@@ -53,6 +53,7 @@ namespace ICSharpCode.ILSpy
/// please directly use the CSharpDecompiler class.
///
[Export(typeof(Language))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
public class CSharpLanguage : Language
{
string name = "C#";
diff --git a/ILSpy/Languages/ILLanguage.cs b/ILSpy/Languages/ILLanguage.cs
index 95c881bb4..ab8f89ab7 100644
--- a/ILSpy/Languages/ILLanguage.cs
+++ b/ILSpy/Languages/ILLanguage.cs
@@ -42,6 +42,7 @@ namespace ICSharpCode.ILSpy
/// flat IL (detectControlStructure=false) and structured IL (detectControlStructure=true).
///
[Export(typeof(Language))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
public class ILLanguage : Language
{
protected bool detectControlStructure = true;
diff --git a/ILSpy/Metadata/GoToTokenCommand.cs b/ILSpy/Metadata/GoToTokenCommand.cs
index ae0fa1657..1c0caca2b 100644
--- a/ILSpy/Metadata/GoToTokenCommand.cs
+++ b/ILSpy/Metadata/GoToTokenCommand.cs
@@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
+using System.ComponentModel.Composition;
using System.Linq;
using System.Reflection;
using System.Reflection.Metadata.Ecma335;
@@ -31,6 +32,7 @@ using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy.Commands
{
[ExportContextMenuEntry(Header = nameof(Resources.GoToToken), Order = 10)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
class GoToTokenCommand : IContextMenuEntry
{
public void Execute(TextViewContext context)
@@ -68,6 +70,7 @@ namespace ICSharpCode.ILSpy.Commands
}
[ExportContextMenuEntry(Header = nameof(Resources.Copy), Order = 10)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
class CopyCommand : IContextMenuEntry
{
public void Execute(TextViewContext context)
diff --git a/ILSpy/Metadata/MetadataProtocolHandler.cs b/ILSpy/Metadata/MetadataProtocolHandler.cs
index e4fc4bbec..c49e300d7 100644
--- a/ILSpy/Metadata/MetadataProtocolHandler.cs
+++ b/ILSpy/Metadata/MetadataProtocolHandler.cs
@@ -26,6 +26,7 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy.Metadata
{
[Export(typeof(IProtocolHandler))]
+ [PartCreationPolicy(CreationPolicy.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 9f542f243..8a55d73fb 100644
--- a/ILSpy/Options/DecompilerSettingsPanel.xaml.cs
+++ b/ILSpy/Options/DecompilerSettingsPanel.xaml.cs
@@ -16,6 +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.Xml.Linq;
using ICSharpCode.ILSpyX.Settings;
@@ -26,6 +27,7 @@ namespace ICSharpCode.ILSpy.Options
/// Interaction logic for DecompilerSettingsPanel.xaml
///
[ExportOptionPage(Title = nameof(Properties.Resources.Decompiler), Order = 10)]
+ [PartCreationPolicy(CreationPolicy.NonShared)]
internal partial class DecompilerSettingsPanel : IOptionPage
{
public DecompilerSettingsPanel()
diff --git a/ILSpy/Options/DisplaySettingsPanel.xaml.cs b/ILSpy/Options/DisplaySettingsPanel.xaml.cs
index 908ed3501..0319b327d 100644
--- a/ILSpy/Options/DisplaySettingsPanel.xaml.cs
+++ b/ILSpy/Options/DisplaySettingsPanel.xaml.cs
@@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
+using System.ComponentModel.Composition;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
@@ -34,6 +35,7 @@ namespace ICSharpCode.ILSpy.Options
/// Interaction logic for DisplaySettingsPanel.xaml
///
[ExportOptionPage(Title = nameof(Properties.Resources.Display), Order = 20)]
+ [PartCreationPolicy(CreationPolicy.NonShared)]
public partial class DisplaySettingsPanel : UserControl, IOptionPage
{
public DisplaySettingsPanel()
diff --git a/ILSpy/Options/MiscSettingsPanel.xaml.cs b/ILSpy/Options/MiscSettingsPanel.xaml.cs
index f7c49c14e..ac98981dd 100644
--- a/ILSpy/Options/MiscSettingsPanel.xaml.cs
+++ b/ILSpy/Options/MiscSettingsPanel.xaml.cs
@@ -16,6 +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.Windows.Controls;
using System.Xml.Linq;
@@ -27,6 +28,7 @@ namespace ICSharpCode.ILSpy.Options
/// Interaction logic for MiscSettingsPanel.xaml
///
[ExportOptionPage(Title = nameof(Properties.Resources.Misc), Order = 30)]
+ [PartCreationPolicy(CreationPolicy.NonShared)]
public partial class MiscSettingsPanel : UserControl, IOptionPage
{
public MiscSettingsPanel()
diff --git a/ILSpy/Options/OptionsDialog.xaml.cs b/ILSpy/Options/OptionsDialog.xaml.cs
index ab15a93d5..72413f672 100644
--- a/ILSpy/Options/OptionsDialog.xaml.cs
+++ b/ILSpy/Options/OptionsDialog.xaml.cs
@@ -121,6 +121,7 @@ namespace ICSharpCode.ILSpy.Options
}
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._View), Header = nameof(Resources._Options), MenuCategory = nameof(Resources.Options), MenuOrder = 999)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class ShowOptionsCommand : SimpleCommand
{
public override void Execute(object parameter)
diff --git a/ILSpy/Search/SearchPane.cs b/ILSpy/Search/SearchPane.cs
index 55a29370c..2f7d25d3f 100644
--- a/ILSpy/Search/SearchPane.cs
+++ b/ILSpy/Search/SearchPane.cs
@@ -21,6 +21,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Collections.Specialized;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
using System.Text.RegularExpressions;
@@ -531,6 +532,7 @@ namespace ICSharpCode.ILSpy.Search
}
[ExportToolbarCommand(ToolTip = nameof(Properties.Resources.SearchCtrlShiftFOrCtrlE), ToolbarIcon = "Images/Search", ToolbarCategory = nameof(Properties.Resources.View), ToolbarOrder = 100)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class ShowSearchCommand : CommandWrapper
{
public ShowSearchCommand()
diff --git a/ILSpy/TextView/EditorCommands.cs b/ILSpy/TextView/EditorCommands.cs
index 52784203b..0f6b5e646 100644
--- a/ILSpy/TextView/EditorCommands.cs
+++ b/ILSpy/TextView/EditorCommands.cs
@@ -16,11 +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 ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy.TextView
{
[ExportContextMenuEntry(Header = nameof(Resources.Copy), Category = nameof(Resources.Editor))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class CopyContextMenuEntry : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
@@ -40,6 +43,7 @@ namespace ICSharpCode.ILSpy.TextView
}
[ExportContextMenuEntry(Header = nameof(Resources.Select), Category = nameof(Resources.Editor))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class SelectAllContextMenuEntry : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
diff --git a/ILSpy/TextView/FoldingCommands.cs b/ILSpy/TextView/FoldingCommands.cs
index dc8051631..c061c543e 100644
--- a/ILSpy/TextView/FoldingCommands.cs
+++ b/ILSpy/TextView/FoldingCommands.cs
@@ -16,6 +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.Linq;
using ICSharpCode.AvalonEdit;
@@ -25,6 +26,7 @@ using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy.TextView
{
[ExportContextMenuEntryAttribute(Header = nameof(Resources.ToggleFolding), Category = nameof(Resources.Folding))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
internal sealed class ToggleAllContextMenuEntry : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
@@ -61,6 +63,7 @@ namespace ICSharpCode.ILSpy.TextView
}
[ExportContextMenuEntryAttribute(Header = nameof(Resources._ToggleFolding), Category = nameof(Resources.Folding))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
internal sealed class ToggleContextMenuEntry : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
diff --git a/ILSpy/TreeNodes/AssemblyTreeNode.cs b/ILSpy/TreeNodes/AssemblyTreeNode.cs
index dc4de23bd..a92a98362 100644
--- a/ILSpy/TreeNodes/AssemblyTreeNode.cs
+++ b/ILSpy/TreeNodes/AssemblyTreeNode.cs
@@ -18,6 +18,7 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
@@ -577,6 +578,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
[ExportContextMenuEntry(Header = nameof(Resources._Remove), Icon = "images/Delete")]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class RemoveAssembly : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
@@ -603,6 +605,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
[ExportContextMenuEntry(Header = nameof(Resources._Reload), Icon = "images/Refresh")]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class ReloadAssembly : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
@@ -637,6 +640,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
[ExportContextMenuEntry(Header = nameof(Resources._LoadDependencies), Category = nameof(Resources.Dependencies))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class LoadDependencies : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
@@ -676,6 +680,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
[ExportContextMenuEntry(Header = nameof(Resources._AddMainList), Category = nameof(Resources.Dependencies))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class AddToMainList : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
@@ -710,6 +715,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
[ExportContextMenuEntry(Header = nameof(Resources._OpenContainingFolder), Category = nameof(Resources.Shell))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class OpenContainingFolder : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
@@ -762,6 +768,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
[ExportContextMenuEntry(Header = nameof(Resources._OpenCommandLineHere), Category = nameof(Resources.Shell))]
+ [PartCreationPolicy(CreationPolicy.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 b1e86026e..993c22bdf 100644
--- a/ILSpy/TreeNodes/ResourceNodes/CursorResourceEntryNode.cs
+++ b/ILSpy/TreeNodes/ResourceNodes/CursorResourceEntryNode.cs
@@ -31,6 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ICSharpCode.ILSpy.TreeNodes
{
[Export(typeof(IResourceNodeFactory))]
+ [PartCreationPolicy(CreationPolicy.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 52716233d..075aa1ca0 100644
--- a/ILSpy/TreeNodes/ResourceNodes/IconResourceEntryNode.cs
+++ b/ILSpy/TreeNodes/ResourceNodes/IconResourceEntryNode.cs
@@ -31,6 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ICSharpCode.ILSpy.TreeNodes
{
[Export(typeof(IResourceNodeFactory))]
+ [PartCreationPolicy(CreationPolicy.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 e3646c807..7a3d9c795 100644
--- a/ILSpy/TreeNodes/ResourceNodes/ImageListResourceEntryNode.cs
+++ b/ILSpy/TreeNodes/ResourceNodes/ImageListResourceEntryNode.cs
@@ -28,6 +28,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ICSharpCode.ILSpy.TreeNodes
{
[Export(typeof(IResourceNodeFactory))]
+ [PartCreationPolicy(CreationPolicy.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 719653af1..cad4098eb 100644
--- a/ILSpy/TreeNodes/ResourceNodes/ImageResourceEntryNode.cs
+++ b/ILSpy/TreeNodes/ResourceNodes/ImageResourceEntryNode.cs
@@ -31,6 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ICSharpCode.ILSpy.TreeNodes
{
[Export(typeof(IResourceNodeFactory))]
+ [PartCreationPolicy(CreationPolicy.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 5c0548f73..324390af2 100644
--- a/ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs
+++ b/ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs
@@ -38,6 +38,7 @@ using Microsoft.Win32;
namespace ICSharpCode.ILSpy.TreeNodes
{
[Export(typeof(IResourceNodeFactory))]
+ [PartCreationPolicy(CreationPolicy.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 5faa3e186..e017948df 100644
--- a/ILSpy/TreeNodes/ResourceNodes/XamlResourceNode.cs
+++ b/ILSpy/TreeNodes/ResourceNodes/XamlResourceNode.cs
@@ -31,6 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ICSharpCode.ILSpy.Xaml
{
[Export(typeof(IResourceNodeFactory))]
+ [PartCreationPolicy(CreationPolicy.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 cdc154b90..740947602 100644
--- a/ILSpy/TreeNodes/ResourceNodes/XmlResourceNode.cs
+++ b/ILSpy/TreeNodes/ResourceNodes/XmlResourceNode.cs
@@ -31,6 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ICSharpCode.ILSpy.Xaml
{
[Export(typeof(IResourceNodeFactory))]
+ [PartCreationPolicy(CreationPolicy.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 636a967f3..7f99b3afb 100644
--- a/ILSpy/TreeNodes/ThreadingSupport.cs
+++ b/ILSpy/TreeNodes/ThreadingSupport.cs
@@ -18,6 +18,7 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel.Composition;
using System.Diagnostics;
using System.Linq;
using System.Text;
@@ -171,6 +172,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
[ExportContextMenuEntry(Header = nameof(Resources.CopyErrorMessage))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
sealed class CopyErrorMessageContextMenu : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
diff --git a/ILSpy/ViewModels/AnalyzerPaneModel.cs b/ILSpy/ViewModels/AnalyzerPaneModel.cs
index a91f27e3f..557113683 100644
--- a/ILSpy/ViewModels/AnalyzerPaneModel.cs
+++ b/ILSpy/ViewModels/AnalyzerPaneModel.cs
@@ -16,17 +16,19 @@
// 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.Windows;
using System.Windows.Input;
namespace ICSharpCode.ILSpy.ViewModels
{
[ExportToolPane(ContentId = PaneContentId)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
public class AnalyzerPaneModel : ToolPaneModel
{
public const string PaneContentId = "analyzerPane";
- private AnalyzerPaneModel()
+ public AnalyzerPaneModel()
{
ContentId = PaneContentId;
Title = Properties.Resources.Analyze;
diff --git a/ILSpy/ViewModels/AssemblyListPaneModel.cs b/ILSpy/ViewModels/AssemblyListPaneModel.cs
index 38439467a..bfbc8fa02 100644
--- a/ILSpy/ViewModels/AssemblyListPaneModel.cs
+++ b/ILSpy/ViewModels/AssemblyListPaneModel.cs
@@ -16,6 +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.Windows;
using System.Windows.Input;
@@ -24,11 +25,12 @@ using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy.ViewModels
{
[ExportToolPane(ContentId = PaneContentId)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
public class AssemblyListPaneModel : ToolPaneModel
{
public const string PaneContentId = "assemblyListPane";
- private AssemblyListPaneModel()
+ public AssemblyListPaneModel()
{
Title = Resources.Assemblies;
ContentId = PaneContentId;
diff --git a/ILSpy/ViewModels/DebugStepsPaneModel.cs b/ILSpy/ViewModels/DebugStepsPaneModel.cs
index 6741f2aa5..50a169041 100644
--- a/ILSpy/ViewModels/DebugStepsPaneModel.cs
+++ b/ILSpy/ViewModels/DebugStepsPaneModel.cs
@@ -16,18 +16,20 @@
// 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.Windows;
namespace ICSharpCode.ILSpy.ViewModels
{
#if DEBUG
[ExportToolPane(ContentId = PaneContentId)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
#endif
public class DebugStepsPaneModel : ToolPaneModel
{
public const string PaneContentId = "debugStepsPane";
- private DebugStepsPaneModel()
+ public DebugStepsPaneModel()
{
ContentId = PaneContentId;
Title = Properties.Resources.DebugSteps;
diff --git a/ILSpy/ViewModels/SearchPaneModel.cs b/ILSpy/ViewModels/SearchPaneModel.cs
index 04cacb2c1..e9e0d30d5 100644
--- a/ILSpy/ViewModels/SearchPaneModel.cs
+++ b/ILSpy/ViewModels/SearchPaneModel.cs
@@ -16,17 +16,19 @@
// 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.Windows;
using System.Windows.Input;
namespace ICSharpCode.ILSpy.ViewModels
{
[ExportToolPane(ContentId = PaneContentId)]
+ [PartCreationPolicy(CreationPolicy.Shared)]
public class SearchPaneModel : ToolPaneModel
{
public const string PaneContentId = "searchPane";
- private SearchPaneModel()
+ public SearchPaneModel()
{
ContentId = PaneContentId;
Title = Properties.Resources.SearchPane_Search;
diff --git a/TestPlugin/AboutPageAddition.cs b/TestPlugin/AboutPageAddition.cs
index 71e6eb388..4088b2f92 100644
--- a/TestPlugin/AboutPageAddition.cs
+++ b/TestPlugin/AboutPageAddition.cs
@@ -11,6 +11,7 @@ using ICSharpCode.ILSpy;
namespace TestPlugin
{
[Export(typeof(IAboutPageAddition))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
public class AboutPageAddition : IAboutPageAddition
{
public void Write(ISmartTextOutput textOutput)
diff --git a/TestPlugin/ContextMenuCommand.cs b/TestPlugin/ContextMenuCommand.cs
index 9dc672fe5..dad7dc3f6 100644
--- a/TestPlugin/ContextMenuCommand.cs
+++ b/TestPlugin/ContextMenuCommand.cs
@@ -1,6 +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.Linq;
using ICSharpCode.ILSpy;
@@ -9,6 +10,7 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace TestPlugin
{
[ExportContextMenuEntryAttribute(Header = "_Save Assembly")]
+ [PartCreationPolicy(CreationPolicy.Shared)]
public class SaveAssembly : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
diff --git a/TestPlugin/CustomLanguage.cs b/TestPlugin/CustomLanguage.cs
index e41ea015e..7e38fdffe 100644
--- a/TestPlugin/CustomLanguage.cs
+++ b/TestPlugin/CustomLanguage.cs
@@ -15,6 +15,7 @@ namespace TestPlugin
/// Adds a new language to the decompiler.
///
[Export(typeof(Language))]
+ [PartCreationPolicy(CreationPolicy.Shared)]
public class CustomLanguage : Language
{
public override string Name {
diff --git a/TestPlugin/CustomOptionPage.xaml.cs b/TestPlugin/CustomOptionPage.xaml.cs
index 86adf9495..9c38af296 100644
--- a/TestPlugin/CustomOptionPage.xaml.cs
+++ b/TestPlugin/CustomOptionPage.xaml.cs
@@ -2,6 +2,7 @@
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System.ComponentModel;
+using System.ComponentModel.Composition;
using System.Windows.Controls;
using System.Xml.Linq;
@@ -12,6 +13,7 @@ using ICSharpCode.ILSpyX.Settings;
namespace TestPlugin
{
[ExportOptionPage(Title = "TestPlugin", Order = 0)]
+ [PartCreationPolicy(CreationPolicy.NonShared)]
partial class CustomOptionPage : UserControl, IOptionPage
{
static readonly XNamespace ns = "http://www.ilspy.net/testplugin";
diff --git a/TestPlugin/MainMenuCommand.cs b/TestPlugin/MainMenuCommand.cs
index 501d43b1b..bb4a041f8 100644
--- a/TestPlugin/MainMenuCommand.cs
+++ b/TestPlugin/MainMenuCommand.cs
@@ -1,6 +1,8 @@
// 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 ICSharpCode.ILSpy;
namespace TestPlugin
@@ -16,6 +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)]
public class UnloadAllAssembliesCommand : SimpleCommand
{
public override void Execute(object parameter)