-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a debug page and track the assembly version that is used to sign …
…and verify sig
- Loading branch information
1 parent
e3f9922
commit 3b2cbf7
Showing
4 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@page "/debug" | ||
|
||
@using Angor.Shared.Utilities | ||
@inject ILogger<DebugPage> Logger | ||
|
||
<PageTitle>Debug Page</PageTitle> | ||
|
||
<h3>Assembly Information</h3> | ||
|
||
@foreach (var assembly in assemblyInfos) | ||
{ | ||
<div class="card mb-3"> | ||
<div class="card-header"> | ||
<h5>@assembly.Name</h5> | ||
</div> | ||
<div class="card-body"> | ||
<p><strong>Version:</strong> @assembly.Version</p> | ||
<p><strong>Full Name:</strong> @assembly.FullName</p> | ||
<p><strong>Location:</strong> @assembly.Location</p> | ||
<p><strong>Image Runtime Version:</strong> @assembly.ImageRuntimeVersion</p> | ||
<p><strong>Entry Point:</strong> @assembly.EntryPoint</p> | ||
<p><strong>Referenced Assemblies:</strong></p> | ||
<ul> | ||
@foreach (var referencedAssembly in assembly.ReferencedAssemblies) | ||
{ | ||
<li>@referencedAssembly</li> | ||
} | ||
</ul> | ||
</div> | ||
</div> | ||
} | ||
|
||
@code { | ||
private List<AssemblyInfo> assemblyInfos = new(); | ||
|
||
protected override void OnInitialized() | ||
{ | ||
assemblyInfos = AssemblyInfoHelper.GetAllAssembliesInfo(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
using System.Reflection; | ||
using Microsoft.Extensions.Logging; | ||
|
||
public static class AssemblyInfoHelper | ||
{ | ||
public static List<AssemblyInfo> GetAllAssembliesInfo() | ||
{ | ||
var assemblies = AppDomain.CurrentDomain.GetAssemblies(); | ||
var assemblyInfos = new List<AssemblyInfo>(); | ||
|
||
foreach (var assembly in assemblies) | ||
{ | ||
var assemblyInfo = new AssemblyInfo | ||
{ | ||
Name = assembly.GetName().Name, | ||
Version = assembly.GetName().Version?.ToString() ?? "Version not found", | ||
FullName = assembly.FullName, | ||
Location = assembly.Location, | ||
ImageRuntimeVersion = assembly.ImageRuntimeVersion, | ||
EntryPoint = assembly.EntryPoint?.ToString() ?? "No entry point", | ||
ReferencedAssemblies = assembly.GetReferencedAssemblies().Select(a => a.FullName).ToList() | ||
}; | ||
|
||
assemblyInfos.Add(assemblyInfo); | ||
} | ||
|
||
return assemblyInfos; | ||
} | ||
} | ||
|
||
public class AssemblyInfo | ||
{ | ||
public string Name { get; set; } | ||
public string Version { get; set; } | ||
public string FullName { get; set; } | ||
public string Location { get; set; } | ||
public string ImageRuntimeVersion { get; set; } | ||
public string EntryPoint { get; set; } | ||
public List<string> ReferencedAssemblies { get; set; } = new(); | ||
} | ||
|
||
public static class AssemblyLogger | ||
{ | ||
public static void LogAssemblyVersion(Type type, ILogger logger) | ||
{ | ||
var assembly = type.Assembly; | ||
var version = assembly.GetName().Version?.ToString() ?? "Version not found"; | ||
var name = assembly.GetName().Name; | ||
logger.LogInformation($"Assembly: {name}, Version: {version}"); | ||
} | ||
} |