Browse Source

Merge pull request #3308 from tom-englert/dev/DependencyInjection

Migrate DI from Microsoft.VisualStudio.Composition to Microsoft.Extensions.DependencyInjection
pull/3314/head
Siegfried Pammer 7 months ago committed by GitHub
parent
commit
c3261a3c09
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      .editorconfig
  2. 8
      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. 106
      ILSpy/App.xaml.cs
  31. 6
      ILSpy/AssemblyTree/AssemblyListPane.xaml.cs
  32. 48
      ILSpy/AssemblyTree/AssemblyTreeModel.cs
  33. 5
      ILSpy/Commands/BrowseBackCommand.cs
  34. 5
      ILSpy/Commands/BrowseForwardCommand.cs
  35. 4
      ILSpy/Commands/CheckForUpdatesCommand.cs
  36. 4
      ILSpy/Commands/CopyFullyQualifiedNameContextMenuEntry.cs
  37. 9
      ILSpy/Commands/DecompileAllCommand.cs
  38. 4
      ILSpy/Commands/DecompileCommand.cs
  39. 5
      ILSpy/Commands/DecompileInNewViewCommand.cs
  40. 4
      ILSpy/Commands/DisassembleAllCommand.cs
  41. 4
      ILSpy/Commands/ExitCommand.cs
  42. 2
      ILSpy/Commands/ExportCommandAttribute.cs
  43. 4
      ILSpy/Commands/ExtractPackageEntryContextMenuEntry.cs
  44. 6
      ILSpy/Commands/GeneratePdbContextMenuEntry.cs
  45. 4
      ILSpy/Commands/ManageAssemblyListsCommand.cs
  46. 5
      ILSpy/Commands/OpenCommand.cs
  47. 5
      ILSpy/Commands/OpenFromGacCommand.cs
  48. 6
      ILSpy/Commands/Pdb2XmlCommand.cs
  49. 5
      ILSpy/Commands/RefreshCommand.cs
  50. 8
      ILSpy/Commands/RemoveAssembliesWithLoadErrors.cs
  51. 4
      ILSpy/Commands/SaveCodeContextMenuEntry.cs
  52. 5
      ILSpy/Commands/SaveCommand.cs
  53. 5
      ILSpy/Commands/ScopeSearchToAssembly.cs
  54. 5
      ILSpy/Commands/ScopeSearchToNamespace.cs
  55. 4
      ILSpy/Commands/SearchMsdnContextMenuEntry.cs
  56. 4
      ILSpy/Commands/SelectPdbContextMenuEntry.cs
  57. 4
      ILSpy/Commands/ShowCFGContextMenuEntry.cs
  58. 6
      ILSpy/Commands/SortAssemblyListCommand.cs
  59. 2
      ILSpy/ContextMenuEntry.cs
  60. 6
      ILSpy/Docking/CloseAllDocumentsCommand.cs
  61. 103
      ILSpy/ExportProviderAdapter.cs
  62. 44
      ILSpy/ExtensionMethods.cs
  63. 6
      ILSpy/ILSpy.csproj
  64. 4
      ILSpy/Languages/CSharpILMixedLanguage.cs
  65. 7
      ILSpy/Languages/CSharpLanguage.cs
  66. 4
      ILSpy/Languages/ILLanguage.cs
  67. 6
      ILSpy/Metadata/GoToTokenCommand.cs
  68. 4
      ILSpy/Metadata/MetadataProtocolHandler.cs
  69. 6
      ILSpy/Options/DecompilerSettingsPanel.xaml.cs
  70. 4
      ILSpy/Options/DecompilerSettingsViewModel.cs
  71. 6
      ILSpy/Options/DisplaySettingsPanel.xaml.cs
  72. 4
      ILSpy/Options/DisplaySettingsViewModel.cs
  73. 6
      ILSpy/Options/MiscSettingsPanel.xaml.cs
  74. 4
      ILSpy/Options/MiscSettingsViewModel.cs
  75. 5
      ILSpy/Options/OptionsDialog.xaml.cs
  76. 8
      ILSpy/Search/SearchPane.xaml.cs
  77. 4
      ILSpy/Search/SearchPaneModel.cs
  78. 6
      ILSpy/TextView/EditorCommands.cs
  79. 6
      ILSpy/TextView/FoldingCommands.cs
  80. 14
      ILSpy/TreeNodes/AssemblyTreeNode.cs
  81. 4
      ILSpy/TreeNodes/ResourceNodes/CursorResourceEntryNode.cs
  82. 4
      ILSpy/TreeNodes/ResourceNodes/IconResourceEntryNode.cs
  83. 4
      ILSpy/TreeNodes/ResourceNodes/ImageListResourceEntryNode.cs
  84. 4
      ILSpy/TreeNodes/ResourceNodes/ImageResourceEntryNode.cs
  85. 4
      ILSpy/TreeNodes/ResourceNodes/ResourcesFileTreeNode.cs
  86. 4
      ILSpy/TreeNodes/ResourceNodes/XamlResourceNode.cs
  87. 4
      ILSpy/TreeNodes/ResourceNodes/XmlResourceNode.cs
  88. 4
      ILSpy/TreeNodes/ThreadingSupport.cs
  89. 4
      ILSpy/ViewModels/DebugStepsPaneModel.cs
  90. 6
      ILSpy/Views/DebugSteps.xaml.cs
  91. 4
      TestPlugin/AboutPageAddition.cs
  92. 4
      TestPlugin/ContextMenuCommand.cs
  93. 4
      TestPlugin/CustomLanguage.cs
  94. 8
      TestPlugin/CustomOptionPage.xaml.cs
  95. 4
      TestPlugin/MainMenuCommand.cs
  96. 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

8
Directory.Packages.props

@ -23,12 +23,12 @@ @@ -23,12 +23,12 @@
<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.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" />
<PackageVersion Include="Microsoft.NETCore.ILDAsm" Version="8.0.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Microsoft.VisualStudio.Composition" Version="17.11.13" />
<PackageVersion Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.135" />
<PackageVersion Include="Mono.Cecil" Version="0.11.6" />
<PackageVersion Include="NaturalSort.Extension" Version="4.3.0" />
@ -38,15 +38,15 @@ @@ -38,15 +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)

106
ILSpy/App.xaml.cs

@ -23,7 +23,6 @@ using System.IO; @@ -23,7 +23,6 @@ using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Loader;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Documents;
@ -36,8 +35,6 @@ using ICSharpCode.ILSpyX.Analyzers; @@ -36,8 +35,6 @@ using ICSharpCode.ILSpyX.Analyzers;
using Medo.Application;
using Microsoft.VisualStudio.Composition;
using TomsToolbox.Wpf.Styles;
using ICSharpCode.ILSpyX.TreeView;
@ -47,6 +44,11 @@ using ICSharpCode.ILSpy.Themes; @@ -47,6 +44,11 @@ using ICSharpCode.ILSpy.Themes;
using System.Globalization;
using System.Threading;
using Microsoft.Extensions.DependencyInjection;
using TomsToolbox.Composition.MicrosoftExtensions;
using TomsToolbox.Essentials;
namespace ICSharpCode.ILSpy
{
/// <summary>
@ -59,10 +61,9 @@ namespace ICSharpCode.ILSpy @@ -59,10 +61,9 @@ namespace ICSharpCode.ILSpy
public static IExportProvider ExportProvider { get; private set; }
internal class ExceptionData
internal record ExceptionData(Exception Exception)
{
public Exception Exception;
public string PluginName;
public string PluginName { get; init; }
}
public App()
@ -80,6 +81,14 @@ namespace ICSharpCode.ILSpy @@ -80,6 +81,14 @@ namespace ICSharpCode.ILSpy
InitializeComponent();
if (!InitializeDependencyInjection(SettingsService.Instance))
{
// There is something completely wrong with DI, probably some service registration is missing => nothing we can do to recover, so stop and shut down.
Exit += (_, _) => MessageBox.Show(StartupExceptions.FormatExceptions(), "Sorry we crashed!");
Shutdown(1);
return;
}
if (!Debugger.IsAttached)
{
AppDomain.CurrentDomain.UnhandledException += ShowErrorBox;
@ -92,8 +101,6 @@ namespace ICSharpCode.ILSpy @@ -92,8 +101,6 @@ namespace ICSharpCode.ILSpy
Resources.RegisterDefaultStyles();
InitializeMef().GetAwaiter().GetResult();
// Register the export provider so that it can be accessed from WPF/XAML components.
ExportProviderLocator.Register(ExportProvider);
// Add data templates registered via MEF.
@ -103,7 +110,7 @@ namespace ICSharpCode.ILSpy @@ -103,7 +110,7 @@ namespace ICSharpCode.ILSpy
ThemeManager.Current.Theme = sessionSettings.Theme;
if (!string.IsNullOrEmpty(sessionSettings.CurrentCulture))
{
Thread.CurrentThread.CurrentUICulture = CultureInfo.DefaultThreadCurrentUICulture = new CultureInfo(sessionSettings.CurrentCulture);
Thread.CurrentThread.CurrentUICulture = CultureInfo.DefaultThreadCurrentUICulture = new(sessionSettings.CurrentCulture);
}
EventManager.RegisterClassHandler(typeof(Window),
@ -125,6 +132,13 @@ namespace ICSharpCode.ILSpy @@ -125,6 +132,13 @@ namespace ICSharpCode.ILSpy
SettingsService.Instance.AssemblyListManager.CreateDefaultAssemblyLists();
}
public new static App Current => (App)Application.Current;
public new MainWindow MainWindow {
get => (MainWindow)base.MainWindow;
set => base.MainWindow = value;
}
private static void SingleInstance_NewInstanceDetected(object sender, NewInstanceEventArgs e) => ExportProvider.GetExportedValue<AssemblyTreeModel>().HandleSingleInstanceCommandLineArguments(e.Args).HandleExceptions();
static Assembly ResolvePluginDependencies(AssemblyLoadContext context, AssemblyName assemblyName)
@ -136,22 +150,17 @@ namespace ICSharpCode.ILSpy @@ -136,22 +150,17 @@ namespace ICSharpCode.ILSpy
return context.LoadFromAssemblyPath(assemblyFileName);
}
private static async Task InitializeMef()
private static bool InitializeDependencyInjection(SettingsService settingsService)
{
// Add custom logic for resolution of dependencies.
// This necessary because the AssemblyLoadContext.LoadFromAssemblyPath and related methods,
// do not automatically load dependencies.
AssemblyLoadContext.Default.Resolving += ResolvePluginDependencies;
// Cannot show MessageBox here, because WPF would crash with a XamlParseException
// Remember and show exceptions in text output, once MainWindow is properly initialized
try
{
// Set up VS MEF. For now, only do MEF1 part discovery, since that was in use before.
// To support both MEF1 and MEF2 parts, just change this to:
// var discovery = PartDiscovery.Combine(new AttributedPartDiscoveryV1(Resolver.DefaultInstance),
// new AttributedPartDiscovery(Resolver.DefaultInstance));
var discovery = new AttributedPartDiscoveryV1(Resolver.DefaultInstance);
var catalog = ComposableCatalog.Create(Resolver.DefaultInstance);
var services = new ServiceCollection();
var pluginDir = Path.GetDirectoryName(typeof(App).Module.FullyQualifiedName);
if (pluginDir != null)
{
@ -160,46 +169,39 @@ namespace ICSharpCode.ILSpy @@ -160,46 +169,39 @@ namespace ICSharpCode.ILSpy
var name = Path.GetFileNameWithoutExtension(plugin);
try
{
var asm = AssemblyLoadContext.Default.LoadFromAssemblyPath(plugin);
var parts = await discovery.CreatePartsAsync(asm);
catalog = catalog.AddParts(parts);
var assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(plugin);
services.BindExports(assembly);
}
catch (Exception ex)
{
StartupExceptions.Add(new ExceptionData { Exception = ex, PluginName = name });
// Cannot show MessageBox here, because WPF would crash with a XamlParseException
// Remember and show exceptions in text output, once MainWindow is properly initialized
StartupExceptions.Add(new(ex) { PluginName = name });
}
}
}
// Add the built-in parts: First, from ILSpyX
var xParts = await discovery.CreatePartsAsync(typeof(IAnalyzer).Assembly);
catalog = catalog.AddParts(xParts);
services.BindExports(typeof(IAnalyzer).Assembly);
// Then from ILSpy itself
var createdParts = await discovery.CreatePartsAsync(Assembly.GetExecutingAssembly());
catalog = catalog.AddParts(createdParts);
// If/When the project switches to .NET Standard/Core, this will be needed to allow metadata interfaces (as opposed
// to metadata classes). When running on .NET Framework, it's automatic.
// catalog.WithDesktopSupport();
// If/When any part needs to import ICompositionService, this will be needed:
// catalog.WithCompositionService();
var config = CompositionConfiguration.Create(catalog);
var exportProviderFactory = config.CreateExportProviderFactory();
ExportProvider = new ExportProviderAdapter(exportProviderFactory.CreateExportProvider());
// This throws exceptions for composition failures. Alternatively, the configuration's CompositionErrors property
// could be used to log the errors directly. Used at the end so that it does not prevent the export provider setup.
config.ThrowOnErrors();
}
catch (CompositionFailedException ex) when (ex.InnerException is AggregateException agex)
{
foreach (var inner in agex.InnerExceptions)
{
StartupExceptions.Add(new ExceptionData { Exception = inner });
}
services.BindExports(Assembly.GetExecutingAssembly());
// Add the settings service
services.AddSingleton(settingsService);
var serviceProvider = services.BuildServiceProvider(new ServiceProviderOptions { ValidateOnBuild = true });
ExportProvider = new ExportProviderAdapter(serviceProvider);
return true;
}
catch (Exception ex)
{
StartupExceptions.Add(new ExceptionData { Exception = ex });
if (ex is AggregateException aggregate)
StartupExceptions.AddRange(aggregate.InnerExceptions.Select(item => new ExceptionData(ex)));
else
StartupExceptions.Add(new(ex));
return false;
}
}
@ -207,15 +209,7 @@ namespace ICSharpCode.ILSpy @@ -207,15 +209,7 @@ namespace ICSharpCode.ILSpy
{
base.OnStartup(e);
var output = new StringBuilder();
if (StartupExceptions.FormatExceptions(output))
{
MessageBox.Show(output.ToString(), "Sorry we crashed!");
Environment.Exit(1);
}
MainWindow = new MainWindow();
MainWindow = new();
MainWindow.Show();
}

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()

48
ILSpy/AssemblyTree/AssemblyTreeModel.cs

@ -20,19 +20,18 @@ using System; @@ -20,19 +20,18 @@ 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;
using System.Reflection.Metadata;
using System.Reflection.Metadata.Ecma335;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using System.Windows.Navigation;
using System.Windows.Threading;
using ICSharpCode.Decompiler;
using ICSharpCode.Decompiler.Documentation;
using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.TypeSystem;
@ -56,7 +55,7 @@ using TomsToolbox.Wpf; @@ -56,7 +55,7 @@ using TomsToolbox.Wpf;
namespace ICSharpCode.ILSpy.AssemblyTree
{
[ExportToolPane]
[PartCreationPolicy(CreationPolicy.Shared)]
[Shared]
[Export]
public class AssemblyTreeModel : ToolPaneModel
{
@ -160,13 +159,15 @@ namespace ICSharpCode.ILSpy.AssemblyTree @@ -160,13 +159,15 @@ namespace ICSharpCode.ILSpy.AssemblyTree
/// Called on startup or when passed arguments via WndProc from a second instance.
/// In the format case, spySettings is non-null; in the latter it is null.
/// </summary>
private void HandleCommandLineArgumentsAfterShowList(CommandLineArguments args, ISettingsProvider? spySettings = null)
private async Task HandleCommandLineArgumentsAfterShowList(CommandLineArguments args, ISettingsProvider? spySettings = null)
{
var sessionSettings = SettingsService.Instance.SessionSettings;
var relevantAssemblies = commandLineLoadedAssemblies.ToList();
commandLineLoadedAssemblies.Clear(); // clear references once we don't need them anymore
NavigateOnLaunch(args.NavigateTo, sessionSettings.ActiveTreeViewPath, spySettings, relevantAssemblies);
await NavigateOnLaunch(args.NavigateTo, sessionSettings.ActiveTreeViewPath, spySettings, relevantAssemblies);
if (args.Search != null)
{
var searchPane = App.ExportProvider.GetExportedValue<SearchPaneModel>();
@ -180,7 +181,7 @@ namespace ICSharpCode.ILSpy.AssemblyTree @@ -180,7 +181,7 @@ namespace ICSharpCode.ILSpy.AssemblyTree
{
var cmdArgs = CommandLineArguments.Create(args);
await Dispatcher.InvokeAsync(() => {
await Dispatcher.InvokeAsync(async () => {
if (!HandleCommandLineArguments(cmdArgs))
return;
@ -192,11 +193,11 @@ namespace ICSharpCode.ILSpy.AssemblyTree @@ -192,11 +193,11 @@ namespace ICSharpCode.ILSpy.AssemblyTree
window.WindowState = WindowState.Normal;
}
HandleCommandLineArgumentsAfterShowList(cmdArgs);
await HandleCommandLineArgumentsAfterShowList(cmdArgs);
});
}
private async void NavigateOnLaunch(string? navigateTo, string[]? activeTreeViewPath, ISettingsProvider? spySettings, List<LoadedAssembly> relevantAssemblies)
private async Task NavigateOnLaunch(string? navigateTo, string[]? activeTreeViewPath, ISettingsProvider? spySettings, List<LoadedAssembly> relevantAssemblies)
{
var initialSelection = SelectedItem;
if (navigateTo != null)
@ -386,26 +387,31 @@ namespace ICSharpCode.ILSpy.AssemblyTree @@ -386,26 +387,31 @@ namespace ICSharpCode.ILSpy.AssemblyTree
Dispatcher.BeginInvoke(DispatcherPriority.Loaded, OpenAssemblies);
}
private void OpenAssemblies()
private async Task OpenAssemblies()
{
HandleCommandLineArgumentsAfterShowList(App.CommandLineArguments, SettingsService.Instance.SpySettings);
await HandleCommandLineArgumentsAfterShowList(App.CommandLineArguments, SettingsService.Instance.SpySettings);
AvalonEditTextOutput output = new();
if (FormatExceptions(App.StartupExceptions.ToArray(), output))
if (FormatExceptions(App.StartupExceptions.ToArray(), out var output))
{
output.Title = "Startup errors";
DockWorkspace.Instance.AddTabPage();
DockWorkspace.Instance.ShowText(output);
}
}
private static bool FormatExceptions(App.ExceptionData[] exceptions, ITextOutput output)
private static bool FormatExceptions(App.ExceptionData[] exceptions, [NotNullWhen(true)] out AvalonEditTextOutput? output)
{
var stringBuilder = new StringBuilder();
var result = exceptions.FormatExceptions(stringBuilder);
if (result)
{
output.Write(stringBuilder.ToString());
}
return result;
output = null;
var result = exceptions.FormatExceptions();
if (result.IsNullOrEmpty())
return false;
output = new();
output.Write(result);
return true;
}
private void ShowAssemblyList(string name)

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)

103
ILSpy/ExportProviderAdapter.cs

@ -1,103 +0,0 @@ @@ -1,103 +0,0 @@
// Copyright (c) 2024 Tom Englert for the SharpDevelop Team
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
// software and associated documentation files (the "Software"), to deal in the Software
// without restriction, including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
// to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
// 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;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using Microsoft.VisualStudio.Composition;
using TomsToolbox.Composition;
using TomsToolbox.Essentials;
namespace ICSharpCode.ILSpy;
#nullable enable
/// <summary>
/// Adapter for Microsoft.VisualStudio.Composition.<see cref="ExportProvider"/> to <see cref="IExportProvider"/>.
/// </summary>
public sealed class ExportProviderAdapter : IExportProvider
{
private static readonly Type DefaultMetadataType = typeof(Dictionary<string, object>);
private readonly ExportProvider _exportProvider;
/// <summary>
/// Initializes a new instance of the <see cref="ExportProviderAdapter"/> class.
/// </summary>
/// <param name="exportProvider">The export provider.</param>
public ExportProviderAdapter(ExportProvider exportProvider)
{
_exportProvider = exportProvider;
}
event EventHandler<EventArgs>? IExportProvider.ExportsChanged { add { } remove { } }
T IExportProvider.GetExportedValue<T>(string? contractName) where T : class
{
return _exportProvider.GetExportedValue<T>(contractName) ?? throw new InvalidOperationException($"No export found for type {typeof(T).FullName} with contract '{contractName}'");
}
T? IExportProvider.GetExportedValueOrDefault<T>(string? contractName) where T : class
{
return _exportProvider.GetExportedValues<T>(contractName).SingleOrDefault();
}
bool IExportProvider.TryGetExportedValue<T>(string? contractName, [NotNullWhen(true)] out T? value) where T : class
{
value = _exportProvider.GetExportedValues<T>(contractName).SingleOrDefault();
return !Equals(value, default(T));
}
IEnumerable<T> IExportProvider.GetExportedValues<T>(string? contractName) where T : class
{
return _exportProvider.GetExportedValues<T>(contractName);
}
IEnumerable<object> IExportProvider.GetExportedValues(Type contractType, string? contractName)
{
return _exportProvider
.GetExports(contractType, DefaultMetadataType, contractName)
.Select(item => item.Value)
.ExceptNullItems();
}
IEnumerable<IExport<object>> IExportProvider.GetExports(Type contractType, string? contractName)
{
return _exportProvider
.GetExports(contractType, DefaultMetadataType, contractName)
.Select(item => new ExportAdapter<object>(() => item.Value, new MetadataAdapter((IDictionary<string, object?>)item.Metadata)));
}
IEnumerable<IExport<T>> IExportProvider.GetExports<T>(string? contractName) where T : class
{
return _exportProvider
.GetExports(typeof(T), DefaultMetadataType, contractName)
.Select(item => new ExportAdapter<T>(() => (T?)item.Value, new MetadataAdapter((IDictionary<string, object?>)item.Metadata)));
}
IEnumerable<IExport<T, TMetadataView>> IExportProvider.GetExports<T, TMetadataView>(string? contractName) where T : class where TMetadataView : class
{
return _exportProvider
.GetExports<T, TMetadataView>(contractName)
.Select(item => new ExportAdapter<T, TMetadataView>(() => item.Value, item.Metadata));
}
}

44
ILSpy/ExtensionMethods.cs

@ -20,6 +20,7 @@ @@ -20,6 +20,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
@ -166,34 +167,37 @@ namespace ICSharpCode.ILSpy @@ -166,34 +167,37 @@ namespace ICSharpCode.ILSpy
return color?.R * 0.3 + color?.G * 0.6 + color?.B * 0.1 ?? 0.0;
}
internal static bool FormatExceptions(this IList<App.ExceptionData> exceptions, StringBuilder output)
internal static string? FormatExceptions(this IList<App.ExceptionData> exceptions)
{
if (exceptions.Count == 0)
return false;
bool first = true;
return null;
foreach (var item in exceptions)
{
if (first)
first = false;
else
output.AppendLine("-------------------------------------------------");
string delimiter = $"-------------------------------------------------{Environment.NewLine}";
return string.Join(delimiter, exceptions.Select(FormatException));
}
private static string FormatException(App.ExceptionData item)
{
var output = new StringBuilder();
if (!item.PluginName.IsNullOrEmpty())
output.AppendLine("Error(s) loading plugin: " + item.PluginName);
if (item.Exception is System.Reflection.ReflectionTypeLoadException exception)
{
foreach (var ex in exception.LoaderExceptions.ExceptNullItems())
{
output.AppendLine(ex.ToString());
output.AppendLine();
}
}
else
if (item.Exception is System.Reflection.ReflectionTypeLoadException exception)
{
foreach (var ex in exception.LoaderExceptions.ExceptNullItems())
{
output.AppendLine(item.Exception.ToString());
output.AppendLine(ex.ToString());
output.AppendLine();
}
}
else
{
output.AppendLine(item.Exception.ToString());
}
return true;
return output.ToString();
}
public static IDisposable PreserveFocus(this IInputElement? inputElement, bool preserve = true)

6
ILSpy/ILSpy.csproj

@ -45,12 +45,12 @@ @@ -45,12 +45,12 @@
<PackageReference Include="AvalonEdit" />
<PackageReference Include="Dirkster.AvalonDock.Themes.VS2013" />
<PackageReference Include="McMaster.Extensions.CommandLineUtils" />
<PackageReference Include="Microsoft.VisualStudio.Composition" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
<PackageReference Include="DataGridExtensions" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" />
<PackageReference Include="NaturalSort.Extension" />
<PackageReference Include="TomsToolbox.Wpf.Composition" />
<PackageReference Include="TomsToolbox.Wpf.Composition.Mef" />
<PackageReference Include="TomsToolbox.Composition.MicrosoftExtensions" />
<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