Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move non-UI analyzer code to ILSpyX #3186

Merged
merged 2 commits into from
Mar 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Move non-UI analyzer code to ILSpyX
  • Loading branch information
christophwille committed Mar 29, 2024
commit 8acd117f91f5b6206222466052f36c04232da3fa
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -35,6 +35,7 @@
<PackageVersion Include="NuGet.Protocol" Version="6.9.1" />
<PackageVersion Include="PowerShellStandard.Library" Version="5.1.1" />
<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.0" />
3 changes: 3 additions & 0 deletions ICSharpCode.ILSpyX/Abstractions/ILanguage.cs
Original file line number Diff line number Diff line change
@@ -16,6 +16,8 @@
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.

using System.Reflection.Metadata;

using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.TypeSystem;

@@ -24,6 +26,7 @@ namespace ICSharpCode.ILSpyX.Abstractions
public interface ILanguage
{
bool ShowMember(IEntity member);
CodeMappingInfo GetCodeMappingInfo(MetadataFile module, EntityHandle member);
string GetEntityName(MetadataFile module, System.Reflection.Metadata.EntityHandle handle, bool fullName, bool omitGenerics);
string GetTooltip(IEntity entity);

Original file line number Diff line number Diff line change
@@ -23,16 +23,16 @@

using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpyX;
using ICSharpCode.ILSpyX.Abstractions;

namespace ICSharpCode.ILSpy.Analyzers
namespace ICSharpCode.ILSpyX.Analyzers
{
/// <summary>
/// Provides additional context for analyzers.
/// </summary>
public class AnalyzerContext
{
public AssemblyList AssemblyList { get; internal set; }

Check failure on line 35 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / build

Non-nullable property 'AssemblyList' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check failure on line 35 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / Analyze (csharp)

Non-nullable property 'AssemblyList' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check failure on line 35 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / Analyze (csharp)

Non-nullable property 'AssemblyList' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

/// <summary>
/// CancellationToken. Currently Analyzers do not support cancellation from the UI, but it should be checked nonetheless.
@@ -42,7 +42,7 @@
/// <summary>
/// Currently used language.
/// </summary>
public Language Language { get; internal set; }
public ILanguage Language { get; internal set; }

Check failure on line 45 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / build

Non-nullable property 'Language' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check failure on line 45 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / Analyze (csharp)

Non-nullable property 'Language' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check failure on line 45 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / Analyze (csharp)

Non-nullable property 'Language' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

/// <summary>
/// Allows the analyzer to control whether the tree nodes will be sorted.
@@ -54,16 +54,16 @@
public MethodBodyBlock GetMethodBody(IMethod method)
{
if (!method.HasBody || method.MetadataToken.IsNil)
return null;

Check failure on line 57 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / build

Possible null reference return.

Check failure on line 57 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / build

Possible null reference return.

Check failure on line 57 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / Analyze (csharp)

Possible null reference return.

Check failure on line 57 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / Analyze (csharp)

Possible null reference return.
var module = method.ParentModule.MetadataFile;

Check failure on line 58 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / build

Dereference of a possibly null reference.

Check failure on line 58 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / build

Dereference of a possibly null reference.

Check failure on line 58 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / Analyze (csharp)

Dereference of a possibly null reference.

Check failure on line 58 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / Analyze (csharp)

Dereference of a possibly null reference.
var md = module.Metadata.GetMethodDefinition((MethodDefinitionHandle)method.MetadataToken);

Check failure on line 59 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / build

Dereference of a possibly null reference.

Check failure on line 59 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / build

Dereference of a possibly null reference.

Check failure on line 59 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / Analyze (csharp)

Dereference of a possibly null reference.

Check failure on line 59 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / Analyze (csharp)

Dereference of a possibly null reference.
try
{
return module.GetMethodBody(md.RelativeVirtualAddress);
}
catch (BadImageFormatException)
{
return null;

Check failure on line 66 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / build

Possible null reference return.

Check failure on line 66 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / Analyze (csharp)

Possible null reference return.

Check failure on line 66 in ICSharpCode.ILSpyX/Analyzers/AnalyzerContext.cs

GitHub Actions / Analyze (csharp)

Possible null reference return.
}
}

Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@
using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.TypeSystem;

namespace ICSharpCode.ILSpy.Analyzers
namespace ICSharpCode.ILSpyX.Analyzers
{
internal static class AnalyzerHelpers
{
@@ -34,7 +34,7 @@
{
case HandleKind.MethodDefinition:
return member == analyzedMethod.MetadataToken
&& module == analyzedMethod.ParentModule.MetadataFile;

Check failure on line 37 in ICSharpCode.ILSpyX/Analyzers/AnalyzerHelpers.cs

GitHub Actions / Analyze (csharp)

Dereference of a possibly null reference.
case HandleKind.MemberReference:
var mr = metadata.GetMemberReference((MemberReferenceHandle)member);
if (mr.GetKind() != MemberReferenceKind.Method)
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
using ICSharpCode.Decompiler.Util;
using ICSharpCode.ILSpyX;

namespace ICSharpCode.ILSpy.Analyzers
namespace ICSharpCode.ILSpyX.Analyzers
{
using ICSharpCode.Decompiler.TypeSystem;

@@ -61,12 +61,12 @@
public IEnumerable<MetadataFile> GetModulesInScope(CancellationToken ct)
{
if (IsLocal)
return new[] { TypeScope.ParentModule.MetadataFile };

Check failure on line 64 in ICSharpCode.ILSpyX/Analyzers/AnalyzerScope.cs

GitHub Actions / build

Dereference of a possibly null reference.

Check failure on line 64 in ICSharpCode.ILSpyX/Analyzers/AnalyzerScope.cs

GitHub Actions / build

Nullability of reference types in value of type 'MetadataFile?[]' doesn't match target type 'IEnumerable<MetadataFile>'.

Check failure on line 64 in ICSharpCode.ILSpyX/Analyzers/AnalyzerScope.cs

GitHub Actions / build

Dereference of a possibly null reference.

Check failure on line 64 in ICSharpCode.ILSpyX/Analyzers/AnalyzerScope.cs

GitHub Actions / build

Nullability of reference types in value of type 'MetadataFile?[]' doesn't match target type 'IEnumerable<MetadataFile>'.

if (effectiveAccessibility.LessThanOrEqual(Accessibility.Internal))
return GetModuleAndAnyFriends(TypeScope, ct);

return GetReferencingModules(TypeScope.ParentModule.MetadataFile, ct);

Check failure on line 69 in ICSharpCode.ILSpyX/Analyzers/AnalyzerScope.cs

GitHub Actions / build

Dereference of a possibly null reference.

Check failure on line 69 in ICSharpCode.ILSpyX/Analyzers/AnalyzerScope.cs

GitHub Actions / build

Possible null reference argument for parameter 'self' in 'IEnumerable<MetadataFile> AnalyzerScope.GetReferencingModules(MetadataFile self, CancellationToken ct)'.

Check failure on line 69 in ICSharpCode.ILSpyX/Analyzers/AnalyzerScope.cs

GitHub Actions / build

Dereference of a possibly null reference.
}

public IEnumerable<MetadataFile> GetAllModules()
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.Decompiler.Util;

namespace ICSharpCode.ILSpy.Analyzers.Builtin
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
[ExportAnalyzer(Header = "Applied To", Order = 10)]
class AttributeAppliedToAnalyzer : IAnalyzer
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@

using ICSharpCode.Decompiler.TypeSystem;

namespace ICSharpCode.ILSpy.Analyzers.Builtin
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
/// <summary>
/// Shows events that implement an interface event.
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@

using ICSharpCode.Decompiler.TypeSystem;

namespace ICSharpCode.ILSpy.Analyzers.Builtin
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
/// <summary>
/// Shows events that override an event.
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@

using ILOpCode = System.Reflection.Metadata.ILOpCode;

namespace ICSharpCode.ILSpy.Analyzers.Builtin
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
/// <summary>
/// Finds methods where this field is read.
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.TypeSystem;

namespace ICSharpCode.ILSpy.Analyzers.Builtin
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
public enum TokenSearchResult : byte
{
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@

using ICSharpCode.Decompiler.TypeSystem;

namespace ICSharpCode.ILSpy.Analyzers.Builtin
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
/// <summary>
/// Shows members from all corresponding interfaces the selected member implements.
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@

using ICSharpCode.Decompiler.TypeSystem;

namespace ICSharpCode.ILSpy.Analyzers.Builtin
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
/// <summary>
/// Shows methods that implement an interface method.
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@

using ICSharpCode.Decompiler.TypeSystem;

namespace ICSharpCode.ILSpy.Analyzers.Builtin
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
/// <summary>
/// Shows methods that override a method.
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@
using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.TypeSystem;

namespace ICSharpCode.ILSpy.Analyzers.Builtin
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
/// <summary>
/// Shows entities that are used by a method.
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.TypeSystem;

namespace ICSharpCode.ILSpy.Analyzers.Builtin
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
/// <summary>
/// Shows entities that are used by a method.
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.TypeSystem;

namespace ICSharpCode.ILSpy.Analyzers.Builtin
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
/// <summary>
/// Shows entities that are used by a method.
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@

using ICSharpCode.Decompiler.TypeSystem;

namespace ICSharpCode.ILSpy.Analyzers.Builtin
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
/// <summary>
/// Shows properties that implement an interface property.
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@

using ICSharpCode.Decompiler.TypeSystem;

namespace ICSharpCode.ILSpy.Analyzers.Builtin
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
/// <summary>
/// Shows properties that override a property.
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
using System.Threading.Tasks;


namespace ICSharpCode.ILSpy.Analyzers.Builtin
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
using ICSharpCode.Decompiler.TypeSystem;

Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
using System.Collections.Generic;
// Copyright (c) 2018 Siegfried Pammer
//
// 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.Collections.Generic;
using System.ComponentModel.Composition;
using System.Diagnostics;

using ICSharpCode.Decompiler.TypeSystem;

namespace ICSharpCode.ILSpy.Analyzers.Builtin
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
/// <summary>
/// Finds all extension methods defined for a type.
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@
using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.TypeSystem;

namespace ICSharpCode.ILSpy.Analyzers.Builtin
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
/// <summary>
/// Shows methods that instantiate a type.
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@
using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.TypeSystem;

namespace ICSharpCode.ILSpy.Analyzers.Builtin
namespace ICSharpCode.ILSpyX.Analyzers.Builtin
{
/// <summary>
/// Shows entities that use a type.
@@ -107,7 +107,7 @@
if (found || ScanMethodBody(analyzedType, module, md, decoder))
{
var method = typeSystem.MainModule.GetDefinition(h);
yield return method?.AccessorOwner ?? method;

Check failure on line 110 in ICSharpCode.ILSpyX/Analyzers/Builtin/TypeUsedByAnalyzer.cs

GitHub Actions / Analyze (csharp)

Possible null reference return.
}
}

@@ -408,7 +408,7 @@
public override IType VisitTypeDefinition(ITypeDefinition type)
{
Found |= TypeDefinition.MetadataToken == type.MetadataToken
&& TypeDefinition.ParentModule.MetadataFile == type.ParentModule.MetadataFile;

Check failure on line 411 in ICSharpCode.ILSpyX/Analyzers/Builtin/TypeUsedByAnalyzer.cs

GitHub Actions / build

Dereference of a possibly null reference.

Check failure on line 411 in ICSharpCode.ILSpyX/Analyzers/Builtin/TypeUsedByAnalyzer.cs

GitHub Actions / build

Dereference of a possibly null reference.

Check failure on line 411 in ICSharpCode.ILSpyX/Analyzers/Builtin/TypeUsedByAnalyzer.cs

GitHub Actions / Analyze (csharp)

Dereference of a possibly null reference.

Check failure on line 411 in ICSharpCode.ILSpyX/Analyzers/Builtin/TypeUsedByAnalyzer.cs

GitHub Actions / Analyze (csharp)

Dereference of a possibly null reference.

Check failure on line 411 in ICSharpCode.ILSpyX/Analyzers/Builtin/TypeUsedByAnalyzer.cs

GitHub Actions / Analyze (csharp)

Dereference of a possibly null reference.

Check failure on line 411 in ICSharpCode.ILSpyX/Analyzers/Builtin/TypeUsedByAnalyzer.cs

GitHub Actions / Analyze (csharp)

Dereference of a possibly null reference.
return base.VisitTypeDefinition(type);
}

Original file line number Diff line number Diff line change
@@ -19,13 +19,13 @@
using System;
using System.ComponentModel.Composition;

namespace ICSharpCode.ILSpy.Analyzers
namespace ICSharpCode.ILSpyX.Analyzers
{
[MetadataAttribute]
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
public class ExportAnalyzerAttribute : ExportAttribute, IAnalyzerMetadata
{
public ExportAnalyzerAttribute() : base("Analyzer", typeof(IAnalyzer))

Check failure on line 28 in ICSharpCode.ILSpyX/Analyzers/ExportAnalyzerAttribute.cs

GitHub Actions / build

Non-nullable property 'Header' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check failure on line 28 in ICSharpCode.ILSpyX/Analyzers/ExportAnalyzerAttribute.cs

GitHub Actions / build

Non-nullable property 'Header' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check failure on line 28 in ICSharpCode.ILSpyX/Analyzers/ExportAnalyzerAttribute.cs

GitHub Actions / Analyze (csharp)

Non-nullable property 'Header' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check failure on line 28 in ICSharpCode.ILSpyX/Analyzers/ExportAnalyzerAttribute.cs

GitHub Actions / Analyze (csharp)

Non-nullable property 'Header' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
{ }

public string Header { get; set; }
Original file line number Diff line number Diff line change
@@ -20,7 +20,7 @@

using ICSharpCode.Decompiler.TypeSystem;

namespace ICSharpCode.ILSpy.Analyzers
namespace ICSharpCode.ILSpyX.Analyzers
{
/// <summary>
/// Base interface for all analyzers. You can register an analyzer for any <see cref="ISymbol"/> by implementing
1 change: 1 addition & 0 deletions ICSharpCode.ILSpyX/ICSharpCode.ILSpyX.csproj
Original file line number Diff line number Diff line change
@@ -62,6 +62,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="System.ComponentModel.Composition" />
<PackageReference Include="System.Reflection.Metadata" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
<PackageReference Include="System.Composition" />
2 changes: 1 addition & 1 deletion ILSpy.Tests/Analyzers/AnalyzerScopeTests.cs
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@
using ICSharpCode.Decompiler.CSharp.Resolver;
using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpy.Analyzers;
using ICSharpCode.ILSpyX.Analyzers;

using NUnit.Framework;

Original file line number Diff line number Diff line change
@@ -25,8 +25,8 @@
using ICSharpCode.Decompiler.Metadata;
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.Decompiler.TypeSystem.Implementation;
using ICSharpCode.ILSpy.Analyzers;
using ICSharpCode.ILSpy.Analyzers.Builtin;
using ICSharpCode.ILSpyX.Analyzers;
using ICSharpCode.ILSpyX.Analyzers.Builtin;

using NSubstitute;

4 changes: 2 additions & 2 deletions ILSpy.Tests/Analyzers/MethodUsesAnalyzerTests.cs
Original file line number Diff line number Diff line change
@@ -6,9 +6,9 @@
using System.Windows;

using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpy.Analyzers;
using ICSharpCode.ILSpy.Analyzers.Builtin;
using ICSharpCode.ILSpyX;
using ICSharpCode.ILSpyX.Analyzers;
using ICSharpCode.ILSpyX.Analyzers.Builtin;

using NUnit.Framework;

4 changes: 2 additions & 2 deletions ILSpy.Tests/Analyzers/TypeUsedByAnalyzerTests.cs
Original file line number Diff line number Diff line change
@@ -19,9 +19,9 @@
using System.Linq;

using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpy.Analyzers;
using ICSharpCode.ILSpy.Analyzers.Builtin;
using ICSharpCode.ILSpyX;
using ICSharpCode.ILSpyX.Analyzers;
using ICSharpCode.ILSpyX.Analyzers.Builtin;

using NUnit.Framework;

1 change: 1 addition & 0 deletions ILSpy/Analyzers/AnalyzerSearchTreeNode.cs
Original file line number Diff line number Diff line change
@@ -25,6 +25,7 @@
using ICSharpCode.ILSpy.Analyzers.TreeNodes;
using ICSharpCode.ILSpy.TreeNodes;
using ICSharpCode.ILSpyX;
using ICSharpCode.ILSpyX.Analyzers;

namespace ICSharpCode.ILSpy.Analyzers
{
1 change: 1 addition & 0 deletions ILSpy/Analyzers/TreeNodes/AnalyzedEventTreeNode.cs
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@
namespace ICSharpCode.ILSpy.Analyzers.TreeNodes
{
using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpyX.Analyzers;

internal sealed class AnalyzedEventTreeNode : AnalyzerEntityTreeNode
{
1 change: 1 addition & 0 deletions ILSpy/Analyzers/TreeNodes/AnalyzedFieldTreeNode.cs
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@

using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpy.TreeNodes;
using ICSharpCode.ILSpyX.Analyzers;

namespace ICSharpCode.ILSpy.Analyzers.TreeNodes
{
1 change: 1 addition & 0 deletions ILSpy/Analyzers/TreeNodes/AnalyzedMethodTreeNode.cs
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@

using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpy.TreeNodes;
using ICSharpCode.ILSpyX.Analyzers;

namespace ICSharpCode.ILSpy.Analyzers.TreeNodes
{
1 change: 1 addition & 0 deletions ILSpy/Analyzers/TreeNodes/AnalyzedModuleTreeNode.cs
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
using System.Windows;

using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpyX.Analyzers;

namespace ICSharpCode.ILSpy.Analyzers.TreeNodes
{
1 change: 1 addition & 0 deletions ILSpy/Analyzers/TreeNodes/AnalyzedPropertyTreeNode.cs
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@

using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpy.TreeNodes;
using ICSharpCode.ILSpyX.Analyzers;

namespace ICSharpCode.ILSpy.Analyzers.TreeNodes
{
1 change: 1 addition & 0 deletions ILSpy/Analyzers/TreeNodes/AnalyzedTypeTreeNode.cs
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@

using ICSharpCode.Decompiler.TypeSystem;
using ICSharpCode.ILSpy.TreeNodes;
using ICSharpCode.ILSpyX.Analyzers;

namespace ICSharpCode.ILSpy.Analyzers.TreeNodes
{
7 changes: 6 additions & 1 deletion ILSpy/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@
using System.Windows.Threading;

using ICSharpCode.ILSpy.Options;
using ICSharpCode.ILSpyX.Analyzers;
using ICSharpCode.ILSpyX.Settings;

using Microsoft.VisualStudio.Composition;
@@ -131,9 +132,13 @@ private static async Task InitializeMef()
}
}
}
// Add the built-in parts
// Add the built-in parts: First, from ILSpyX
var xParts = await discovery.CreatePartsAsync(typeof(IAnalyzer).Assembly);
catalog = catalog.AddParts(xParts);
// 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();