Skip to content
Closed
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
21 changes: 21 additions & 0 deletions Turkey/DotNet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,19 @@ private async Task<int> 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");

Expand Down Expand Up @@ -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
Expand Down
Loading