diff --git a/Turkey/DotNet.cs b/Turkey/DotNet.cs index 677b3b5..5987a65 100644 --- a/Turkey/DotNet.cs +++ b/Turkey/DotNet.cs @@ -142,6 +142,19 @@ private async Task RunDotNetCommandAsync(DirectoryInfo workingDirectory, st } private static bool IsMonoRuntime(string dotnetRoot, Version version) + { + bool usingHeaders = IsMonoRuntimeUsingHeaders(dotnetRoot, version); + bool usingSymbols = IsMonoRuntimeUsingSymbols(dotnetRoot, version); + + if (usingHeaders != usingSymbols) + { + Console.WriteLine($"Warning: Mono runtime detection mismatch for version {version}. Headers: {usingHeaders}, Symbols: {usingSymbols}"); + } + + return usingHeaders || usingSymbols; + } + + private static bool IsMonoRuntimeUsingSymbols(string dotnetRoot, Version version) { var libcoreclrPath = Path.Combine(dotnetRoot, "shared", "Microsoft.NETCore.App", version.ToString(), "libcoreclr.so"); @@ -173,6 +186,14 @@ private static bool IsMonoRuntime(string dotnetRoot, Version version) return false; } + private static bool IsMonoRuntimeUsingHeaders(string dotnetRoot, Version version) + { + var runtimeDirectory = Path.Combine(dotnetRoot, "shared", "Microsoft.NETCore.App", version.ToString()); + var monoGcHeaderPath = Path.Combine(runtimeDirectory, "mono-gc.h"); + + return File.Exists(monoGcHeaderPath); + } + #nullable enable private static string? FindProgramInPath(string program) #nullable disable