Browse Source

Annotate service lifetime explicitly.

pull/3257/head
tom-englert 1 year ago
parent
commit
610b0c2ed5
  1. 7
      .editorconfig
  2. 6
      Directory.Packages.props
  3. 1
      ICSharpCode.Decompiler/ICSharpCode.Decompiler.ruleset
  4. 2
      ICSharpCode.ILSpyX/Analyzers/Builtin/AttributeAppliedToAnalyzer.cs
  5. 2
      ICSharpCode.ILSpyX/Analyzers/Builtin/EventImplementedByAnalyzer.cs
  6. 2
      ICSharpCode.ILSpyX/Analyzers/Builtin/EventOverriddenByAnalyzer.cs
  7. 3
      ICSharpCode.ILSpyX/Analyzers/Builtin/FieldAccessAnalyzer.cs
  8. 2
      ICSharpCode.ILSpyX/Analyzers/Builtin/MemberImplementsInterfaceAnalyzer.cs
  9. 2
      ICSharpCode.ILSpyX/Analyzers/Builtin/MethodImplementedByAnalyzer.cs
  10. 2
      ICSharpCode.ILSpyX/Analyzers/Builtin/MethodOverriddenByAnalyzer.cs
  11. 2
      ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsedByAnalyzer.cs
  12. 2
      ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsesAnalyzer.cs
  13. 2
      ICSharpCode.ILSpyX/Analyzers/Builtin/MethodVirtualUsedByAnalyzer.cs
  14. 2
      ICSharpCode.ILSpyX/Analyzers/Builtin/PropertyImplementedByAnalyzer.cs
  15. 2
      ICSharpCode.ILSpyX/Analyzers/Builtin/PropertyOverriddenByAnalyzer.cs
  16. 3
      ICSharpCode.ILSpyX/Analyzers/Builtin/TypeExposedByAnalyzer.cs
  17. 2
      ICSharpCode.ILSpyX/Analyzers/Builtin/TypeExtensionMethodsAnalyzer.cs
  18. 2
      ICSharpCode.ILSpyX/Analyzers/Builtin/TypeInstantiatedByAnalyzer.cs
  19. 2
      ICSharpCode.ILSpyX/Analyzers/Builtin/TypeUsedByAnalyzer.cs
  20. 2
      ILSpy.BamlDecompiler/BamlResourceNodeFactory.cs
  21. 1
      ILSpy.ReadyToRun/ReadyToRunLanguage.cs
  22. 2
      ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml.cs
  23. 2
      ILSpy/AboutPage.cs
  24. 2
      ILSpy/Analyzers/AnalyzeCommand.cs
  25. 2
      ILSpy/Analyzers/CopyAnalysisResultsContextMenuEntry.cs
  26. 2
      ILSpy/Analyzers/RemoveAnalyzeContextMenuEntry.cs
  27. 2
      ILSpy/Commands/BrowseBackCommand.cs
  28. 2
      ILSpy/Commands/BrowseForwardCommand.cs
  29. 3
      ILSpy/Commands/CheckForUpdatesCommand.cs
  30. 2
      ILSpy/Commands/CopyFullyQualifiedNameContextMenuEntry.cs
  31. 3
      ILSpy/Commands/DecompileAllCommand.cs
  32. 2
      ILSpy/Commands/DecompileCommand.cs
  33. 2
      ILSpy/Commands/DecompileInNewViewCommand.cs
  34. 2
      ILSpy/Commands/DisassembleAllCommand.cs
  35. 3
      ILSpy/Commands/ExitCommand.cs
  36. 2
      ILSpy/Commands/ExtractPackageEntryContextMenuEntry.cs
  37. 3
      ILSpy/Commands/GeneratePdbContextMenuEntry.cs
  38. 3
      ILSpy/Commands/ManageAssemblyListsCommand.cs
  39. 2
      ILSpy/Commands/OpenCommand.cs
  40. 3
      ILSpy/Commands/OpenFromGacCommand.cs
  41. 3
      ILSpy/Commands/Pdb2XmlCommand.cs
  42. 2
      ILSpy/Commands/RefreshCommand.cs
  43. 3
      ILSpy/Commands/RemoveAssembliesWithLoadErrors.cs
  44. 2
      ILSpy/Commands/SaveCodeContextMenuEntry.cs
  45. 2
      ILSpy/Commands/SaveCommand.cs
  46. 2
      ILSpy/Commands/ScopeSearchToAssembly.cs
  47. 2
      ILSpy/Commands/ScopeSearchToNamespace.cs
  48. 3
      ILSpy/Commands/SearchMsdnContextMenuEntry.cs
  49. 2
      ILSpy/Commands/SelectPdbContextMenuEntry.cs
  50. 2
      ILSpy/Commands/ShowCFGContextMenuEntry.cs
  51. 3
      ILSpy/Commands/SortAssemblyListCommand.cs
  52. 3
      ILSpy/Docking/CloseAllDocumentsCommand.cs
  53. 7
      ILSpy/ExportProviderAdapter.cs
  54. 5
      ILSpy/ILSpy.csproj
  55. 1
      ILSpy/Languages/CSharpILMixedLanguage.cs
  56. 1
      ILSpy/Languages/CSharpLanguage.cs
  57. 1
      ILSpy/Languages/ILLanguage.cs
  58. 3
      ILSpy/Metadata/GoToTokenCommand.cs
  59. 1
      ILSpy/Metadata/MetadataProtocolHandler.cs
  60. 2
      ILSpy/Options/DecompilerSettingsPanel.xaml.cs
  61. 2
      ILSpy/Options/DisplaySettingsPanel.xaml.cs
  62. 2
      ILSpy/Options/MiscSettingsPanel.xaml.cs
  63. 1
      ILSpy/Options/OptionsDialog.xaml.cs
  64. 2
      ILSpy/Search/SearchPane.cs
  65. 4
      ILSpy/TextView/EditorCommands.cs
  66. 3
      ILSpy/TextView/FoldingCommands.cs
  67. 7
      ILSpy/TreeNodes/AssemblyTreeNode.cs
  68. 1
      ILSpy/TreeNodes/ResourceNodes/CursorResourceEntryNode.cs
  69. 1
      ILSpy/TreeNodes/ResourceNodes/IconResourceEntryNode.cs
  70. 1
      ILSpy/TreeNodes/ResourceNodes/ImageListResourceEntryNode.cs
  71. 1
      ILSpy/TreeNodes/ResourceNodes/ImageResourceEntryNode.cs
  72. 1
      ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs
  73. 1
      ILSpy/TreeNodes/ResourceNodes/XamlResourceNode.cs
  74. 1
      ILSpy/TreeNodes/ResourceNodes/XmlResourceNode.cs
  75. 2
      ILSpy/TreeNodes/ThreadingSupport.cs
  76. 4
      ILSpy/ViewModels/AnalyzerPaneModel.cs
  77. 4
      ILSpy/ViewModels/AssemblyListPaneModel.cs
  78. 4
      ILSpy/ViewModels/DebugStepsPaneModel.cs
  79. 4
      ILSpy/ViewModels/SearchPaneModel.cs
  80. 1
      TestPlugin/AboutPageAddition.cs
  81. 2
      TestPlugin/ContextMenuCommand.cs
  82. 1
      TestPlugin/CustomLanguage.cs
  83. 2
      TestPlugin/CustomOptionPage.xaml.cs
  84. 3
      TestPlugin/MainMenuCommand.cs

7
.editorconfig

@ -12,7 +12,7 @@ indent_size = 2
[*.{yml,yaml}] [*.{yml,yaml}]
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
[*.csproj] [*.{csproj,props}]
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
[*.config] [*.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_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false csharp_space_between_square_brackets = false
# Errors and warnings
# MEF006: No importing constructor
dotnet_diagnostic.MEF006.severity = silent

6
Directory.Packages.props

@ -45,9 +45,11 @@
<PackageVersion Include="System.Reflection.Metadata" Version="8.0.0" /> <PackageVersion Include="System.Reflection.Metadata" Version="8.0.0" />
<PackageVersion Include="System.Resources.Extensions" Version="8.0.0" /> <PackageVersion Include="System.Resources.Extensions" Version="8.0.0" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" /> <PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageVersion Include="TomsToolbox.Composition.Analyzer" Version="2.18.1" />
<PackageVersion Include="TomsToolbox.Wpf.Composition" Version="2.18.1" /> <PackageVersion Include="TomsToolbox.Wpf.Composition" Version="2.18.1" />
<PackageVersion Include="TomsToolbox.Wpf.Styles" Version="2.18.1" /> <PackageVersion Include="TomsToolbox.Wpf.Styles" Version="2.18.1" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" /> <PackageVersion Include="coverlet.collector" Version="6.0.2" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Include="TomsToolbox.Composition.Analyzer" Version="2.18.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

1
ICSharpCode.Decompiler/ICSharpCode.Decompiler.ruleset

@ -80,7 +80,6 @@
<Rule Id="RECS0001" Action="Info" /> <Rule Id="RECS0001" Action="Info" />
</Rules> </Rules>
<Rules AnalyzerId="TomsToolbox.Composition.Analyzer" RuleNamespace="TomsToolbox.Composition.Analyzer"> <Rules AnalyzerId="TomsToolbox.Composition.Analyzer" RuleNamespace="TomsToolbox.Composition.Analyzer">
<Rule Id="MEF001" Action="Info" />
<Rule Id="MEF006" Action="Hidden" /> <Rule Id="MEF006" Action="Hidden" />
</Rules> </Rules>
</RuleSet> </RuleSet>

2
ICSharpCode.ILSpyX/Analyzers/Builtin/AttributeAppliedToAnalyzer.cs

@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq; using System.Linq;
using System.Reflection.Metadata; using System.Reflection.Metadata;
using System.Threading; using System.Threading;
@ -29,6 +30,7 @@ using ICSharpCode.Decompiler.Util;
namespace ICSharpCode.ILSpyX.Analyzers.Builtin namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{ {
[ExportAnalyzer(Header = "Applied To", Order = 10)] [ExportAnalyzer(Header = "Applied To", Order = 10)]
[PartCreationPolicy(CreationPolicy.Shared)]
class AttributeAppliedToAnalyzer : IAnalyzer class AttributeAppliedToAnalyzer : IAnalyzer
{ {
public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context) public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context)

2
ICSharpCode.ILSpyX/Analyzers/Builtin/EventImplementedByAnalyzer.cs

@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
@ -28,6 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows events that implement an interface event. /// Shows events that implement an interface event.
/// </summary> /// </summary>
[ExportAnalyzer(Header = "Implemented By", Order = 10)] [ExportAnalyzer(Header = "Implemented By", Order = 10)]
[PartCreationPolicy(CreationPolicy.Shared)]
class EventImplementedByAnalyzer : IAnalyzer class EventImplementedByAnalyzer : IAnalyzer
{ {
public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context) public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context)

2
ICSharpCode.ILSpyX/Analyzers/Builtin/EventOverriddenByAnalyzer.cs

@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
@ -28,6 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows events that override an event. /// Shows events that override an event.
/// </summary> /// </summary>
[ExportAnalyzer(Header = "Overridden By", Order = 20)] [ExportAnalyzer(Header = "Overridden By", Order = 20)]
[PartCreationPolicy(CreationPolicy.Shared)]
class EventOverriddenByAnalyzer : IAnalyzer class EventOverriddenByAnalyzer : IAnalyzer
{ {
public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context) public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context)

3
ICSharpCode.ILSpyX/Analyzers/Builtin/FieldAccessAnalyzer.cs

@ -18,6 +18,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Reflection.Metadata; using System.Reflection.Metadata;
@ -35,6 +36,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Finds methods where this field is read. /// Finds methods where this field is read.
/// </summary> /// </summary>
[ExportAnalyzer(Header = "Assigned By", Order = 20)] [ExportAnalyzer(Header = "Assigned By", Order = 20)]
[PartCreationPolicy(CreationPolicy.Shared)]
class AssignedByFieldAccessAnalyzer : FieldAccessAnalyzer class AssignedByFieldAccessAnalyzer : FieldAccessAnalyzer
{ {
public AssignedByFieldAccessAnalyzer() : base(true) { } public AssignedByFieldAccessAnalyzer() : base(true) { }
@ -44,6 +46,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Finds methods where this field is written. /// Finds methods where this field is written.
/// </summary> /// </summary>
[ExportAnalyzer(Header = "Read By", Order = 10)] [ExportAnalyzer(Header = "Read By", Order = 10)]
[PartCreationPolicy(CreationPolicy.Shared)]
class ReadByFieldAccessAnalyzer : FieldAccessAnalyzer class ReadByFieldAccessAnalyzer : FieldAccessAnalyzer
{ {
public ReadByFieldAccessAnalyzer() : base(false) { } public ReadByFieldAccessAnalyzer() : base(false) { }

2
ICSharpCode.ILSpyX/Analyzers/Builtin/MemberImplementsInterfaceAnalyzer.cs

@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
@ -28,6 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows members from all corresponding interfaces the selected member implements. /// Shows members from all corresponding interfaces the selected member implements.
/// </summary> /// </summary>
[ExportAnalyzer(Header = "Implements", Order = 40)] [ExportAnalyzer(Header = "Implements", Order = 40)]
[PartCreationPolicy(CreationPolicy.Shared)]
class MemberImplementsInterfaceAnalyzer : IAnalyzer class MemberImplementsInterfaceAnalyzer : IAnalyzer
{ {
public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context) public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context)

2
ICSharpCode.ILSpyX/Analyzers/Builtin/MethodImplementedByAnalyzer.cs

@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
@ -28,6 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows methods that implement an interface method. /// Shows methods that implement an interface method.
/// </summary> /// </summary>
[ExportAnalyzer(Header = "Implemented By", Order = 40)] [ExportAnalyzer(Header = "Implemented By", Order = 40)]
[PartCreationPolicy(CreationPolicy.Shared)]
class MethodImplementedByAnalyzer : IAnalyzer class MethodImplementedByAnalyzer : IAnalyzer
{ {
public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context) public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context)

2
ICSharpCode.ILSpyX/Analyzers/Builtin/MethodOverriddenByAnalyzer.cs

@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
@ -28,6 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows methods that override a method. /// Shows methods that override a method.
/// </summary> /// </summary>
[ExportAnalyzer(Header = "Overridden By", Order = 30)] [ExportAnalyzer(Header = "Overridden By", Order = 30)]
[PartCreationPolicy(CreationPolicy.Shared)]
class MethodOverriddenByAnalyzer : IAnalyzer class MethodOverriddenByAnalyzer : IAnalyzer
{ {
const GetMemberOptions Options = GetMemberOptions.IgnoreInheritedMembers | GetMemberOptions.ReturnMemberDefinitions; const GetMemberOptions Options = GetMemberOptions.IgnoreInheritedMembers | GetMemberOptions.ReturnMemberDefinitions;

2
ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsedByAnalyzer.cs

@ -18,6 +18,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Reflection.Metadata; using System.Reflection.Metadata;
@ -32,6 +33,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows entities that are used by a method. /// Shows entities that are used by a method.
/// </summary> /// </summary>
[ExportAnalyzer(Header = "Used By", Order = 20)] [ExportAnalyzer(Header = "Used By", Order = 20)]
[PartCreationPolicy(CreationPolicy.Shared)]
class MethodUsedByAnalyzer : IAnalyzer class MethodUsedByAnalyzer : IAnalyzer
{ {
const GetMemberOptions Options = GetMemberOptions.IgnoreInheritedMembers | GetMemberOptions.ReturnMemberDefinitions; const GetMemberOptions Options = GetMemberOptions.IgnoreInheritedMembers | GetMemberOptions.ReturnMemberDefinitions;

2
ICSharpCode.ILSpyX/Analyzers/Builtin/MethodUsesAnalyzer.cs

@ -18,6 +18,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq; using System.Linq;
using System.Reflection.Metadata; using System.Reflection.Metadata;
@ -32,6 +33,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows entities that are used by a method. /// Shows entities that are used by a method.
/// </summary> /// </summary>
[ExportAnalyzer(Header = "Uses", Order = 10)] [ExportAnalyzer(Header = "Uses", Order = 10)]
[PartCreationPolicy(CreationPolicy.Shared)]
class MethodUsesAnalyzer : IAnalyzer class MethodUsesAnalyzer : IAnalyzer
{ {
public bool Show(ISymbol symbol) => symbol is IMethod method && method.HasBody; public bool Show(ISymbol symbol) => symbol is IMethod method && method.HasBody;

2
ICSharpCode.ILSpyX/Analyzers/Builtin/MethodVirtualUsedByAnalyzer.cs

@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Reflection.Metadata; using System.Reflection.Metadata;
@ -31,6 +32,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows entities that are used by a method. /// Shows entities that are used by a method.
/// </summary> /// </summary>
[ExportAnalyzer(Header = "Used By", Order = 20)] [ExportAnalyzer(Header = "Used By", Order = 20)]
[PartCreationPolicy(CreationPolicy.Shared)]
class MethodVirtualUsedByAnalyzer : IAnalyzer class MethodVirtualUsedByAnalyzer : IAnalyzer
{ {
const GetMemberOptions Options = GetMemberOptions.IgnoreInheritedMembers | GetMemberOptions.ReturnMemberDefinitions; const GetMemberOptions Options = GetMemberOptions.IgnoreInheritedMembers | GetMemberOptions.ReturnMemberDefinitions;

2
ICSharpCode.ILSpyX/Analyzers/Builtin/PropertyImplementedByAnalyzer.cs

@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
@ -28,6 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows properties that implement an interface property. /// Shows properties that implement an interface property.
/// </summary> /// </summary>
[ExportAnalyzer(Header = "Implemented By", Order = 10)] [ExportAnalyzer(Header = "Implemented By", Order = 10)]
[PartCreationPolicy(CreationPolicy.Shared)]
class PropertyImplementedByAnalyzer : IAnalyzer class PropertyImplementedByAnalyzer : IAnalyzer
{ {
public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context) public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context)

2
ICSharpCode.ILSpyX/Analyzers/Builtin/PropertyOverriddenByAnalyzer.cs

@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
@ -28,6 +29,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows properties that override a property. /// Shows properties that override a property.
/// </summary> /// </summary>
[ExportAnalyzer(Header = "Overridden By", Order = 20)] [ExportAnalyzer(Header = "Overridden By", Order = 20)]
[PartCreationPolicy(CreationPolicy.Shared)]
class PropertyOverriddenByAnalyzer : IAnalyzer class PropertyOverriddenByAnalyzer : IAnalyzer
{ {
public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context) public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context)

3
ICSharpCode.ILSpyX/Analyzers/Builtin/TypeExposedByAnalyzer.cs

@ -22,12 +22,15 @@ using System.Diagnostics;
namespace ICSharpCode.ILSpyX.Analyzers.Builtin namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{ {
using System.ComponentModel.Composition;
using ICSharpCode.Decompiler.TypeSystem; using ICSharpCode.Decompiler.TypeSystem;
/// <summary> /// <summary>
/// Finds all entities that expose a type. /// Finds all entities that expose a type.
/// </summary> /// </summary>
[ExportAnalyzer(Header = "Exposed By", Order = 40)] [ExportAnalyzer(Header = "Exposed By", Order = 40)]
[PartCreationPolicy(CreationPolicy.Shared)]
class TypeExposedByAnalyzer : IAnalyzer class TypeExposedByAnalyzer : IAnalyzer
{ {
public bool Show(ISymbol entity) => entity is ITypeDefinition; public bool Show(ISymbol entity) => entity is ITypeDefinition;

2
ICSharpCode.ILSpyX/Analyzers/Builtin/TypeExtensionMethodsAnalyzer.cs

@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using ICSharpCode.Decompiler.TypeSystem; using ICSharpCode.Decompiler.TypeSystem;
@ -27,6 +28,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Finds all extension methods defined for a type. /// Finds all extension methods defined for a type.
/// </summary> /// </summary>
[ExportAnalyzer(Header = "Extension Methods", Order = 50)] [ExportAnalyzer(Header = "Extension Methods", Order = 50)]
[PartCreationPolicy(CreationPolicy.Shared)]
class TypeExtensionMethodsAnalyzer : IAnalyzer class TypeExtensionMethodsAnalyzer : IAnalyzer
{ {
public bool Show(ISymbol symbol) => symbol is ITypeDefinition entity && !entity.IsStatic; public bool Show(ISymbol symbol) => symbol is ITypeDefinition entity && !entity.IsStatic;

2
ICSharpCode.ILSpyX/Analyzers/Builtin/TypeInstantiatedByAnalyzer.cs

@ -18,6 +18,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Reflection.Metadata; using System.Reflection.Metadata;
@ -33,6 +34,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows methods that instantiate a type. /// Shows methods that instantiate a type.
/// </summary> /// </summary>
[ExportAnalyzer(Header = "Instantiated By", Order = 20)] [ExportAnalyzer(Header = "Instantiated By", Order = 20)]
[PartCreationPolicy(CreationPolicy.Shared)]
class TypeInstantiatedByAnalyzer : IAnalyzer class TypeInstantiatedByAnalyzer : IAnalyzer
{ {
const GetMemberOptions Options = GetMemberOptions.IgnoreInheritedMembers | GetMemberOptions.ReturnMemberDefinitions; const GetMemberOptions Options = GetMemberOptions.IgnoreInheritedMembers | GetMemberOptions.ReturnMemberDefinitions;

2
ICSharpCode.ILSpyX/Analyzers/Builtin/TypeUsedByAnalyzer.cs

@ -19,6 +19,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Immutable; using System.Collections.Immutable;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Reflection.Metadata; using System.Reflection.Metadata;
@ -34,6 +35,7 @@ namespace ICSharpCode.ILSpyX.Analyzers.Builtin
/// Shows entities that use a type. /// Shows entities that use a type.
/// </summary> /// </summary>
[ExportAnalyzer(Header = "Used By", Order = 30)] [ExportAnalyzer(Header = "Used By", Order = 30)]
[PartCreationPolicy(CreationPolicy.Shared)]
class TypeUsedByAnalyzer : IAnalyzer class TypeUsedByAnalyzer : IAnalyzer
{ {
public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context) public IEnumerable<ISymbol> Analyze(ISymbol analyzedSymbol, AnalyzerContext context)

2
ILSpy.BamlDecompiler/BamlResourceNodeFactory.cs

@ -32,6 +32,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ILSpy.BamlDecompiler namespace ILSpy.BamlDecompiler
{ {
[Export(typeof(IResourceNodeFactory))] [Export(typeof(IResourceNodeFactory))]
[PartCreationPolicy(CreationPolicy.Shared)]
public sealed class BamlResourceNodeFactory : IResourceNodeFactory public sealed class BamlResourceNodeFactory : IResourceNodeFactory
{ {
public ITreeNode CreateNode(Resource resource) public ITreeNode CreateNode(Resource resource)
@ -44,6 +45,7 @@ namespace ILSpy.BamlDecompiler
} }
[Export(typeof(IResourceFileHandler))] [Export(typeof(IResourceFileHandler))]
[PartCreationPolicy(CreationPolicy.Shared)]
public sealed class BamlResourceFileHandler : IResourceFileHandler public sealed class BamlResourceFileHandler : IResourceFileHandler
{ {
public string EntryType => "Page"; public string EntryType => "Page";

1
ILSpy.ReadyToRun/ReadyToRunLanguage.cs

@ -95,6 +95,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun
#endif #endif
[Export(typeof(Language))] [Export(typeof(Language))]
[PartCreationPolicy(CreationPolicy.Shared)]
internal class ReadyToRunLanguage : Language internal class ReadyToRunLanguage : Language
{ {
private static readonly ConditionalWeakTable<MetadataFile, ReadyToRunReaderCacheEntry> readyToRunReaders = new ConditionalWeakTable<MetadataFile, ReadyToRunReaderCacheEntry>(); private static readonly ConditionalWeakTable<MetadataFile, ReadyToRunReaderCacheEntry> readyToRunReaders = new ConditionalWeakTable<MetadataFile, ReadyToRunReaderCacheEntry>();

2
ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml.cs

@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel; using System.ComponentModel;
using System.ComponentModel.Composition;
using System.Windows.Controls; using System.Windows.Controls;
using System.Xml.Linq; using System.Xml.Linq;
@ -26,6 +27,7 @@ using ICSharpCode.ILSpyX.Settings;
namespace ICSharpCode.ILSpy.ReadyToRun namespace ICSharpCode.ILSpy.ReadyToRun
{ {
[ExportOptionPage(Title = nameof(global::ILSpy.ReadyToRun.Properties.Resources.ReadyToRun), Order = 40)] [ExportOptionPage(Title = nameof(global::ILSpy.ReadyToRun.Properties.Resources.ReadyToRun), Order = 40)]
[PartCreationPolicy(CreationPolicy.NonShared)]
partial class ReadyToRunOptionPage : UserControl, IOptionPage partial class ReadyToRunOptionPage : UserControl, IOptionPage
{ {
public ReadyToRunOptionPage() public ReadyToRunOptionPage()

2
ILSpy/AboutPage.cs

@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System; using System;
using System.ComponentModel.Composition;
using System.IO; using System.IO;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows; using System.Windows;
@ -36,6 +37,7 @@ using ICSharpCode.ILSpyX.Settings;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._Help), Header = nameof(Resources._About), MenuOrder = 99999)] [ExportMainMenuCommand(ParentMenuID = nameof(Resources._Help), Header = nameof(Resources._About), MenuOrder = 99999)]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class AboutPage : SimpleCommand sealed class AboutPage : SimpleCommand
{ {
public override void Execute(object parameter) public override void Execute(object parameter)

2
ILSpy/Analyzers/AnalyzeCommand.cs

@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System; using System;
using System.ComponentModel.Composition;
using System.Linq; using System.Linq;
using ICSharpCode.Decompiler.Metadata; using ICSharpCode.Decompiler.Metadata;
@ -27,6 +28,7 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy.Analyzers namespace ICSharpCode.ILSpy.Analyzers
{ {
[ExportContextMenuEntry(Header = nameof(Resources.Analyze), Icon = "Images/Search", Category = nameof(Resources.Analyze), InputGestureText = "Ctrl+R", Order = 100)] [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 internal sealed class AnalyzeCommand : SimpleCommand, IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)

2
ILSpy/Analyzers/CopyAnalysisResultsContextMenuEntry.cs

@ -16,6 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Windows; using System.Windows;
@ -23,6 +24,7 @@ using System.Windows;
namespace ICSharpCode.ILSpy.Analyzers namespace ICSharpCode.ILSpy.Analyzers
{ {
[ExportContextMenuEntry(Header = "Copy results", Category = "Analyze", Order = 200)] [ExportContextMenuEntry(Header = "Copy results", Category = "Analyze", Order = 200)]
[PartCreationPolicy(CreationPolicy.Shared)]
internal sealed class CopyAnalysisResultsContextMenuEntry : IContextMenuEntry internal sealed class CopyAnalysisResultsContextMenuEntry : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)

2
ILSpy/Analyzers/RemoveAnalyzeContextMenuEntry.cs

@ -16,11 +16,13 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Linq; using System.Linq;
namespace ICSharpCode.ILSpy.Analyzers namespace ICSharpCode.ILSpy.Analyzers
{ {
[ExportContextMenuEntry(Header = "Remove", Icon = "images/Delete", Category = "Analyze", Order = 200)] [ExportContextMenuEntry(Header = "Remove", Icon = "images/Delete", Category = "Analyze", Order = 200)]
[PartCreationPolicy(CreationPolicy.Shared)]
internal sealed class RemoveAnalyzeContextMenuEntry : IContextMenuEntry internal sealed class RemoveAnalyzeContextMenuEntry : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)

2
ILSpy/Commands/BrowseBackCommand.cs

@ -16,6 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Windows.Input; using System.Windows.Input;
using ICSharpCode.ILSpy.Properties; using ICSharpCode.ILSpy.Properties;
@ -23,6 +24,7 @@ using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
[ExportToolbarCommand(ToolTip = nameof(Resources.Back), ToolbarIcon = "Images/Back", ToolbarCategory = nameof(Resources.Navigation), ToolbarOrder = 0)] [ExportToolbarCommand(ToolTip = nameof(Resources.Back), ToolbarIcon = "Images/Back", ToolbarCategory = nameof(Resources.Navigation), ToolbarOrder = 0)]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class BrowseBackCommand : CommandWrapper sealed class BrowseBackCommand : CommandWrapper
{ {
public BrowseBackCommand() public BrowseBackCommand()

2
ILSpy/Commands/BrowseForwardCommand.cs

@ -16,6 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Windows.Input; using System.Windows.Input;
using ICSharpCode.ILSpy.Properties; using ICSharpCode.ILSpy.Properties;
@ -23,6 +24,7 @@ using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
[ExportToolbarCommand(ToolTip = nameof(Resources.Forward), ToolbarIcon = "Images/Forward", ToolbarCategory = nameof(Resources.Navigation), ToolbarOrder = 1)] [ExportToolbarCommand(ToolTip = nameof(Resources.Forward), ToolbarIcon = "Images/Forward", ToolbarCategory = nameof(Resources.Navigation), ToolbarOrder = 1)]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class BrowseForwardCommand : CommandWrapper sealed class BrowseForwardCommand : CommandWrapper
{ {
public BrowseForwardCommand() public BrowseForwardCommand()

3
ILSpy/Commands/CheckForUpdatesCommand.cs

@ -17,12 +17,15 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using ICSharpCode.ILSpy.Properties; using ICSharpCode.ILSpy.Properties;
using ICSharpCode.ILSpyX.Settings; using ICSharpCode.ILSpyX.Settings;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._Help), Header = nameof(Resources._CheckUpdates), MenuOrder = 5000)] [ExportMainMenuCommand(ParentMenuID = nameof(Resources._Help), Header = nameof(Resources._CheckUpdates), MenuOrder = 5000)]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class CheckForUpdatesCommand : SimpleCommand sealed class CheckForUpdatesCommand : SimpleCommand
{ {
public override bool CanExecute(object parameter) public override bool CanExecute(object parameter)

2
ILSpy/Commands/CopyFullyQualifiedNameContextMenuEntry.cs

@ -15,6 +15,7 @@
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // 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 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Windows; using System.Windows;
using ICSharpCode.ILSpy.Properties; using ICSharpCode.ILSpy.Properties;
@ -23,6 +24,7 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
[ExportContextMenuEntry(Header = nameof(Resources.CopyName), Icon = "images/Copy", Order = 9999)] [ExportContextMenuEntry(Header = nameof(Resources.CopyName), Icon = "images/Copy", Order = 9999)]
[PartCreationPolicy(CreationPolicy.Shared)]
public class CopyFullyQualifiedNameContextMenuEntry : IContextMenuEntry public class CopyFullyQualifiedNameContextMenuEntry : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)

3
ILSpy/Commands/DecompileAllCommand.cs

@ -20,6 +20,7 @@
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -34,6 +35,7 @@ using TomsToolbox.Essentials;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.DEBUGDecompile), MenuCategory = nameof(Resources.Open), MenuOrder = 2.5)] [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.DEBUGDecompile), MenuCategory = nameof(Resources.Open), MenuOrder = 2.5)]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class DecompileAllCommand : SimpleCommand sealed class DecompileAllCommand : SimpleCommand
{ {
public override bool CanExecute(object parameter) 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)] [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.DEBUGDecompile100x), MenuCategory = nameof(Resources.Open), MenuOrder = 2.6)]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class Decompile100TimesCommand : SimpleCommand sealed class Decompile100TimesCommand : SimpleCommand
{ {
public override void Execute(object parameter) public override void Execute(object parameter)

2
ILSpy/Commands/DecompileCommand.cs

@ -16,6 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Linq; using System.Linq;
using ICSharpCode.Decompiler.TypeSystem; using ICSharpCode.Decompiler.TypeSystem;
@ -25,6 +26,7 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy.Commands namespace ICSharpCode.ILSpy.Commands
{ {
[ExportContextMenuEntry(Header = nameof(Resources.Decompile), Order = 10)] [ExportContextMenuEntry(Header = nameof(Resources.Decompile), Order = 10)]
[PartCreationPolicy(CreationPolicy.Shared)]
class DecompileCommand : IContextMenuEntry class DecompileCommand : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)

2
ILSpy/Commands/DecompileInNewViewCommand.cs

@ -18,6 +18,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq; using System.Linq;
using System.Windows.Threading; using System.Windows.Threading;
@ -30,6 +31,7 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy.Commands namespace ICSharpCode.ILSpy.Commands
{ {
[ExportContextMenuEntry(Header = nameof(Resources.DecompileToNewPanel), InputGestureText = "MMB", Icon = "images/Search", Category = nameof(Resources.Analyze), Order = 90)] [ExportContextMenuEntry(Header = nameof(Resources.DecompileToNewPanel), InputGestureText = "MMB", Icon = "images/Search", Category = nameof(Resources.Analyze), Order = 90)]
[PartCreationPolicy(CreationPolicy.Shared)]
internal sealed class DecompileInNewViewCommand : IContextMenuEntry internal sealed class DecompileInNewViewCommand : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)

2
ILSpy/Commands/DisassembleAllCommand.cs

@ -20,6 +20,7 @@
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -30,6 +31,7 @@ using ICSharpCode.ILSpyX;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.DEBUGDisassemble), MenuCategory = nameof(Resources.Open), MenuOrder = 2.5)] [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.DEBUGDisassemble), MenuCategory = nameof(Resources.Open), MenuOrder = 2.5)]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class DisassembleAllCommand : SimpleCommand sealed class DisassembleAllCommand : SimpleCommand
{ {
public override bool CanExecute(object parameter) public override bool CanExecute(object parameter)

3
ILSpy/Commands/ExitCommand.cs

@ -15,11 +15,14 @@
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // 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 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using ICSharpCode.ILSpy.Properties; using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.E_xit), MenuOrder = 99999, MenuCategory = nameof(Resources.Exit))] [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.E_xit), MenuOrder = 99999, MenuCategory = nameof(Resources.Exit))]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class ExitCommand : SimpleCommand sealed class ExitCommand : SimpleCommand
{ {
public override void Execute(object parameter) public override void Execute(object parameter)

2
ILSpy/Commands/ExtractPackageEntryContextMenuEntry.cs

@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System; using System;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -34,6 +35,7 @@ using Microsoft.Win32;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
[ExportContextMenuEntry(Header = nameof(Resources.ExtractPackageEntry), Category = nameof(Resources.Save), Icon = "Images/Save")] [ExportContextMenuEntry(Header = nameof(Resources.ExtractPackageEntry), Category = nameof(Resources.Save), Icon = "Images/Save")]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class ExtractPackageEntryContextMenuEntry : IContextMenuEntry sealed class ExtractPackageEntryContextMenuEntry : IContextMenuEntry
{ {
public void Execute(TextViewContext context) public void Execute(TextViewContext context)

3
ILSpy/Commands/GeneratePdbContextMenuEntry.cs

@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System; using System;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -38,6 +39,7 @@ using Microsoft.Win32;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
[ExportContextMenuEntry(Header = nameof(Resources.GeneratePortable))] [ExportContextMenuEntry(Header = nameof(Resources.GeneratePortable))]
[PartCreationPolicy(CreationPolicy.Shared)]
class GeneratePdbContextMenuEntry : IContextMenuEntry class GeneratePdbContextMenuEntry : IContextMenuEntry
{ {
public void Execute(TextViewContext context) 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))] [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.GeneratePortable), MenuCategory = nameof(Resources.Save))]
[PartCreationPolicy(CreationPolicy.Shared)]
class GeneratePdbMainMenuEntry : SimpleCommand class GeneratePdbMainMenuEntry : SimpleCommand
{ {
public override bool CanExecute(object parameter) public override bool CanExecute(object parameter)

3
ILSpy/Commands/ManageAssemblyListsCommand.cs

@ -17,11 +17,14 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using ICSharpCode.ILSpy.Properties; using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.ManageAssembly_Lists), MenuIcon = "Images/AssemblyList", MenuCategory = nameof(Resources.Open), MenuOrder = 1.7)] [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 sealed class ManageAssemblyListsCommand : SimpleCommand
{ {
public override void Execute(object parameter) public override void Execute(object parameter)

2
ILSpy/Commands/OpenCommand.cs

@ -16,6 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Windows.Input; using System.Windows.Input;
using ICSharpCode.ILSpy.Properties; 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)] [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)] [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 sealed class OpenCommand : CommandWrapper
{ {
public OpenCommand() public OpenCommand()

3
ILSpy/Commands/OpenFromGacCommand.cs

@ -16,12 +16,15 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using ICSharpCode.ILSpy.AppEnv; using ICSharpCode.ILSpy.AppEnv;
using ICSharpCode.ILSpy.Properties; using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.OpenFrom_GAC), MenuIcon = "Images/AssemblyListGAC", MenuCategory = nameof(Resources.Open), MenuOrder = 1)] [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 sealed class OpenFromGacCommand : SimpleCommand
{ {
public override bool CanExecute(object parameter) public override bool CanExecute(object parameter)

3
ILSpy/Commands/Pdb2XmlCommand.cs

@ -19,6 +19,7 @@
#if DEBUG #if DEBUG
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -34,6 +35,7 @@ using Microsoft.DiaSymReader.Tools;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.DEBUGDumpPDBAsXML), MenuCategory = nameof(Resources.Open), MenuOrder = 2.6)] [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.DEBUGDumpPDBAsXML), MenuCategory = nameof(Resources.Open), MenuOrder = 2.6)]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class Pdb2XmlCommand : SimpleCommand sealed class Pdb2XmlCommand : SimpleCommand
{ {
public override bool CanExecute(object parameter) public override bool CanExecute(object parameter)
@ -70,6 +72,7 @@ namespace ICSharpCode.ILSpy
} }
[ExportContextMenuEntry(Header = nameof(Resources.DEBUGDumpPDBAsXML))] [ExportContextMenuEntry(Header = nameof(Resources.DEBUGDumpPDBAsXML))]
[PartCreationPolicy(CreationPolicy.Shared)]
class Pdb2XmlCommandContextMenuEntry : IContextMenuEntry class Pdb2XmlCommandContextMenuEntry : IContextMenuEntry
{ {
public void Execute(TextViewContext context) public void Execute(TextViewContext context)

2
ILSpy/Commands/RefreshCommand.cs

@ -16,6 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Windows.Input; using System.Windows.Input;
using ICSharpCode.ILSpy.Properties; 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)] [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)] [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 sealed class RefreshCommand : CommandWrapper
{ {
public RefreshCommand() public RefreshCommand()

3
ILSpy/Commands/RemoveAssembliesWithLoadErrors.cs

@ -16,6 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Linq; using System.Linq;
using ICSharpCode.ILSpy.Properties; using ICSharpCode.ILSpy.Properties;
@ -23,6 +24,7 @@ using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources._RemoveAssembliesWithLoadErrors), MenuCategory = nameof(Resources.Remove), MenuOrder = 2.6)] [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources._RemoveAssembliesWithLoadErrors), MenuCategory = nameof(Resources.Remove), MenuOrder = 2.6)]
[PartCreationPolicy(CreationPolicy.Shared)]
class RemoveAssembliesWithLoadErrors : SimpleCommand class RemoveAssembliesWithLoadErrors : SimpleCommand
{ {
public override bool CanExecute(object parameter) 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)] [ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.ClearAssemblyList), MenuCategory = nameof(Resources.Remove), MenuOrder = 2.6)]
[PartCreationPolicy(CreationPolicy.Shared)]
class ClearAssemblyList : SimpleCommand class ClearAssemblyList : SimpleCommand
{ {
public override bool CanExecute(object parameter) public override bool CanExecute(object parameter)

2
ILSpy/Commands/SaveCodeContextMenuEntry.cs

@ -30,10 +30,12 @@ using ICSharpCode.ILSpy.ViewModels;
using Microsoft.Win32; using Microsoft.Win32;
using ICSharpCode.ILSpyX.TreeView; using ICSharpCode.ILSpyX.TreeView;
using System.ComponentModel.Composition;
namespace ICSharpCode.ILSpy.TextView namespace ICSharpCode.ILSpy.TextView
{ {
[ExportContextMenuEntry(Header = nameof(Resources._SaveCode), Category = nameof(Resources.Save), Icon = "Images/Save")] [ExportContextMenuEntry(Header = nameof(Resources._SaveCode), Category = nameof(Resources.Save), Icon = "Images/Save")]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class SaveCodeContextMenuEntry : IContextMenuEntry sealed class SaveCodeContextMenuEntry : IContextMenuEntry
{ {
public void Execute(TextViewContext context) public void Execute(TextViewContext context)

2
ILSpy/Commands/SaveCommand.cs

@ -16,6 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Windows.Input; using System.Windows.Input;
using ICSharpCode.ILSpy.Properties; using ICSharpCode.ILSpy.Properties;
@ -23,6 +24,7 @@ using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources._SaveCode), MenuIcon = "Images/Save", MenuCategory = nameof(Resources.Save), MenuOrder = 0)] [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 sealed class SaveCommand : CommandWrapper
{ {
public SaveCommand() public SaveCommand()

2
ILSpy/Commands/ScopeSearchToAssembly.cs

@ -18,6 +18,7 @@
#nullable enable #nullable enable
using System; using System;
using System.ComponentModel.Composition;
using ICSharpCode.Decompiler.TypeSystem; using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpy.AppEnv; using ICSharpCode.ILSpy.AppEnv;
@ -27,6 +28,7 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
[ExportContextMenuEntry(Header = nameof(Resources.ScopeSearchToThisAssembly), Category = nameof(Resources.Analyze), Order = 9999)] [ExportContextMenuEntry(Header = nameof(Resources.ScopeSearchToThisAssembly), Category = nameof(Resources.Analyze), Order = 9999)]
[PartCreationPolicy(CreationPolicy.Shared)]
public class ScopeSearchToAssembly : IContextMenuEntry public class ScopeSearchToAssembly : IContextMenuEntry
{ {
public void Execute(TextViewContext context) public void Execute(TextViewContext context)

2
ILSpy/Commands/ScopeSearchToNamespace.cs

@ -16,6 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System; using System;
using System.ComponentModel.Composition;
using ICSharpCode.Decompiler.TypeSystem; using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpy.AppEnv; using ICSharpCode.ILSpy.AppEnv;
@ -25,6 +26,7 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
[ExportContextMenuEntry(Header = nameof(Resources.ScopeSearchToThisNamespace), Category = nameof(Resources.Analyze), Order = 9999)] [ExportContextMenuEntry(Header = nameof(Resources.ScopeSearchToThisNamespace), Category = nameof(Resources.Analyze), Order = 9999)]
[PartCreationPolicy(CreationPolicy.Shared)]
public class ScopeSearchToNamespace : IContextMenuEntry public class ScopeSearchToNamespace : IContextMenuEntry
{ {
public void Execute(TextViewContext context) public void Execute(TextViewContext context)

3
ILSpy/Commands/SearchMsdnContextMenuEntry.cs

@ -23,9 +23,12 @@ using ICSharpCode.ILSpy.Properties;
using ICSharpCode.ILSpy.TreeNodes; using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
using System.ComponentModel.Composition;
using ICSharpCode.Decompiler.TypeSystem; using ICSharpCode.Decompiler.TypeSystem;
[ExportContextMenuEntry(Header = nameof(Resources.SearchMSDN), Icon = "images/SearchMsdn", Order = 9999)] [ExportContextMenuEntry(Header = nameof(Resources.SearchMSDN), Icon = "images/SearchMsdn", Order = 9999)]
[PartCreationPolicy(CreationPolicy.Shared)]
internal sealed class SearchMsdnContextMenuEntry : IContextMenuEntry internal sealed class SearchMsdnContextMenuEntry : IContextMenuEntry
{ {
private static string msdnAddress = "https://docs.microsoft.com/dotnet/api/{0}"; private static string msdnAddress = "https://docs.microsoft.com/dotnet/api/{0}";

2
ILSpy/Commands/SelectPdbContextMenuEntry.cs

@ -16,6 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
@ -27,6 +28,7 @@ using Microsoft.Win32;
namespace ICSharpCode.ILSpy namespace ICSharpCode.ILSpy
{ {
[ExportContextMenuEntry(Header = nameof(Resources.SelectPDB))] [ExportContextMenuEntry(Header = nameof(Resources.SelectPDB))]
[PartCreationPolicy(CreationPolicy.Shared)]
class SelectPdbContextMenuEntry : IContextMenuEntry class SelectPdbContextMenuEntry : IContextMenuEntry
{ {
public async void Execute(TextViewContext context) public async void Execute(TextViewContext context)

2
ILSpy/Commands/ShowCFGContextMenuEntry.cs

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Windows; using System.Windows;
using ICSharpCode.Decompiler.FlowAnalysis; using ICSharpCode.Decompiler.FlowAnalysis;
@ -11,6 +12,7 @@ namespace ICSharpCode.ILSpy.Commands
{ {
#if DEBUG #if DEBUG
[ExportContextMenuEntry(Header = "DEBUG -- Show CFG")] [ExportContextMenuEntry(Header = "DEBUG -- Show CFG")]
[PartCreationPolicy(CreationPolicy.Shared)]
internal class ShowCFGContextMenuEntry : IContextMenuEntry internal class ShowCFGContextMenuEntry : IContextMenuEntry
{ {
public void Execute(TextViewContext context) public void Execute(TextViewContext context)

3
ILSpy/Commands/SortAssemblyListCommand.cs

@ -18,6 +18,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using ICSharpCode.ILSpy.Properties; using ICSharpCode.ILSpy.Properties;
using ICSharpCode.ILSpyX; 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))] [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))] [ExportToolbarCommand(ToolTip = nameof(Resources.SortAssemblyListName), ToolbarIcon = "Images/Sort", ToolbarCategory = nameof(Resources.View))]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class SortAssemblyListCommand : SimpleCommand, IComparer<LoadedAssembly> sealed class SortAssemblyListCommand : SimpleCommand, IComparer<LoadedAssembly>
{ {
public override void Execute(object parameter) 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))] [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))] [ExportToolbarCommand(ToolTip = nameof(Resources.CollapseTreeNodes), ToolbarIcon = "Images/CollapseAll", ToolbarCategory = nameof(Resources.View))]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class CollapseAllCommand : SimpleCommand sealed class CollapseAllCommand : SimpleCommand
{ {
public override void Execute(object parameter) public override void Execute(object parameter)

3
ILSpy/Docking/CloseAllDocumentsCommand.cs

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -9,6 +10,7 @@ using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy.Docking namespace ICSharpCode.ILSpy.Docking
{ {
[ExportMainMenuCommand(Header = nameof(Resources.Window_CloseAllDocuments), ParentMenuID = nameof(Resources._Window))] [ExportMainMenuCommand(Header = nameof(Resources.Window_CloseAllDocuments), ParentMenuID = nameof(Resources._Window))]
[PartCreationPolicy(CreationPolicy.Shared)]
class CloseAllDocumentsCommand : SimpleCommand class CloseAllDocumentsCommand : SimpleCommand
{ {
public override void Execute(object parameter) public override void Execute(object parameter)
@ -18,6 +20,7 @@ namespace ICSharpCode.ILSpy.Docking
} }
[ExportMainMenuCommand(Header = nameof(Resources.Window_ResetLayout), ParentMenuID = nameof(Resources._Window))] [ExportMainMenuCommand(Header = nameof(Resources.Window_ResetLayout), ParentMenuID = nameof(Resources._Window))]
[PartCreationPolicy(CreationPolicy.Shared)]
class ResetLayoutCommand : SimpleCommand class ResetLayoutCommand : SimpleCommand
{ {
public override void Execute(object parameter) public override void Execute(object parameter)

7
ILSpy/ExportProviderAdapter.cs

@ -15,7 +15,7 @@ namespace ICSharpCode.ILSpy;
/// <summary> /// <summary>
/// Adapter for Microsoft.VisualStudio.Composition.<see cref="ExportProvider"/> to <see cref="IExportProvider"/>. /// Adapter for Microsoft.VisualStudio.Composition.<see cref="ExportProvider"/> to <see cref="IExportProvider"/>.
/// </summary> /// </summary>
public class ExportProviderAdapter : IExportProvider public sealed class ExportProviderAdapter : IExportProvider
{ {
private static readonly Type DefaultMetadataType = typeof(Dictionary<string, object>); private static readonly Type DefaultMetadataType = typeof(Dictionary<string, object>);
@ -42,10 +42,7 @@ public class ExportProviderAdapter : IExportProvider
return _exportProvider.GetExportedValues<T>(contractName).SingleOrDefault(); return _exportProvider.GetExportedValues<T>(contractName).SingleOrDefault();
} }
#pragma warning disable CS8769 // Nullability of reference types in type of parameter doesn't match implemented member (possibly because of nullability attributes). bool IExportProvider.TryGetExportedValue<T>(string? contractName, [NotNullWhen(true)] out T? value) where T : class
// 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<T>(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).
{ {
value = _exportProvider.GetExportedValues<T>(contractName).SingleOrDefault(); value = _exportProvider.GetExportedValues<T>(contractName).SingleOrDefault();

5
ILSpy/ILSpy.csproj

@ -50,7 +50,6 @@
<PackageReference Include="DataGridExtensions" /> <PackageReference Include="DataGridExtensions" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" /> <PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" />
<PackageReference Include="NaturalSort.Extension" /> <PackageReference Include="NaturalSort.Extension" />
<PackageReference Include="TomsToolbox.Composition.Analyzer" />
<PackageReference Include="TomsToolbox.Wpf.Composition" /> <PackageReference Include="TomsToolbox.Wpf.Composition" />
<PackageReference Include="TomsToolbox.Wpf.Styles" /> <PackageReference Include="TomsToolbox.Wpf.Styles" />
</ItemGroup> </ItemGroup>
@ -92,8 +91,8 @@
<ItemGroup Condition="'$(Configuration)' == 'Debug'"> <ItemGroup Condition="'$(Configuration)' == 'Debug'">
<PackageReference Include="Microsoft.DiaSymReader.Converter.Xml" /> <PackageReference Include="Microsoft.DiaSymReader.Converter.Xml" />
<PackageReference Include="Microsoft.DiaSymReader" /> <PackageReference Include="Microsoft.DiaSymReader" />
<PackageReference Include="Microsoft.DiaSymReader.Native" /> <PackageReference Include="Microsoft.DiaSymReader.Native" />
</ItemGroup> </ItemGroup>
<PropertyGroup> <PropertyGroup>

1
ILSpy/Languages/CSharpILMixedLanguage.cs

@ -42,6 +42,7 @@ namespace ICSharpCode.ILSpy
using SequencePoint = ICSharpCode.Decompiler.DebugInfo.SequencePoint; using SequencePoint = ICSharpCode.Decompiler.DebugInfo.SequencePoint;
[Export(typeof(Language))] [Export(typeof(Language))]
[PartCreationPolicy(CreationPolicy.Shared)]
class CSharpILMixedLanguage : ILLanguage class CSharpILMixedLanguage : ILLanguage
{ {
public override string Name => "IL with C#"; public override string Name => "IL with C#";

1
ILSpy/Languages/CSharpLanguage.cs

@ -53,6 +53,7 @@ namespace ICSharpCode.ILSpy
/// please directly use the CSharpDecompiler class. /// please directly use the CSharpDecompiler class.
/// </summary> /// </summary>
[Export(typeof(Language))] [Export(typeof(Language))]
[PartCreationPolicy(CreationPolicy.Shared)]
public class CSharpLanguage : Language public class CSharpLanguage : Language
{ {
string name = "C#"; string name = "C#";

1
ILSpy/Languages/ILLanguage.cs

@ -42,6 +42,7 @@ namespace ICSharpCode.ILSpy
/// flat IL (detectControlStructure=false) and structured IL (detectControlStructure=true). /// flat IL (detectControlStructure=false) and structured IL (detectControlStructure=true).
/// </remarks> /// </remarks>
[Export(typeof(Language))] [Export(typeof(Language))]
[PartCreationPolicy(CreationPolicy.Shared)]
public class ILLanguage : Language public class ILLanguage : Language
{ {
protected bool detectControlStructure = true; protected bool detectControlStructure = true;

3
ILSpy/Metadata/GoToTokenCommand.cs

@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System; using System;
using System.ComponentModel.Composition;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Reflection.Metadata.Ecma335; using System.Reflection.Metadata.Ecma335;
@ -31,6 +32,7 @@ using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy.Commands namespace ICSharpCode.ILSpy.Commands
{ {
[ExportContextMenuEntry(Header = nameof(Resources.GoToToken), Order = 10)] [ExportContextMenuEntry(Header = nameof(Resources.GoToToken), Order = 10)]
[PartCreationPolicy(CreationPolicy.Shared)]
class GoToTokenCommand : IContextMenuEntry class GoToTokenCommand : IContextMenuEntry
{ {
public void Execute(TextViewContext context) public void Execute(TextViewContext context)
@ -68,6 +70,7 @@ namespace ICSharpCode.ILSpy.Commands
} }
[ExportContextMenuEntry(Header = nameof(Resources.Copy), Order = 10)] [ExportContextMenuEntry(Header = nameof(Resources.Copy), Order = 10)]
[PartCreationPolicy(CreationPolicy.Shared)]
class CopyCommand : IContextMenuEntry class CopyCommand : IContextMenuEntry
{ {
public void Execute(TextViewContext context) public void Execute(TextViewContext context)

1
ILSpy/Metadata/MetadataProtocolHandler.cs

@ -26,6 +26,7 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy.Metadata namespace ICSharpCode.ILSpy.Metadata
{ {
[Export(typeof(IProtocolHandler))] [Export(typeof(IProtocolHandler))]
[PartCreationPolicy(CreationPolicy.Shared)]
class MetadataProtocolHandler : IProtocolHandler class MetadataProtocolHandler : IProtocolHandler
{ {
public ILSpyTreeNode Resolve(string protocol, MetadataFile module, Handle handle, out bool newTabPage) public ILSpyTreeNode Resolve(string protocol, MetadataFile module, Handle handle, out bool newTabPage)

2
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 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Xml.Linq; using System.Xml.Linq;
using ICSharpCode.ILSpyX.Settings; using ICSharpCode.ILSpyX.Settings;
@ -26,6 +27,7 @@ namespace ICSharpCode.ILSpy.Options
/// Interaction logic for DecompilerSettingsPanel.xaml /// Interaction logic for DecompilerSettingsPanel.xaml
/// </summary> /// </summary>
[ExportOptionPage(Title = nameof(Properties.Resources.Decompiler), Order = 10)] [ExportOptionPage(Title = nameof(Properties.Resources.Decompiler), Order = 10)]
[PartCreationPolicy(CreationPolicy.NonShared)]
internal partial class DecompilerSettingsPanel : IOptionPage internal partial class DecompilerSettingsPanel : IOptionPage
{ {
public DecompilerSettingsPanel() public DecompilerSettingsPanel()

2
ILSpy/Options/DisplaySettingsPanel.xaml.cs

@ -17,6 +17,7 @@
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System; using System;
using System.ComponentModel.Composition;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
@ -34,6 +35,7 @@ namespace ICSharpCode.ILSpy.Options
/// Interaction logic for DisplaySettingsPanel.xaml /// Interaction logic for DisplaySettingsPanel.xaml
/// </summary> /// </summary>
[ExportOptionPage(Title = nameof(Properties.Resources.Display), Order = 20)] [ExportOptionPage(Title = nameof(Properties.Resources.Display), Order = 20)]
[PartCreationPolicy(CreationPolicy.NonShared)]
public partial class DisplaySettingsPanel : UserControl, IOptionPage public partial class DisplaySettingsPanel : UserControl, IOptionPage
{ {
public DisplaySettingsPanel() public DisplaySettingsPanel()

2
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 // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Windows.Controls; using System.Windows.Controls;
using System.Xml.Linq; using System.Xml.Linq;
@ -27,6 +28,7 @@ namespace ICSharpCode.ILSpy.Options
/// Interaction logic for MiscSettingsPanel.xaml /// Interaction logic for MiscSettingsPanel.xaml
/// </summary> /// </summary>
[ExportOptionPage(Title = nameof(Properties.Resources.Misc), Order = 30)] [ExportOptionPage(Title = nameof(Properties.Resources.Misc), Order = 30)]
[PartCreationPolicy(CreationPolicy.NonShared)]
public partial class MiscSettingsPanel : UserControl, IOptionPage public partial class MiscSettingsPanel : UserControl, IOptionPage
{ {
public MiscSettingsPanel() public MiscSettingsPanel()

1
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)] [ExportMainMenuCommand(ParentMenuID = nameof(Resources._View), Header = nameof(Resources._Options), MenuCategory = nameof(Resources.Options), MenuOrder = 999)]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class ShowOptionsCommand : SimpleCommand sealed class ShowOptionsCommand : SimpleCommand
{ {
public override void Execute(object parameter) public override void Execute(object parameter)

2
ILSpy/Search/SearchPane.cs

@ -21,6 +21,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Collections.Specialized; using System.Collections.Specialized;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; 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)] [ExportToolbarCommand(ToolTip = nameof(Properties.Resources.SearchCtrlShiftFOrCtrlE), ToolbarIcon = "Images/Search", ToolbarCategory = nameof(Properties.Resources.View), ToolbarOrder = 100)]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class ShowSearchCommand : CommandWrapper sealed class ShowSearchCommand : CommandWrapper
{ {
public ShowSearchCommand() public ShowSearchCommand()

4
ILSpy/TextView/EditorCommands.cs

@ -16,11 +16,14 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using ICSharpCode.ILSpy.Properties; using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy.TextView namespace ICSharpCode.ILSpy.TextView
{ {
[ExportContextMenuEntry(Header = nameof(Resources.Copy), Category = nameof(Resources.Editor))] [ExportContextMenuEntry(Header = nameof(Resources.Copy), Category = nameof(Resources.Editor))]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class CopyContextMenuEntry : IContextMenuEntry sealed class CopyContextMenuEntry : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)
@ -40,6 +43,7 @@ namespace ICSharpCode.ILSpy.TextView
} }
[ExportContextMenuEntry(Header = nameof(Resources.Select), Category = nameof(Resources.Editor))] [ExportContextMenuEntry(Header = nameof(Resources.Select), Category = nameof(Resources.Editor))]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class SelectAllContextMenuEntry : IContextMenuEntry sealed class SelectAllContextMenuEntry : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)

3
ILSpy/TextView/FoldingCommands.cs

@ -16,6 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Linq; using System.Linq;
using ICSharpCode.AvalonEdit; using ICSharpCode.AvalonEdit;
@ -25,6 +26,7 @@ using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy.TextView namespace ICSharpCode.ILSpy.TextView
{ {
[ExportContextMenuEntryAttribute(Header = nameof(Resources.ToggleFolding), Category = nameof(Resources.Folding))] [ExportContextMenuEntryAttribute(Header = nameof(Resources.ToggleFolding), Category = nameof(Resources.Folding))]
[PartCreationPolicy(CreationPolicy.Shared)]
internal sealed class ToggleAllContextMenuEntry : IContextMenuEntry internal sealed class ToggleAllContextMenuEntry : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)
@ -61,6 +63,7 @@ namespace ICSharpCode.ILSpy.TextView
} }
[ExportContextMenuEntryAttribute(Header = nameof(Resources._ToggleFolding), Category = nameof(Resources.Folding))] [ExportContextMenuEntryAttribute(Header = nameof(Resources._ToggleFolding), Category = nameof(Resources.Folding))]
[PartCreationPolicy(CreationPolicy.Shared)]
internal sealed class ToggleContextMenuEntry : IContextMenuEntry internal sealed class ToggleContextMenuEntry : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)

7
ILSpy/TreeNodes/AssemblyTreeNode.cs

@ -18,6 +18,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -577,6 +578,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
} }
[ExportContextMenuEntry(Header = nameof(Resources._Remove), Icon = "images/Delete")] [ExportContextMenuEntry(Header = nameof(Resources._Remove), Icon = "images/Delete")]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class RemoveAssembly : IContextMenuEntry sealed class RemoveAssembly : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)
@ -603,6 +605,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
} }
[ExportContextMenuEntry(Header = nameof(Resources._Reload), Icon = "images/Refresh")] [ExportContextMenuEntry(Header = nameof(Resources._Reload), Icon = "images/Refresh")]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class ReloadAssembly : IContextMenuEntry sealed class ReloadAssembly : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)
@ -637,6 +640,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
} }
[ExportContextMenuEntry(Header = nameof(Resources._LoadDependencies), Category = nameof(Resources.Dependencies))] [ExportContextMenuEntry(Header = nameof(Resources._LoadDependencies), Category = nameof(Resources.Dependencies))]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class LoadDependencies : IContextMenuEntry sealed class LoadDependencies : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)
@ -676,6 +680,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
} }
[ExportContextMenuEntry(Header = nameof(Resources._AddMainList), Category = nameof(Resources.Dependencies))] [ExportContextMenuEntry(Header = nameof(Resources._AddMainList), Category = nameof(Resources.Dependencies))]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class AddToMainList : IContextMenuEntry sealed class AddToMainList : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)
@ -710,6 +715,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
} }
[ExportContextMenuEntry(Header = nameof(Resources._OpenContainingFolder), Category = nameof(Resources.Shell))] [ExportContextMenuEntry(Header = nameof(Resources._OpenContainingFolder), Category = nameof(Resources.Shell))]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class OpenContainingFolder : IContextMenuEntry sealed class OpenContainingFolder : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)
@ -762,6 +768,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
} }
[ExportContextMenuEntry(Header = nameof(Resources._OpenCommandLineHere), Category = nameof(Resources.Shell))] [ExportContextMenuEntry(Header = nameof(Resources._OpenCommandLineHere), Category = nameof(Resources.Shell))]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class OpenCmdHere : IContextMenuEntry sealed class OpenCmdHere : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)

1
ILSpy/TreeNodes/ResourceNodes/CursorResourceEntryNode.cs

@ -31,6 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ICSharpCode.ILSpy.TreeNodes namespace ICSharpCode.ILSpy.TreeNodes
{ {
[Export(typeof(IResourceNodeFactory))] [Export(typeof(IResourceNodeFactory))]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class CursorResourceNodeFactory : IResourceNodeFactory sealed class CursorResourceNodeFactory : IResourceNodeFactory
{ {
static readonly string[] imageFileExtensions = { ".cur" }; static readonly string[] imageFileExtensions = { ".cur" };

1
ILSpy/TreeNodes/ResourceNodes/IconResourceEntryNode.cs

@ -31,6 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ICSharpCode.ILSpy.TreeNodes namespace ICSharpCode.ILSpy.TreeNodes
{ {
[Export(typeof(IResourceNodeFactory))] [Export(typeof(IResourceNodeFactory))]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class IconResourceNodeFactory : IResourceNodeFactory sealed class IconResourceNodeFactory : IResourceNodeFactory
{ {
public ITreeNode CreateNode(Resource resource) public ITreeNode CreateNode(Resource resource)

1
ILSpy/TreeNodes/ResourceNodes/ImageListResourceEntryNode.cs

@ -28,6 +28,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ICSharpCode.ILSpy.TreeNodes namespace ICSharpCode.ILSpy.TreeNodes
{ {
[Export(typeof(IResourceNodeFactory))] [Export(typeof(IResourceNodeFactory))]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class ImageListResourceEntryNodeFactory : IResourceNodeFactory sealed class ImageListResourceEntryNodeFactory : IResourceNodeFactory
{ {
public ITreeNode CreateNode(Resource resource) public ITreeNode CreateNode(Resource resource)

1
ILSpy/TreeNodes/ResourceNodes/ImageResourceEntryNode.cs

@ -31,6 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ICSharpCode.ILSpy.TreeNodes namespace ICSharpCode.ILSpy.TreeNodes
{ {
[Export(typeof(IResourceNodeFactory))] [Export(typeof(IResourceNodeFactory))]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class ImageResourceNodeFactory : IResourceNodeFactory sealed class ImageResourceNodeFactory : IResourceNodeFactory
{ {
static readonly string[] imageFileExtensions = { ".png", ".gif", ".bmp", ".jpg" }; static readonly string[] imageFileExtensions = { ".png", ".gif", ".bmp", ".jpg" };

1
ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs

@ -38,6 +38,7 @@ using Microsoft.Win32;
namespace ICSharpCode.ILSpy.TreeNodes namespace ICSharpCode.ILSpy.TreeNodes
{ {
[Export(typeof(IResourceNodeFactory))] [Export(typeof(IResourceNodeFactory))]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class ResourcesFileTreeNodeFactory : IResourceNodeFactory sealed class ResourcesFileTreeNodeFactory : IResourceNodeFactory
{ {
public ITreeNode CreateNode(Resource resource) public ITreeNode CreateNode(Resource resource)

1
ILSpy/TreeNodes/ResourceNodes/XamlResourceNode.cs

@ -31,6 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ICSharpCode.ILSpy.Xaml namespace ICSharpCode.ILSpy.Xaml
{ {
[Export(typeof(IResourceNodeFactory))] [Export(typeof(IResourceNodeFactory))]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class XamlResourceNodeFactory : IResourceNodeFactory sealed class XamlResourceNodeFactory : IResourceNodeFactory
{ {
public ITreeNode CreateNode(Resource resource) public ITreeNode CreateNode(Resource resource)

1
ILSpy/TreeNodes/ResourceNodes/XmlResourceNode.cs

@ -31,6 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ICSharpCode.ILSpy.Xaml namespace ICSharpCode.ILSpy.Xaml
{ {
[Export(typeof(IResourceNodeFactory))] [Export(typeof(IResourceNodeFactory))]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class XmlResourceNodeFactory : IResourceNodeFactory sealed class XmlResourceNodeFactory : IResourceNodeFactory
{ {
private readonly static string[] xmlFileExtensions = { ".xml", ".xsd", ".xslt" }; private readonly static string[] xmlFileExtensions = { ".xml", ".xsd", ".xslt" };

2
ILSpy/TreeNodes/ThreadingSupport.cs

@ -18,6 +18,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -171,6 +172,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
} }
[ExportContextMenuEntry(Header = nameof(Resources.CopyErrorMessage))] [ExportContextMenuEntry(Header = nameof(Resources.CopyErrorMessage))]
[PartCreationPolicy(CreationPolicy.Shared)]
sealed class CopyErrorMessageContextMenu : IContextMenuEntry sealed class CopyErrorMessageContextMenu : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)

4
ILSpy/ViewModels/AnalyzerPaneModel.cs

@ -16,17 +16,19 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Windows; using System.Windows;
using System.Windows.Input; using System.Windows.Input;
namespace ICSharpCode.ILSpy.ViewModels namespace ICSharpCode.ILSpy.ViewModels
{ {
[ExportToolPane(ContentId = PaneContentId)] [ExportToolPane(ContentId = PaneContentId)]
[PartCreationPolicy(CreationPolicy.Shared)]
public class AnalyzerPaneModel : ToolPaneModel public class AnalyzerPaneModel : ToolPaneModel
{ {
public const string PaneContentId = "analyzerPane"; public const string PaneContentId = "analyzerPane";
private AnalyzerPaneModel() public AnalyzerPaneModel()
{ {
ContentId = PaneContentId; ContentId = PaneContentId;
Title = Properties.Resources.Analyze; Title = Properties.Resources.Analyze;

4
ILSpy/ViewModels/AssemblyListPaneModel.cs

@ -16,6 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Windows; using System.Windows;
using System.Windows.Input; using System.Windows.Input;
@ -24,11 +25,12 @@ using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy.ViewModels namespace ICSharpCode.ILSpy.ViewModels
{ {
[ExportToolPane(ContentId = PaneContentId)] [ExportToolPane(ContentId = PaneContentId)]
[PartCreationPolicy(CreationPolicy.Shared)]
public class AssemblyListPaneModel : ToolPaneModel public class AssemblyListPaneModel : ToolPaneModel
{ {
public const string PaneContentId = "assemblyListPane"; public const string PaneContentId = "assemblyListPane";
private AssemblyListPaneModel() public AssemblyListPaneModel()
{ {
Title = Resources.Assemblies; Title = Resources.Assemblies;
ContentId = PaneContentId; ContentId = PaneContentId;

4
ILSpy/ViewModels/DebugStepsPaneModel.cs

@ -16,18 +16,20 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Windows; using System.Windows;
namespace ICSharpCode.ILSpy.ViewModels namespace ICSharpCode.ILSpy.ViewModels
{ {
#if DEBUG #if DEBUG
[ExportToolPane(ContentId = PaneContentId)] [ExportToolPane(ContentId = PaneContentId)]
[PartCreationPolicy(CreationPolicy.Shared)]
#endif #endif
public class DebugStepsPaneModel : ToolPaneModel public class DebugStepsPaneModel : ToolPaneModel
{ {
public const string PaneContentId = "debugStepsPane"; public const string PaneContentId = "debugStepsPane";
private DebugStepsPaneModel() public DebugStepsPaneModel()
{ {
ContentId = PaneContentId; ContentId = PaneContentId;
Title = Properties.Resources.DebugSteps; Title = Properties.Resources.DebugSteps;

4
ILSpy/ViewModels/SearchPaneModel.cs

@ -16,17 +16,19 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE. // DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Windows; using System.Windows;
using System.Windows.Input; using System.Windows.Input;
namespace ICSharpCode.ILSpy.ViewModels namespace ICSharpCode.ILSpy.ViewModels
{ {
[ExportToolPane(ContentId = PaneContentId)] [ExportToolPane(ContentId = PaneContentId)]
[PartCreationPolicy(CreationPolicy.Shared)]
public class SearchPaneModel : ToolPaneModel public class SearchPaneModel : ToolPaneModel
{ {
public const string PaneContentId = "searchPane"; public const string PaneContentId = "searchPane";
private SearchPaneModel() public SearchPaneModel()
{ {
ContentId = PaneContentId; ContentId = PaneContentId;
Title = Properties.Resources.SearchPane_Search; Title = Properties.Resources.SearchPane_Search;

1
TestPlugin/AboutPageAddition.cs

@ -11,6 +11,7 @@ using ICSharpCode.ILSpy;
namespace TestPlugin namespace TestPlugin
{ {
[Export(typeof(IAboutPageAddition))] [Export(typeof(IAboutPageAddition))]
[PartCreationPolicy(CreationPolicy.Shared)]
public class AboutPageAddition : IAboutPageAddition public class AboutPageAddition : IAboutPageAddition
{ {
public void Write(ISmartTextOutput textOutput) public void Write(ISmartTextOutput textOutput)

2
TestPlugin/ContextMenuCommand.cs

@ -1,6 +1,7 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System.ComponentModel.Composition;
using System.Linq; using System.Linq;
using ICSharpCode.ILSpy; using ICSharpCode.ILSpy;
@ -9,6 +10,7 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace TestPlugin namespace TestPlugin
{ {
[ExportContextMenuEntryAttribute(Header = "_Save Assembly")] [ExportContextMenuEntryAttribute(Header = "_Save Assembly")]
[PartCreationPolicy(CreationPolicy.Shared)]
public class SaveAssembly : IContextMenuEntry public class SaveAssembly : IContextMenuEntry
{ {
public bool IsVisible(TextViewContext context) public bool IsVisible(TextViewContext context)

1
TestPlugin/CustomLanguage.cs

@ -15,6 +15,7 @@ namespace TestPlugin
/// Adds a new language to the decompiler. /// Adds a new language to the decompiler.
/// </summary> /// </summary>
[Export(typeof(Language))] [Export(typeof(Language))]
[PartCreationPolicy(CreationPolicy.Shared)]
public class CustomLanguage : Language public class CustomLanguage : Language
{ {
public override string Name { public override string Name {

2
TestPlugin/CustomOptionPage.xaml.cs

@ -2,6 +2,7 @@
// This code is distributed under MIT X11 license (for details please see \doc\license.txt) // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System.ComponentModel; using System.ComponentModel;
using System.ComponentModel.Composition;
using System.Windows.Controls; using System.Windows.Controls;
using System.Xml.Linq; using System.Xml.Linq;
@ -12,6 +13,7 @@ using ICSharpCode.ILSpyX.Settings;
namespace TestPlugin namespace TestPlugin
{ {
[ExportOptionPage(Title = "TestPlugin", Order = 0)] [ExportOptionPage(Title = "TestPlugin", Order = 0)]
[PartCreationPolicy(CreationPolicy.NonShared)]
partial class CustomOptionPage : UserControl, IOptionPage partial class CustomOptionPage : UserControl, IOptionPage
{ {
static readonly XNamespace ns = "http://www.ilspy.net/testplugin"; static readonly XNamespace ns = "http://www.ilspy.net/testplugin";

3
TestPlugin/MainMenuCommand.cs

@ -1,6 +1,8 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) // 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) // This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System.ComponentModel.Composition;
using ICSharpCode.ILSpy; using ICSharpCode.ILSpy;
namespace TestPlugin namespace TestPlugin
@ -16,6 +18,7 @@ namespace TestPlugin
// ToolbarCategory: optional, used for grouping related toolbar items together. A separator is added between different groups. // 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) // 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)] [ExportToolbarCommand(ToolTip = "Clears the current assembly list", ToolbarIcon = "Clear.png", ToolbarCategory = "Open", ToolbarOrder = 1.5)]
[PartCreationPolicy(CreationPolicy.Shared)]
public class UnloadAllAssembliesCommand : SimpleCommand public class UnloadAllAssembliesCommand : SimpleCommand
{ {
public override void Execute(object parameter) public override void Execute(object parameter)

Loading…
Cancel
Save