AssemblyAnalyzer
Namespace: Dotsider.Core.Analysis
Assembly: Dotsider.Core.dll
Core analyzer that reads a .NET assembly and extracts PE, metadata, IL, and string information. Uses PEReader and MetadataReader from the BCL.
public sealed class AssemblyAnalyzer : IDisposableInheritance
Section titled “Inheritance”Object → AssemblyAnalyzer
Implements
Section titled “Implements”Constructors
Section titled “Constructors”AssemblyAnalyzer(byte[], string)
Section titled “AssemblyAnalyzer(byte[], string)”Creates an analyzer from raw bytes in memory. Used as a last-resort fallback when disk I/O is unavailable after a save operation.
Parameters:
public AssemblyAnalyzer(byte[] bytes, string filePath)AssemblyAnalyzer(string)
Section titled “AssemblyAnalyzer(string)”Opens and analyzes the specified .NET assembly file.
Parameters:
filePath(String): Absolute path to the assembly file.
public AssemblyAnalyzer(string filePath)Properties
Section titled “Properties”Architecture
Section titled “Architecture”The PE architecture description (e.g., “AnyCPU”, “x64”, “ARM64”).
Returns: String
public string Architecture { get; }AssemblyName
Section titled “AssemblyName”The assembly simple name, or null if the file has no assembly manifest.
Returns: String
public string? AssemblyName { get; }AssemblyRefs
Section titled “AssemblyRefs”Gets the AssemblyRef metadata table entries.
Returns: IReadOnlyList<AssemblyRefInfo>
public IReadOnlyList<AssemblyRefInfo> AssemblyRefs { get; }AssemblyVersion
Section titled “AssemblyVersion”The assembly version string, or null.
Returns: String
public string? AssemblyVersion { get; }ClrHeader
Section titled “ClrHeader”The parsed CLR header, or null if not a .NET assembly.
Returns: ClrHeader
public ClrHeader? ClrHeader { get; }CreatedTime
Section titled “CreatedTime”The creation time in UTC.
Returns: DateTime
public DateTime CreatedTime { get; }Culture
Section titled “Culture”The assembly culture, or null for culture-neutral assemblies.
Returns: String
public string? Culture { get; }CustomAttributes
Section titled “CustomAttributes”Gets the custom attributes applied to metadata entities.
Returns: IReadOnlyList<CustomAttributeInfo>
public IReadOnlyList<CustomAttributeInfo> CustomAttributes { get; }FileName
Section titled “FileName”The file name without directory path.
Returns: String
public string FileName { get; }FilePath
Section titled “FilePath”The full path to the analyzed assembly file.
Returns: String
public string FilePath { get; }FileSize
Section titled “FileSize”The file size in bytes.
Returns: Int64
public long FileSize { get; }HasMetadata
Section titled “HasMetadata”Whether the PE file contains .NET metadata.
Returns: Boolean
public bool HasMetadata { get; }IsReadOnly
Section titled “IsReadOnly”Whether the file is read-only on disk.
Returns: Boolean
public bool IsReadOnly { get; }LastModified
Section titled “LastModified”The last modification time in UTC.
Returns: DateTime
public DateTime LastModified { get; }MemberRefs
Section titled “MemberRefs”Gets the MemberRef metadata table entries.
Returns: IReadOnlyList<MemberRefInfo>
public IReadOnlyList<MemberRefInfo> MemberRefs { get; }MethodDefs
Section titled “MethodDefs”Gets the MethodDef metadata table entries.
Returns: IReadOnlyList<MethodDefInfo>
public IReadOnlyList<MethodDefInfo> MethodDefs { get; }PeHeaders
Section titled “PeHeaders”The parsed PE headers.
Returns: PeHeaders
public PeHeaders? PeHeaders { get; }PublicKeyToken
Section titled “PublicKeyToken”The public key token as a hex string, or null.
Returns: String
public string? PublicKeyToken { get; }RawBytes
Section titled “RawBytes”Gets the raw bytes of the file for hex editor display.
Returns: ReadOnlyMemory<Byte>
public ReadOnlyMemory<byte> RawBytes { get; }Resources
Section titled “Resources”Gets the manifest resources defined in the assembly.
Returns: IReadOnlyList<ResourceInfo>
public IReadOnlyList<ResourceInfo> Resources { get; }Sections
Section titled “Sections”Gets the PE sections.
Returns: IReadOnlyList<SectionInfo>
public IReadOnlyList<SectionInfo> Sections { get; }TargetFramework
Section titled “TargetFramework”The target framework moniker (e.g., ”.NETCoreApp,Version=v10.0”), or null.
Returns: String
public string? TargetFramework { get; }TypeDefs
Section titled “TypeDefs”Gets the TypeDef metadata table entries.
Returns: IReadOnlyList<TypeDefInfo>
public IReadOnlyList<TypeDefInfo> TypeDefs { get; }TypeRefs
Section titled “TypeRefs”Gets the TypeRef metadata table entries.
Returns: IReadOnlyList<TypeRefInfo>
public IReadOnlyList<TypeRefInfo> TypeRefs { get; }Methods
Section titled “Methods”Dispose()
Section titled “Dispose()”Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()GetMetadataReader()
Section titled “GetMetadataReader()”Gets the underlying MetadataReader for advanced queries. Returns null if the file has no .NET metadata.
Returns: MetadataReader
public MetadataReader? GetMetadataReader()GetMethodBody(MethodDefInfo)
Section titled “GetMethodBody(MethodDefInfo)”Gets the method body bytes for IL disassembly. Returns null if the method has no IL body (abstract, extern, or native).
Parameters:
method(MethodDefInfo): The method definition to get the body for.
Returns: MethodBodyBlock
The method body block, or null.
public MethodBodyBlock? GetMethodBody(MethodDefInfo method)ResolveAssemblyPath(string, string)
Section titled “ResolveAssemblyPath(string, string)”Attempts to resolve a referenced assembly name to a file path on disk. Searches the same directory as the referencing assembly, then .NET runtime dirs.
Parameters:
Returns: String
public static string? ResolveAssemblyPath(string referencingAssemblyPath, string assemblyName)ResolveToken(int)
Section titled “ResolveToken(int)”Resolves a metadata token to a human-readable name.
Parameters:
token(Int32): The metadata token to resolve.
Returns: String
A display string for the token.
public string ResolveToken(int token)