Browse Source

Get rid of the heavy System.ComponentModel.Composition, replace with the lightweight System.Composition.AttributedModel

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

2
.editorconfig

@ -147,5 +147,3 @@ dotnet_naming_rule.private_fields_rule.symbols = private_fields_symbols @@ -147,5 +147,3 @@ dotnet_naming_rule.private_fields_rule.symbols = private_fields_symbols
# MEF006: No importing constructor
dotnet_diagnostic.MEF006.severity = silent
# MEF002: Import attributes, to be removed after final DI migration
dotnet_diagnostic.MEF002.severity = silent

7
Directory.Packages.props

@ -23,7 +23,7 @@ @@ -23,7 +23,7 @@
<PackageVersion Include="Microsoft.DiaSymReader.Native" Version="17.0.0-beta1.21524.1" />
<PackageVersion Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.2" />
<PackageVersion Include="Microsoft.Extensions.Hosting" Version="8.0.1" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageVersion Include="Microsoft.NETCore.ILAsm" Version="8.0.0" />
@ -38,16 +38,15 @@ @@ -38,16 +38,15 @@
<PackageVersion Include="NUnit3TestAdapter" Version="4.6.0" />
<PackageVersion Include="NuGet.Protocol" Version="6.11.1" />
<PackageVersion Include="PowerShellStandard.Library" Version="5.1.1" />
<PackageVersion Include="System.Composition.AttributedModel" Version="8.0.0" />
<PackageVersion Include="System.Collections.Immutable" Version="8.0.0" />
<PackageVersion Include="System.ComponentModel.Composition" Version="8.0.0" />
<PackageVersion Include="System.Composition" Version="8.0.0" />
<PackageVersion Include="System.Memory" Version="4.5.5" />
<PackageVersion Include="System.Reflection.Metadata" Version="8.0.1" />
<PackageVersion Include="System.Resources.Extensions" Version="8.0.0" />
<PackageVersion Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageVersion Include="TomsToolbox.Composition.MicrosoftExtensions" Version="2.20.0" />
<PackageVersion Include="TomsToolbox.Wpf.Composition" Version="2.20.0" />
<PackageVersion Include="TomsToolbox.Wpf.Composition.Mef" Version="2.20.0" />
<PackageVersion Include="TomsToolbox.Wpf.Composition.AttributedModel" Version="2.20.0" />
<PackageVersion Include="TomsToolbox.Wpf.Styles" Version="2.20.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
</ItemGroup>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2
ICSharpCode.ILSpyX/Analyzers/ExportAnalyzerAttribute.cs

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Composition;
using System.Linq;
using System.Reflection;

3
ICSharpCode.ILSpyX/ICSharpCode.ILSpyX.csproj

@ -66,10 +66,9 @@ @@ -66,10 +66,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.ComponentModel.Composition" />
<PackageReference Include="System.Composition.AttributedModel" />
<PackageReference Include="System.Reflection.Metadata" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
<PackageReference Include="System.Composition" />
<PackageReference Include="Mono.Cecil" />
<PackageReference Include="K4os.Compression.LZ4" />
<PackageReference Include="Microsoft.SourceLink.GitHub">

6
ILSpy.BamlDecompiler/BamlResourceNodeFactory.cs

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.ComponentModel.Composition;
using System.Composition;
using System.IO;
using ICSharpCode.BamlDecompiler;
@ -32,7 +32,7 @@ using ICSharpCode.ILSpyX.Abstractions; @@ -32,7 +32,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ILSpy.BamlDecompiler
{
[Export(typeof(IResourceNodeFactory))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
public sealed class BamlResourceNodeFactory : IResourceNodeFactory
{
public ITreeNode CreateNode(Resource resource)
@ -45,7 +45,7 @@ namespace ILSpy.BamlDecompiler @@ -45,7 +45,7 @@ namespace ILSpy.BamlDecompiler
}
[Export(typeof(IResourceFileHandler))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
public sealed class BamlResourceFileHandler : IResourceFileHandler
{
public string EntryType => "Page";

4
ILSpy.ReadyToRun/ReadyToRunLanguage.cs

@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Composition;
using System.Diagnostics;
using System.IO;
using System.Linq;
@ -96,7 +96,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun @@ -96,7 +96,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun
#endif
[Export(typeof(Language))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
internal class ReadyToRunLanguage : Language
{
private static readonly ConditionalWeakTable<MetadataFile, ReadyToRunReaderCacheEntry> readyToRunReaders = new ConditionalWeakTable<MetadataFile, ReadyToRunReaderCacheEntry>();

8
ILSpy.ReadyToRun/ReadyToRunOptionPage.xaml.cs

@ -16,18 +16,18 @@ @@ -16,18 +16,18 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Composition;
using ICSharpCode.ILSpy.Options;
using ICSharpCode.ILSpy.Util;
using TomsToolbox.Wpf;
using TomsToolbox.Wpf.Composition.Mef;
using TomsToolbox.Wpf.Composition.AttributedModel;
namespace ICSharpCode.ILSpy.ReadyToRun
{
[DataTemplate(typeof(ReadyToRunOptionsViewModel))]
[PartCreationPolicy(CreationPolicy.NonShared)]
[NonShared]
partial class ReadyToRunOptionPage
{
public ReadyToRunOptionPage()
@ -37,7 +37,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun @@ -37,7 +37,7 @@ namespace ICSharpCode.ILSpy.ReadyToRun
}
[ExportOptionPage(Order = 40)]
[PartCreationPolicy(CreationPolicy.NonShared)]
[NonShared]
class ReadyToRunOptionsViewModel : ObservableObject, IOptionPage
{
private ReadyToRunOptions options;

4
ILSpy/AboutPage.cs

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

4
ILSpy/Analyzers/AnalyzeCommand.cs

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Composition;
using System.Linq;
using ICSharpCode.Decompiler.TypeSystem;
@ -26,7 +26,7 @@ using ICSharpCode.ILSpy.TreeNodes; @@ -26,7 +26,7 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy.Analyzers
{
[ExportContextMenuEntry(Header = nameof(Resources.Analyze), Icon = "Images/Search", Category = nameof(Resources.Analyze), InputGestureText = "Ctrl+R", Order = 100)]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
internal sealed class AnalyzeContextMenuCommand : IContextMenuEntry
{
private static readonly AnalyzerTreeViewModel AnalyzerTreeView = App.ExportProvider.GetExportedValue<AnalyzerTreeViewModel>();

6
ILSpy/Analyzers/AnalyzerTreeView.xaml.cs

@ -16,12 +16,12 @@ @@ -16,12 +16,12 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Composition;
using System.Windows.Controls;
using ICSharpCode.ILSpyX.TreeView;
using TomsToolbox.Wpf.Composition.Mef;
using TomsToolbox.Wpf.Composition.AttributedModel;
namespace ICSharpCode.ILSpy.Analyzers
{
@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpy.Analyzers @@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpy.Analyzers
/// Interaction logic for AnalyzerTreeView.xaml
/// </summary>
[DataTemplate(typeof(AnalyzerTreeViewModel))]
[PartCreationPolicy(CreationPolicy.NonShared)]
[NonShared]
[Export]
public partial class AnalyzerTreeView
{

4
ILSpy/Analyzers/AnalyzerTreeViewModel.cs

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.ComponentModel.Composition;
using System.Composition;
using System.Linq;
using System.Windows;
using System.Windows.Input;
@ -32,7 +32,7 @@ using TomsToolbox.Wpf; @@ -32,7 +32,7 @@ using TomsToolbox.Wpf;
namespace ICSharpCode.ILSpy.Analyzers
{
[ExportToolPane]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
[Export]
public class AnalyzerTreeViewModel : ToolPaneModel
{

4
ILSpy/Analyzers/CopyAnalysisResultsContextMenuEntry.cs

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

4
ILSpy/Analyzers/RemoveAnalyzeContextMenuEntry.cs

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

6
ILSpy/AssemblyTree/AssemblyListPane.xaml.cs

@ -16,14 +16,14 @@ @@ -16,14 +16,14 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Composition;
using System.Windows;
using System.Windows.Threading;
using ICSharpCode.ILSpy.ViewModels;
using ICSharpCode.ILSpyX.TreeView;
using TomsToolbox.Wpf.Composition.Mef;
using TomsToolbox.Wpf.Composition.AttributedModel;
namespace ICSharpCode.ILSpy.AssemblyTree
{
@ -31,7 +31,7 @@ namespace ICSharpCode.ILSpy.AssemblyTree @@ -31,7 +31,7 @@ namespace ICSharpCode.ILSpy.AssemblyTree
/// Interaction logic for AssemblyListPane.xaml
/// </summary>
[DataTemplate(typeof(AssemblyTreeModel))]
[PartCreationPolicy(CreationPolicy.NonShared)]
[NonShared]
public partial class AssemblyListPane
{
public AssemblyListPane()

4
ILSpy/AssemblyTree/AssemblyTreeModel.cs

@ -20,7 +20,7 @@ using System; @@ -20,7 +20,7 @@ using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.ComponentModel.Composition;
using System.Composition;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
@ -55,7 +55,7 @@ using TomsToolbox.Wpf; @@ -55,7 +55,7 @@ using TomsToolbox.Wpf;
namespace ICSharpCode.ILSpy.AssemblyTree
{
[ExportToolPane]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
[Export]
public class AssemblyTreeModel : ToolPaneModel
{

5
ILSpy/Commands/BrowseBackCommand.cs

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

5
ILSpy/Commands/BrowseForwardCommand.cs

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

4
ILSpy/Commands/CheckForUpdatesCommand.cs

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

4
ILSpy/Commands/CopyFullyQualifiedNameContextMenuEntry.cs

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

9
ILSpy/Commands/DecompileAllCommand.cs

@ -21,7 +21,7 @@ @@ -21,7 +21,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Composition;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
@ -35,13 +35,12 @@ using ICSharpCode.ILSpyX; @@ -35,13 +35,12 @@ using ICSharpCode.ILSpyX;
namespace ICSharpCode.ILSpy
{
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.DEBUGDecompile), MenuCategory = nameof(Resources.Open), MenuOrder = 2.5)]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class DecompileAllCommand : SimpleCommand
{
private readonly IReadOnlyCollection<IResourceFileHandler> resourceFileHandlers;
[ImportingConstructor]
public DecompileAllCommand([ImportMany] IEnumerable<IResourceFileHandler> resourceFileHandlers)
public DecompileAllCommand(IEnumerable<IResourceFileHandler> resourceFileHandlers)
{
this.resourceFileHandlers = resourceFileHandlers.ToArray();
}
@ -96,7 +95,7 @@ namespace ICSharpCode.ILSpy @@ -96,7 +95,7 @@ namespace ICSharpCode.ILSpy
}
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.DEBUGDecompile100x), MenuCategory = nameof(Resources.Open), MenuOrder = 2.6)]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class Decompile100TimesCommand : SimpleCommand
{
public override void Execute(object parameter)

4
ILSpy/Commands/DecompileCommand.cs

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

5
ILSpy/Commands/DecompileInNewViewCommand.cs

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Composition;
using System.Linq;
using System.Windows.Threading;
@ -34,12 +34,11 @@ using TomsToolbox.Essentials; @@ -34,12 +34,11 @@ using TomsToolbox.Essentials;
namespace ICSharpCode.ILSpy.Commands
{
[ExportContextMenuEntry(Header = nameof(Resources.DecompileToNewPanel), InputGestureText = "MMB", Icon = "images/Search", Category = nameof(Resources.Analyze), Order = 90)]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
internal sealed class DecompileInNewViewCommand : IContextMenuEntry
{
private readonly AssemblyTreeModel assemblyTreeModel;
[ImportingConstructor]
public DecompileInNewViewCommand(AssemblyTreeModel assemblyTreeModel)
{
this.assemblyTreeModel = assemblyTreeModel;

4
ILSpy/Commands/DisassembleAllCommand.cs

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

4
ILSpy/Commands/ExitCommand.cs

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

2
ILSpy/Commands/ExportCommandAttribute.cs

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.ComponentModel.Composition;
using System.Composition;
using System.Windows.Input;
namespace ICSharpCode.ILSpy

4
ILSpy/Commands/ExtractPackageEntryContextMenuEntry.cs

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

6
ILSpy/Commands/GeneratePdbContextMenuEntry.cs

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

4
ILSpy/Commands/ManageAssemblyListsCommand.cs

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

5
ILSpy/Commands/OpenCommand.cs

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Composition;
using System.Windows.Input;
using ICSharpCode.ILSpy.AssemblyTree;
@ -28,12 +28,11 @@ namespace ICSharpCode.ILSpy @@ -28,12 +28,11 @@ namespace ICSharpCode.ILSpy
{
[ExportToolbarCommand(ToolTip = nameof(Resources.Open), ToolbarIcon = "Images/Open", ToolbarCategory = nameof(Resources.Open), ToolbarOrder = 0)]
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources._Open), MenuIcon = "Images/Open", MenuCategory = nameof(Resources.Open), MenuOrder = 0)]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class OpenCommand : CommandWrapper
{
private readonly AssemblyTreeModel assemblyTreeModel;
[ImportingConstructor]
public OpenCommand(AssemblyTreeModel assemblyTreeModel)
: base(ApplicationCommands.Open)
{

5
ILSpy/Commands/OpenFromGacCommand.cs

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Composition;
using ICSharpCode.ILSpy.AppEnv;
using ICSharpCode.ILSpy.AssemblyTree;
@ -25,12 +25,11 @@ using ICSharpCode.ILSpy.Properties; @@ -25,12 +25,11 @@ using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy
{
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.OpenFrom_GAC), MenuIcon = "Images/AssemblyListGAC", MenuCategory = nameof(Resources.Open), MenuOrder = 1)]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class OpenFromGacCommand : SimpleCommand
{
private readonly AssemblyTreeModel assemblyTreeModel;
[ImportingConstructor]
public OpenFromGacCommand(AssemblyTreeModel assemblyTreeModel)
{
this.assemblyTreeModel = assemblyTreeModel;

6
ILSpy/Commands/Pdb2XmlCommand.cs

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

5
ILSpy/Commands/RefreshCommand.cs

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Composition;
using System.Windows.Input;
using ICSharpCode.ILSpy.AssemblyTree;
@ -26,12 +26,11 @@ namespace ICSharpCode.ILSpy @@ -26,12 +26,11 @@ namespace ICSharpCode.ILSpy
{
[ExportToolbarCommand(ToolTip = nameof(Resources.RefreshCommand_ReloadAssemblies), ToolbarIcon = "Images/Refresh", ToolbarCategory = nameof(Resources.Open), ToolbarOrder = 2)]
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources._Reload), MenuIcon = "Images/Refresh", MenuCategory = nameof(Resources.Open), MenuOrder = 2)]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class RefreshCommand : CommandWrapper
{
private readonly AssemblyTreeModel assemblyTreeModel;
[ImportingConstructor]
public RefreshCommand(AssemblyTreeModel assemblyTreeModel)
: base(NavigationCommands.Refresh)
{

8
ILSpy/Commands/RemoveAssembliesWithLoadErrors.cs

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Composition;
using System.Linq;
using ICSharpCode.ILSpy.AssemblyTree;
@ -25,12 +25,11 @@ using ICSharpCode.ILSpy.Properties; @@ -25,12 +25,11 @@ using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy
{
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources._RemoveAssembliesWithLoadErrors), MenuCategory = nameof(Resources.Remove), MenuOrder = 2.6)]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
class RemoveAssembliesWithLoadErrors : SimpleCommand
{
private readonly AssemblyTreeModel assemblyTreeModel;
[ImportingConstructor]
public RemoveAssembliesWithLoadErrors(AssemblyTreeModel assemblyTreeModel)
{
this.assemblyTreeModel = assemblyTreeModel;
@ -55,12 +54,11 @@ namespace ICSharpCode.ILSpy @@ -55,12 +54,11 @@ namespace ICSharpCode.ILSpy
}
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources.ClearAssemblyList), MenuCategory = nameof(Resources.Remove), MenuOrder = 2.6)]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
class ClearAssemblyList : SimpleCommand
{
private readonly AssemblyTreeModel assemblyTreeModel;
[ImportingConstructor]
public ClearAssemblyList(AssemblyTreeModel assemblyTreeModel)
{
this.assemblyTreeModel = assemblyTreeModel;

4
ILSpy/Commands/SaveCodeContextMenuEntry.cs

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Composition;
using System.IO;
using System.Linq;
using System.Windows;
@ -34,7 +34,7 @@ using Microsoft.Win32; @@ -34,7 +34,7 @@ using Microsoft.Win32;
namespace ICSharpCode.ILSpy.TextView
{
[ExportContextMenuEntry(Header = nameof(Resources._SaveCode), Category = nameof(Resources.Save), Icon = "Images/Save")]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class SaveCodeContextMenuEntry : IContextMenuEntry
{
public void Execute(TextViewContext context)

5
ILSpy/Commands/SaveCommand.cs

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Composition;
using System.Linq;
using System.Windows.Input;
@ -27,12 +27,11 @@ using ICSharpCode.ILSpy.TextView; @@ -27,12 +27,11 @@ using ICSharpCode.ILSpy.TextView;
namespace ICSharpCode.ILSpy
{
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._File), Header = nameof(Resources._SaveCode), MenuIcon = "Images/Save", MenuCategory = nameof(Resources.Save), MenuOrder = 0)]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class SaveCommand : CommandWrapper
{
private AssemblyTreeModel assemblyTreeModel;
[ImportingConstructor]
public SaveCommand(AssemblyTreeModel assemblyTreeModel)
: base(ApplicationCommands.Save)
{

5
ILSpy/Commands/ScopeSearchToAssembly.cs

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
#nullable enable
using System;
using System.ComponentModel.Composition;
using System.Composition;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpy.AppEnv;
@ -29,12 +29,11 @@ using ICSharpCode.ILSpy.TreeNodes; @@ -29,12 +29,11 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy
{
[ExportContextMenuEntry(Header = nameof(Resources.ScopeSearchToThisAssembly), Category = nameof(Resources.Analyze), Order = 9999)]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
public class ScopeSearchToAssembly : IContextMenuEntry
{
private readonly SearchPaneModel searchPane;
[ImportingConstructor]
public ScopeSearchToAssembly(SearchPaneModel searchPane)
{
this.searchPane = searchPane;

5
ILSpy/Commands/ScopeSearchToNamespace.cs

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System;
using System.ComponentModel.Composition;
using System.Composition;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpy.AppEnv;
@ -27,12 +27,11 @@ using ICSharpCode.ILSpy.TreeNodes; @@ -27,12 +27,11 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy
{
[ExportContextMenuEntry(Header = nameof(Resources.ScopeSearchToThisNamespace), Category = nameof(Resources.Analyze), Order = 9999)]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
public class ScopeSearchToNamespace : IContextMenuEntry
{
private readonly SearchPaneModel searchPane;
[ImportingConstructor]
public ScopeSearchToNamespace(SearchPaneModel searchPane)
{
this.searchPane = searchPane;

4
ILSpy/Commands/SearchMsdnContextMenuEntry.cs

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

4
ILSpy/Commands/SelectPdbContextMenuEntry.cs

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

4
ILSpy/Commands/ShowCFGContextMenuEntry.cs

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

6
ILSpy/Commands/SortAssemblyListCommand.cs

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Composition;
using ICSharpCode.ILSpy.Properties;
using ICSharpCode.ILSpyX;
@ -28,7 +28,7 @@ namespace ICSharpCode.ILSpy @@ -28,7 +28,7 @@ namespace ICSharpCode.ILSpy
{
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._View), Header = nameof(Resources.SortAssembly_listName), MenuIcon = "Images/Sort", MenuCategory = nameof(Resources.View))]
[ExportToolbarCommand(ToolTip = nameof(Resources.SortAssemblyListName), ToolbarIcon = "Images/Sort", ToolbarCategory = nameof(Resources.View))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class SortAssemblyListCommand : SimpleCommand
{
public override void Execute(object parameter)
@ -39,7 +39,7 @@ namespace ICSharpCode.ILSpy @@ -39,7 +39,7 @@ namespace ICSharpCode.ILSpy
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._View), Header = nameof(Resources._CollapseTreeNodes), MenuIcon = "Images/CollapseAll", MenuCategory = nameof(Resources.View))]
[ExportToolbarCommand(ToolTip = nameof(Resources.CollapseTreeNodes), ToolbarIcon = "Images/CollapseAll", ToolbarCategory = nameof(Resources.View))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class CollapseAllCommand : SimpleCommand
{
public override void Execute(object parameter)

2
ILSpy/ContextMenuEntry.cs

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Composition;
using System.Linq;
using System.Windows;
using System.Windows.Controls;

6
ILSpy/Docking/CloseAllDocumentsCommand.cs

@ -1,11 +1,11 @@ @@ -1,11 +1,11 @@
using System.ComponentModel.Composition;
using System.Composition;
using ICSharpCode.ILSpy.Properties;
namespace ICSharpCode.ILSpy.Docking
{
[ExportMainMenuCommand(Header = nameof(Resources.Window_CloseAllDocuments), ParentMenuID = nameof(Resources._Window))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
class CloseAllDocumentsCommand : SimpleCommand
{
public override void Execute(object parameter)
@ -15,7 +15,7 @@ namespace ICSharpCode.ILSpy.Docking @@ -15,7 +15,7 @@ namespace ICSharpCode.ILSpy.Docking
}
[ExportMainMenuCommand(Header = nameof(Resources.Window_ResetLayout), ParentMenuID = nameof(Resources._Window))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
class ResetLayoutCommand : SimpleCommand
{
public override void Execute(object parameter)

3
ILSpy/ILSpy.csproj

@ -50,8 +50,7 @@ @@ -50,8 +50,7 @@
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" />
<PackageReference Include="NaturalSort.Extension" />
<PackageReference Include="TomsToolbox.Composition.MicrosoftExtensions" />
<PackageReference Include="TomsToolbox.Wpf.Composition" />
<PackageReference Include="TomsToolbox.Wpf.Composition.Mef" />
<PackageReference Include="TomsToolbox.Wpf.Composition.AttributedModel" />
<PackageReference Include="TomsToolbox.Wpf.Styles" />
</ItemGroup>

4
ILSpy/Languages/CSharpILMixedLanguage.cs

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

7
ILSpy/Languages/CSharpLanguage.cs

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Composition;
using System.IO;
using System.Linq;
using System.Reflection;
@ -52,7 +52,7 @@ namespace ICSharpCode.ILSpy @@ -52,7 +52,7 @@ namespace ICSharpCode.ILSpy
/// please directly use the CSharpDecompiler class.
/// </summary>
[Export(typeof(Language))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
public class CSharpLanguage : Language
{
readonly IReadOnlyCollection<IResourceFileHandler> resourceFileHandlers;
@ -61,8 +61,7 @@ namespace ICSharpCode.ILSpy @@ -61,8 +61,7 @@ namespace ICSharpCode.ILSpy
bool showAllMembers = false;
int transformCount = int.MaxValue;
[ImportingConstructor]
public CSharpLanguage([ImportMany] IEnumerable<IResourceFileHandler> resourceFileHandlers)
public CSharpLanguage(IEnumerable<IResourceFileHandler> resourceFileHandlers)
{
this.resourceFileHandlers = resourceFileHandlers.ToArray();
}

4
ILSpy/Languages/ILLanguage.cs

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Composition;
using System.Linq;
using System.Reflection.Metadata;
@ -43,7 +43,7 @@ namespace ICSharpCode.ILSpy @@ -43,7 +43,7 @@ namespace ICSharpCode.ILSpy
/// flat IL (detectControlStructure=false) and structured IL (detectControlStructure=true).
/// </remarks>
[Export(typeof(Language))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
public class ILLanguage : Language
{
protected bool detectControlStructure = true;

6
ILSpy/Metadata/GoToTokenCommand.cs

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

4
ILSpy/Metadata/MetadataProtocolHandler.cs

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Composition;
using System.Linq;
using System.Reflection.Metadata;
@ -26,7 +26,7 @@ using ICSharpCode.ILSpy.TreeNodes; @@ -26,7 +26,7 @@ using ICSharpCode.ILSpy.TreeNodes;
namespace ICSharpCode.ILSpy.Metadata
{
[Export(typeof(IProtocolHandler))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
class MetadataProtocolHandler : IProtocolHandler
{
public ILSpyTreeNode Resolve(string protocol, MetadataFile module, Handle handle, out bool newTabPage)

6
ILSpy/Options/DecompilerSettingsPanel.xaml.cs

@ -16,12 +16,12 @@ @@ -16,12 +16,12 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Composition;
using System.Xml.Linq;
using ICSharpCode.ILSpyX.Settings;
using TomsToolbox.Wpf.Composition.Mef;
using TomsToolbox.Wpf.Composition.AttributedModel;
namespace ICSharpCode.ILSpy.Options
{
@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpy.Options @@ -29,7 +29,7 @@ namespace ICSharpCode.ILSpy.Options
/// Interaction logic for DecompilerSettingsPanel.xaml
/// </summary>
[DataTemplate(typeof(DecompilerSettingsViewModel))]
[PartCreationPolicy(CreationPolicy.NonShared)]
[NonShared]
internal partial class DecompilerSettingsPanel
{
public DecompilerSettingsPanel()

4
ILSpy/Options/DecompilerSettingsViewModel.cs

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.Composition;
using System.Composition;
using System.Linq;
using System.Reflection;
@ -30,7 +30,7 @@ using TomsToolbox.Wpf; @@ -30,7 +30,7 @@ using TomsToolbox.Wpf;
namespace ICSharpCode.ILSpy.Options
{
[ExportOptionPage(Order = 10)]
[PartCreationPolicy(CreationPolicy.NonShared)]
[NonShared]
public sealed class DecompilerSettingsViewModel : ObservableObjectBase, IOptionPage
{
private static readonly PropertyInfo[] propertyInfos = typeof(Decompiler.DecompilerSettings).GetProperties()

6
ILSpy/Options/DisplaySettingsPanel.xaml.cs

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.ComponentModel.Composition;
using System.Composition;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
@ -29,7 +29,7 @@ using System.Xml.Linq; @@ -29,7 +29,7 @@ using System.Xml.Linq;
using ICSharpCode.ILSpyX.Settings;
using TomsToolbox.Wpf.Composition.Mef;
using TomsToolbox.Wpf.Composition.AttributedModel;
using TomsToolbox.Wpf.Converters;
namespace ICSharpCode.ILSpy.Options
@ -37,7 +37,7 @@ namespace ICSharpCode.ILSpy.Options @@ -37,7 +37,7 @@ namespace ICSharpCode.ILSpy.Options
/// <summary>
/// Interaction logic for DisplaySettingsPanel.xaml
/// </summary>
[PartCreationPolicy(CreationPolicy.NonShared)]
[NonShared]
[DataTemplate(typeof(DisplaySettingsViewModel))]
public partial class DisplaySettingsPanel
{

4
ILSpy/Options/DisplaySettingsViewModel.cs

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
using System.Windows.Media;
using System.Xml.Linq;
using System;
using System.ComponentModel.Composition;
using System.Composition;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
@ -13,7 +13,7 @@ using ICSharpCode.ILSpy.Themes; @@ -13,7 +13,7 @@ using ICSharpCode.ILSpy.Themes;
namespace ICSharpCode.ILSpy.Options
{
[ExportOptionPage(Order = 20)]
[PartCreationPolicy(CreationPolicy.NonShared)]
[NonShared]
public class DisplaySettingsViewModel : ObservableObject, IOptionPage
{
private DisplaySettings settings = new();

6
ILSpy/Options/MiscSettingsPanel.xaml.cs

@ -16,11 +16,11 @@ @@ -16,11 +16,11 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Composition;
using System.Windows.Controls;
using System.Xml.Linq;
using TomsToolbox.Wpf.Composition.Mef;
using TomsToolbox.Wpf.Composition.AttributedModel;
namespace ICSharpCode.ILSpy.Options
{
@ -28,7 +28,7 @@ namespace ICSharpCode.ILSpy.Options @@ -28,7 +28,7 @@ namespace ICSharpCode.ILSpy.Options
/// Interaction logic for MiscSettingsPanel.xaml
/// </summary>
[DataTemplate(typeof(MiscSettingsViewModel))]
[PartCreationPolicy(CreationPolicy.NonShared)]
[NonShared]
public partial class MiscSettingsPanel
{
public MiscSettingsPanel()

4
ILSpy/Options/MiscSettingsViewModel.cs

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Composition;
using System.IO;
using System.Reflection;
using System.Windows;
@ -33,7 +33,7 @@ using TomsToolbox.Wpf; @@ -33,7 +33,7 @@ using TomsToolbox.Wpf;
namespace ICSharpCode.ILSpy.Options
{
[ExportOptionPage(Order = 30)]
[PartCreationPolicy(CreationPolicy.NonShared)]
[NonShared]
public class MiscSettingsViewModel : ObservableObject, IOptionPage
{
private MiscSettings settings;

5
ILSpy/Options/OptionsDialog.xaml.cs

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.ComponentModel.Composition;
using System.Composition;
using ICSharpCode.ILSpy.AssemblyTree;
using ICSharpCode.ILSpy.Properties;
@ -58,12 +58,11 @@ namespace ICSharpCode.ILSpy.Options @@ -58,12 +58,11 @@ namespace ICSharpCode.ILSpy.Options
}
[ExportMainMenuCommand(ParentMenuID = nameof(Resources._View), Header = nameof(Resources._Options), MenuCategory = nameof(Resources.Options), MenuOrder = 999)]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class ShowOptionsCommand : SimpleCommand
{
private readonly AssemblyTreeModel assemblyTreeModel;
[ImportingConstructor]
public ShowOptionsCommand(AssemblyTreeModel assemblyTreeModel)
{
this.assemblyTreeModel = assemblyTreeModel;

8
ILSpy/Search/SearchPane.xaml.cs

@ -21,7 +21,7 @@ using System.Collections.Concurrent; @@ -21,7 +21,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.ComponentModel.Composition;
using System.Composition;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Threading;
@ -41,7 +41,7 @@ using ICSharpCode.ILSpyX.Search; @@ -41,7 +41,7 @@ using ICSharpCode.ILSpyX.Search;
using TomsToolbox.Essentials;
using TomsToolbox.Wpf;
using TomsToolbox.Wpf.Composition.Mef;
using TomsToolbox.Wpf.Composition.AttributedModel;
namespace ICSharpCode.ILSpy.Search
{
@ -49,7 +49,7 @@ namespace ICSharpCode.ILSpy.Search @@ -49,7 +49,7 @@ namespace ICSharpCode.ILSpy.Search
/// Search pane
/// </summary>
[DataTemplate(typeof(SearchPaneModel))]
[PartCreationPolicy(CreationPolicy.NonShared)]
[NonShared]
public partial class SearchPane
{
const int MAX_RESULTS = 1000;
@ -535,7 +535,7 @@ namespace ICSharpCode.ILSpy.Search @@ -535,7 +535,7 @@ namespace ICSharpCode.ILSpy.Search
}
[ExportToolbarCommand(ToolTip = nameof(Properties.Resources.SearchCtrlShiftFOrCtrlE), ToolbarIcon = "Images/Search", ToolbarCategory = nameof(Properties.Resources.View), ToolbarOrder = 100)]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class ShowSearchCommand : CommandWrapper
{
public ShowSearchCommand()

4
ILSpy/Search/SearchPaneModel.cs

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Composition;
using System.Windows.Input;
using System.Windows.Media;
@ -33,7 +33,7 @@ namespace ICSharpCode.ILSpy.Search @@ -33,7 +33,7 @@ namespace ICSharpCode.ILSpy.Search
}
[ExportToolPane]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
[Export]
public class SearchPaneModel : ToolPaneModel
{

6
ILSpy/TextView/EditorCommands.cs

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

6
ILSpy/TextView/FoldingCommands.cs

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

14
ILSpy/TreeNodes/AssemblyTreeNode.cs

@ -18,7 +18,7 @@ @@ -18,7 +18,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Composition;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
@ -580,7 +580,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -580,7 +580,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
[ExportContextMenuEntry(Header = nameof(Resources._Remove), Icon = "images/Delete")]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class RemoveAssembly : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
@ -607,7 +607,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -607,7 +607,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
[ExportContextMenuEntry(Header = nameof(Resources._Reload), Icon = "images/Refresh")]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class ReloadAssembly : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
@ -642,7 +642,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -642,7 +642,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
[ExportContextMenuEntry(Header = nameof(Resources._LoadDependencies), Category = nameof(Resources.Dependencies))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class LoadDependencies : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
@ -682,7 +682,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -682,7 +682,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
[ExportContextMenuEntry(Header = nameof(Resources._AddMainList), Category = nameof(Resources.Dependencies))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class AddToMainList : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
@ -717,7 +717,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -717,7 +717,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
[ExportContextMenuEntry(Header = nameof(Resources._OpenContainingFolder), Category = nameof(Resources.Shell))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class OpenContainingFolder : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)
@ -770,7 +770,7 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -770,7 +770,7 @@ namespace ICSharpCode.ILSpy.TreeNodes
}
[ExportContextMenuEntry(Header = nameof(Resources._OpenCommandLineHere), Category = nameof(Resources.Shell))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class OpenCmdHere : IContextMenuEntry
{
public bool IsVisible(TextViewContext context)

4
ILSpy/TreeNodes/ResourceNodes/CursorResourceEntryNode.cs

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.ComponentModel.Composition;
using System.Composition;
using System.IO;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
@ -31,7 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions; @@ -31,7 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ICSharpCode.ILSpy.TreeNodes
{
[Export(typeof(IResourceNodeFactory))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class CursorResourceNodeFactory : IResourceNodeFactory
{
static readonly string[] imageFileExtensions = { ".cur" };

4
ILSpy/TreeNodes/ResourceNodes/IconResourceEntryNode.cs

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.ComponentModel.Composition;
using System.Composition;
using System.IO;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
@ -31,7 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions; @@ -31,7 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ICSharpCode.ILSpy.TreeNodes
{
[Export(typeof(IResourceNodeFactory))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class IconResourceNodeFactory : IResourceNodeFactory
{
public ITreeNode CreateNode(Resource resource)

4
ILSpy/TreeNodes/ResourceNodes/ImageListResourceEntryNode.cs

@ -16,7 +16,7 @@ @@ -16,7 +16,7 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Composition;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
@ -28,7 +28,7 @@ using ICSharpCode.ILSpyX.Abstractions; @@ -28,7 +28,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ICSharpCode.ILSpy.TreeNodes
{
[Export(typeof(IResourceNodeFactory))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class ImageListResourceEntryNodeFactory : IResourceNodeFactory
{
public ITreeNode CreateNode(Resource resource)

4
ILSpy/TreeNodes/ResourceNodes/ImageResourceEntryNode.cs

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.ComponentModel.Composition;
using System.Composition;
using System.IO;
using System.Windows.Controls;
using System.Windows.Media.Imaging;
@ -31,7 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions; @@ -31,7 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ICSharpCode.ILSpy.TreeNodes
{
[Export(typeof(IResourceNodeFactory))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class ImageResourceNodeFactory : IResourceNodeFactory
{
static readonly string[] imageFileExtensions = { ".png", ".gif", ".bmp", ".jpg" };

4
ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs

@ -19,7 +19,7 @@ @@ -19,7 +19,7 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.Composition;
using System.Composition;
using System.IO;
using System.Linq;
@ -38,7 +38,7 @@ using Microsoft.Win32; @@ -38,7 +38,7 @@ using Microsoft.Win32;
namespace ICSharpCode.ILSpy.TreeNodes
{
[Export(typeof(IResourceNodeFactory))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class ResourcesFileTreeNodeFactory : IResourceNodeFactory
{
public ITreeNode CreateNode(Resource resource)

4
ILSpy/TreeNodes/ResourceNodes/XamlResourceNode.cs

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.ComponentModel.Composition;
using System.Composition;
using System.IO;
using System.Threading.Tasks;
@ -31,7 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions; @@ -31,7 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ICSharpCode.ILSpy.Xaml
{
[Export(typeof(IResourceNodeFactory))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class XamlResourceNodeFactory : IResourceNodeFactory
{
public ITreeNode CreateNode(Resource resource)

4
ILSpy/TreeNodes/ResourceNodes/XmlResourceNode.cs

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
// DEALINGS IN THE SOFTWARE.
using System;
using System.ComponentModel.Composition;
using System.Composition;
using System.IO;
using System.Threading.Tasks;
@ -31,7 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions; @@ -31,7 +31,7 @@ using ICSharpCode.ILSpyX.Abstractions;
namespace ICSharpCode.ILSpy.Xaml
{
[Export(typeof(IResourceNodeFactory))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
sealed class XmlResourceNodeFactory : IResourceNodeFactory
{
private readonly static string[] xmlFileExtensions = { ".xml", ".xsd", ".xslt" };

4
ILSpy/TreeNodes/ThreadingSupport.cs

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

4
ILSpy/ViewModels/DebugStepsPaneModel.cs

@ -16,14 +16,14 @@ @@ -16,14 +16,14 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
using System.ComponentModel.Composition;
using System.Composition;
using System.Windows;
namespace ICSharpCode.ILSpy.ViewModels
{
#if DEBUG
[ExportToolPane]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
#endif
public class DebugStepsPaneModel : ToolPaneModel
{

6
ILSpy/Views/DebugSteps.xaml.cs

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
using System;
using System.ComponentModel;
using System.ComponentModel.Composition;
using System.Composition;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
@ -10,12 +10,12 @@ using ICSharpCode.Decompiler.IL.Transforms; @@ -10,12 +10,12 @@ using ICSharpCode.Decompiler.IL.Transforms;
using ICSharpCode.ILSpy.Docking;
using ICSharpCode.ILSpy.ViewModels;
using TomsToolbox.Wpf.Composition.Mef;
using TomsToolbox.Wpf.Composition.AttributedModel;
namespace ICSharpCode.ILSpy
{
[DataTemplate(typeof(DebugStepsPaneModel))]
[PartCreationPolicy(CreationPolicy.NonShared)]
[NonShared]
public partial class DebugSteps : UserControl
{
static readonly ILAstWritingOptions writingOptions = new ILAstWritingOptions {

4
TestPlugin/AboutPageAddition.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System.ComponentModel.Composition;
using System.Composition;
using System.Windows;
using System.Windows.Media;
@ -11,7 +11,7 @@ using ICSharpCode.ILSpy; @@ -11,7 +11,7 @@ using ICSharpCode.ILSpy;
namespace TestPlugin
{
[Export(typeof(IAboutPageAddition))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
public class AboutPageAddition : IAboutPageAddition
{
public void Write(ISmartTextOutput textOutput)

4
TestPlugin/ContextMenuCommand.cs

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

4
TestPlugin/CustomLanguage.cs

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System.ComponentModel.Composition;
using System.Composition;
using System.Reflection.Metadata;
using System.Windows.Controls;
@ -15,7 +15,7 @@ namespace TestPlugin @@ -15,7 +15,7 @@ namespace TestPlugin
/// Adds a new language to the decompiler.
/// </summary>
[Export(typeof(Language))]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
public class CustomLanguage : Language
{
public override string Name {

8
TestPlugin/CustomOptionPage.xaml.cs

@ -1,19 +1,19 @@ @@ -1,19 +1,19 @@
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
// This code is distributed under MIT X11 license (for details please see \doc\license.txt)
using System.ComponentModel.Composition;
using System.Composition;
using System.Xml.Linq;
using ICSharpCode.ILSpy.Options;
using ICSharpCode.ILSpy.Util;
using TomsToolbox.Wpf;
using TomsToolbox.Wpf.Composition.Mef;
using TomsToolbox.Wpf.Composition.AttributedModel;
namespace TestPlugin
{
[DataTemplate(typeof(CustomOptionsViewModel))]
[PartCreationPolicy(CreationPolicy.NonShared)]
[NonShared]
partial class CustomOptionPage
{
public CustomOptionPage()
@ -23,7 +23,7 @@ namespace TestPlugin @@ -23,7 +23,7 @@ namespace TestPlugin
}
[ExportOptionPage(Order = 0)]
[PartCreationPolicy(CreationPolicy.NonShared)]
[NonShared]
class CustomOptionsViewModel : ObservableObject, IOptionPage
{
private Options options;

4
TestPlugin/MainMenuCommand.cs

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

2
TestPlugin/Readme.txt

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
ILSpy uses MEF (Managed Extensibility Framework) for plugins.
Plugins must be placed in the same directory as ILSpy.exe, and must be called "*.Plugin.dll".
To write a plugin, you need to add a reference to ILSpy.exe and to System.ComponentModel.Composition.
To write a plugin, you need to add a reference to ILSpy.exe and to System.Composition.AttributedModel.
Depending on what your plugin is doing, you might also need references to the other libraries shipping with ILSpy.
Plugins work by exporting types for certain extension points.

Loading…
Cancel
Save