Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 1 addition & 2 deletions FolderDiffIL4DotNet.Benchmarks/FolderDiffBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@
{
var files = Directory.GetFiles(_smallDirPath).Take(2).ToArray();
if (files.Length < 2) return false;
var comparer = new FileComparer();
return comparer.ComputeMd5Hash(files[0]) == comparer.ComputeMd5Hash(files[1]);
return FileComparer.ComputeFileMd5Hex(files[0]) == FileComparer.ComputeFileMd5Hex(files[1]);
}

private static string CreateTempFolderWithFiles(string prefix, int fileCount, int fileSizeBytes)
Expand All @@ -81,7 +80,7 @@

private static void TryDeleteDir(string path)
{
try { if (Directory.Exists(path)) Directory.Delete(path, true); } catch { }

Check warning on line 83 in FolderDiffIL4DotNet.Benchmarks/FolderDiffBenchmarks.cs

View workflow job for this annotation

GitHub Actions / build

Modify 'TryDeleteDir' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)

Check warning on line 83 in FolderDiffIL4DotNet.Benchmarks/FolderDiffBenchmarks.cs

View workflow job for this annotation

GitHub Actions / build

Modify 'TryDeleteDir' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)

Check warning on line 83 in FolderDiffIL4DotNet.Benchmarks/FolderDiffBenchmarks.cs

View workflow job for this annotation

GitHub Actions / test-windows

Modify 'TryDeleteDir' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)

Check warning on line 83 in FolderDiffIL4DotNet.Benchmarks/FolderDiffBenchmarks.cs

View workflow job for this annotation

GitHub Actions / test-windows

Modify 'TryDeleteDir' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)

Check warning on line 83 in FolderDiffIL4DotNet.Benchmarks/FolderDiffBenchmarks.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Modify 'TryDeleteDir' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)

Check warning on line 83 in FolderDiffIL4DotNet.Benchmarks/FolderDiffBenchmarks.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Modify 'TryDeleteDir' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)

Check warning on line 83 in FolderDiffIL4DotNet.Benchmarks/FolderDiffBenchmarks.cs

View workflow job for this annotation

GitHub Actions / build

Modify 'TryDeleteDir' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)

Check warning on line 83 in FolderDiffIL4DotNet.Benchmarks/FolderDiffBenchmarks.cs

View workflow job for this annotation

GitHub Actions / build

Modify 'TryDeleteDir' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)

Check warning on line 83 in FolderDiffIL4DotNet.Benchmarks/FolderDiffBenchmarks.cs

View workflow job for this annotation

GitHub Actions / test-windows

Modify 'TryDeleteDir' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)

Check warning on line 83 in FolderDiffIL4DotNet.Benchmarks/FolderDiffBenchmarks.cs

View workflow job for this annotation

GitHub Actions / test-windows

Modify 'TryDeleteDir' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)

Check warning on line 83 in FolderDiffIL4DotNet.Benchmarks/FolderDiffBenchmarks.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Modify 'TryDeleteDir' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)

Check warning on line 83 in FolderDiffIL4DotNet.Benchmarks/FolderDiffBenchmarks.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

Modify 'TryDeleteDir' to catch a more specific allowed exception type, or rethrow the exception (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1031)
}
}
}
8 changes: 4 additions & 4 deletions FolderDiffIL4DotNet.Core/IO/FileSystemUtility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ private static bool IsLikelyWindowsNetworkPath(string absolutePath)
return true;
}

string root = TryGetPathRoot(absolutePath);
string? root = TryGetPathRoot(absolutePath);
return !string.IsNullOrEmpty(root) && IsNetworkDrive(root);
}

Expand Down Expand Up @@ -325,13 +325,13 @@ private static bool IsLikelyMacNetworkPath(string absolutePath)

private static bool IsLikelyUnixNetworkPath(string absolutePath)
{
string mountsFile = GetUnixMountsFilePath();
string? mountsFile = GetUnixMountsFilePath();
if (mountsFile == null)
{
return false;
}

string fullPath = TryGetFullPath(absolutePath);
string? fullPath = TryGetFullPath(absolutePath);
if (fullPath == null)
{
return false;
Expand All @@ -343,7 +343,7 @@ private static bool IsLikelyUnixNetworkPath(string absolutePath)
return false;
}

string bestFsType = GetBestMatchingMountFileSystemType(fullPath, mountLines);
string? bestFsType = GetBestMatchingMountFileSystemType(fullPath, mountLines);
return !string.IsNullOrEmpty(bestFsType) && s_unixNetworkFsTypes.Contains(bestFsType);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@

private sealed class FakeILOutputService : IILOutputService
{
public (bool AreEqual, string DisassemblerLabel) DiffResult { get; set; }
public (bool AreEqual, string? DisassemblerLabel) DiffResult { get; set; }

Check warning on line 471 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 471 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 471 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / test-windows

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 471 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / test-windows

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 471 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 471 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 471 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 471 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 471 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / test-windows

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 471 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / test-windows

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 471 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 471 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

public Exception DiffException { get; set; }

Expand All @@ -482,7 +482,7 @@
return Task.CompletedTask;
}

public Task<(bool AreEqual, string DisassemblerLabel)> DiffDotNetAssembliesAsync(string fileRelativePath, string oldFolderAbsolutePath, string newFolderAbsolutePath, bool shouldOutputIlText)
public Task<(bool AreEqual, string? DisassemblerLabel)> DiffDotNetAssembliesAsync(string fileRelativePath, string oldFolderAbsolutePath, string newFolderAbsolutePath, bool shouldOutputIlText)

Check warning on line 485 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 485 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 485 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / test-windows

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 485 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / test-windows

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 485 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 485 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 485 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 485 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / build

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 485 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / test-windows

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 485 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / test-windows

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 485 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.

Check warning on line 485 in FolderDiffIL4DotNet.Tests/Services/FileDiffServiceUnitTests.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

The annotation for nullable reference types should only be used in code within a '#nullable' annotations context.
{
DiffCalls.Add(new DiffCall(fileRelativePath, oldFolderAbsolutePath, newFolderAbsolutePath, shouldOutputIlText));
if (DiffException != null)
Expand Down
2 changes: 1 addition & 1 deletion FolderDiffIL4DotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<DefaultItemExcludes>$(DefaultItemExcludes);FolderDiffIL4DotNet.Tests/**;FolderDiffIL4DotNet.Core/**</DefaultItemExcludes>
<DefaultItemExcludes>$(DefaultItemExcludes);FolderDiffIL4DotNet.Tests/**;FolderDiffIL4DotNet.Core/**;FolderDiffIL4DotNet.Benchmarks/**</DefaultItemExcludes>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<Nullable>enable</Nullable>
Expand Down
2 changes: 1 addition & 1 deletion Models/FileDiffResultLists.cs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public void RecordIgnoredFile(string fileRelativePath, IgnoredFileLocation locat
/// Records the disassembler tool name and version used.
/// 使用した逆アセンブラ名とバージョンを記録します。
/// </summary>
public void RecordDisassemblerToolVersion(string toolName, string version, bool fromCache = false)
public void RecordDisassemblerToolVersion(string toolName, string? version, bool fromCache = false)
{
if (string.IsNullOrWhiteSpace(toolName))
{
Expand Down
22 changes: 11 additions & 11 deletions ProgramRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,33 +123,33 @@ private async Task<ProgramRunResult> RunWithResultAsync(string[] args, CliOption
var runArgumentsResult = TryValidateAndBuildRunArguments(args, opts);
if (!runArgumentsResult.IsSuccess)
{
return runArgumentsResult.Failure;
return runArgumentsResult.Failure!;
}

var runArguments = runArgumentsResult.Value;
var runArguments = runArgumentsResult.Value!;
var prepareReportsDirectoryResult = TryPrepareReportsDirectory(runArguments.ReportsFolderAbsolutePath);
if (!prepareReportsDirectoryResult.IsSuccess)
{
return prepareReportsDirectoryResult.Failure;
return prepareReportsDirectoryResult.Failure!;
}

var configResult = await TryLoadConfigurationAsync(opts.ConfigPath);
if (!configResult.IsSuccess)
{
return configResult.Failure;
return configResult.Failure!;
}

var config = configResult.Value;
var config = configResult.Value!;
ApplyCliOverrides(config, opts);

var completionStateResult = await TryExecuteRunAsync(runArguments, config, appVersion, computerName);
if (!completionStateResult.IsSuccess)
{
return completionStateResult.Failure;
return completionStateResult.Failure!;
}

_logger.LogMessage(AppLogLevel.Info, LOG_APP_FINISHED, shouldOutputMessageToConsole: true, ConsoleColor.Green);
return ProgramRunResult.Success(completionStateResult.Value);
return ProgramRunResult.Success(completionStateResult.Value!);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -274,7 +274,7 @@ private StepResult<bool> TryPrepareReportsDirectory(string reportsFolderAbsolute
/// Returns the configuration loading phase as a typed result.
/// 設定読込フェーズを型付き結果として返します。
/// </summary>
private async Task<StepResult<ConfigSettings>> TryLoadConfigurationAsync(string configPath)
private async Task<StepResult<ConfigSettings>> TryLoadConfigurationAsync(string? configPath)
{
try
{
Expand Down Expand Up @@ -373,7 +373,7 @@ private static void PrepareReportsDirectory(string reportsFolderAbsolutePath)
Directory.CreateDirectory(reportsFolderAbsolutePath);
}

private async Task<ConfigSettings> LoadConfigurationAsync(string configPath)
private async Task<ConfigSettings> LoadConfigurationAsync(string? configPath)
{
_logger.LogMessage(AppLogLevel.Info, LOG_LOADING_CONFIGURATION, shouldOutputMessageToConsole: true);
var config = await _configService.LoadConfigAsync(configPath);
Expand Down Expand Up @@ -472,7 +472,7 @@ private static bool ShouldSkipExitPrompt(CliOptions opts)
|| Console.IsOutputRedirected
|| Console.IsErrorRedirected;

private static ILCache CreateIlCache(ConfigSettings config, ILoggerService logger)
private static ILCache? CreateIlCache(ConfigSettings config, ILoggerService logger)
{
return RunScopeBuilder.CreateIlCache(config, logger);
}
Expand All @@ -496,7 +496,7 @@ internal static string FormatElapsedTime(TimeSpan elapsed)
/// Prints the effective configuration (after JSON load + environment variable overrides) to stdout as JSON.
/// 有効な設定(JSON 読込 + 環境変数オーバーライド適用後)を JSON として標準出力に書き出します。
/// </summary>
private async Task<int> PrintConfigAsync(string configPath)
private async Task<int> PrintConfigAsync(string? configPath)
{
try
{
Expand Down
2 changes: 1 addition & 1 deletion Runner/RunScopeBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ internal static ServiceProvider Build(ConfigSettings config, DiffExecutionContex
services.AddSingleton(executionContext);
services.AddScoped<FileDiffResultLists>();
services.AddScoped<DotNetDisassemblerCache>();
services.AddScoped<ILCache>(sp => CreateIlCache(config, sp.GetRequiredService<ILoggerService>()));
services.AddScoped<ILCache>(sp => CreateIlCache(config, sp.GetRequiredService<ILoggerService>())!);
services.AddScoped<ProgressReportService>();
services.AddScoped<ReportGenerateService>();
services.AddScoped<HtmlReportGenerateService>();
Expand Down
8 changes: 4 additions & 4 deletions Services/Caching/DotNetDisassemblerCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public async Task<string> GetDisassemblerVersionAsync(string disassembleCommandW
var (disassemblerKind, disassemblerVersionCacheKey, disassemblerExe) = GetDisassemblerInfo(disassembleCommandWithArguments);
return disassemblerKind switch
{
DisassemblerKind.DotnetIldasm => await GetVersionForDotnetIldasmAsync(disassemblerVersionCacheKey, disassemblerExe),
DisassemblerKind.Ildasm => await GetVersionForIldasmAsync(disassemblerVersionCacheKey, disassemblerExe),
DisassemblerKind.Ilspy => await GetVersionForIlspyAsync(disassemblerVersionCacheKey, disassemblerExe),
DisassemblerKind.DotnetIldasm => await GetVersionForDotnetIldasmAsync(disassemblerVersionCacheKey!, disassemblerExe!),
DisassemblerKind.Ildasm => await GetVersionForIldasmAsync(disassemblerVersionCacheKey!, disassemblerExe!),
DisassemblerKind.Ilspy => await GetVersionForIlspyAsync(disassemblerVersionCacheKey!, disassemblerExe!),
_ => throw new InvalidOperationException($"Failed to determine disassembler version for label: '{disassembleCommandWithArguments}'.")
};
}
Expand All @@ -65,7 +65,7 @@ public async Task<string> GetDisassemblerVersionAsync(string disassembleCommandW
/// Extracts the disassembler kind, cache key, and executable from a command label.
/// コマンドラベルから逆アセンブラ種別・キャッシュキー・実行ファイル名を抽出します。
/// </summary>
private static (DisassemblerKind disassemblerKind, string disassemblerVersionCacheKey, string disassemblerExe) GetDisassemblerInfo(string disassembleCommandWithArguments)
private static (DisassemblerKind disassemblerKind, string? disassemblerVersionCacheKey, string? disassemblerExe) GetDisassemblerInfo(string disassembleCommandWithArguments)
{
var tokens = ProcessHelper.TokenizeCommand(disassembleCommandWithArguments);
if (tokens.Count == 0)
Expand Down
2 changes: 1 addition & 1 deletion Services/ConfigService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public sealed class ConfigService
/// config.json を指定パス(または既定のアプリケーションベースディレクトリ)から非同期で読み込み、
/// <see cref="ConfigSettings"/> にデシリアライズした後、設定値の整合性を検証します。
/// </summary>
public async Task<ConfigSettings> LoadConfigAsync(string configFilePath = null)
public async Task<ConfigSettings> LoadConfigAsync(string? configFilePath = null)
{
try
{
Expand Down
Loading
Loading