-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check for Mono runtime #81076
Comments
Tagging subscribers to this area: @directhex Issue DetailsA lot of code checking for mono runtime does it by seeing the It is the suggested answer in this stack overflow question and is based on the Mono documentation. It seems this is not working with the runtime based mono builds. I've tested against 7.0 and When I run: foreach (var type in new[] { "Mono.Runtime", "Mono.RuntimeStructs" })
{
Console.WriteLine($"{type}: {Type.GetType(type) != null}");
} The output is:
The check can also be found in .NET sources, for example: aspnetcore, msbuild, nuget, roslyn. Should the type be re-introduced so this check continues to work? Should a public API be added to perform this check? cc @akoeplinger @jkotas @omajid @uweigand
|
I'm not convinced this would be a good change. .NET using the Mono runtime is a quite different environment from Mono. Most users of those pre-existing checks were likely actually checking for Mono itself. Having them all activated in .NET just because we're using the Mono runtime doesn't look like a good idea to me - we ideally want .NET to behave the same no matter the underlying runtime. |
This was sort of intentional, like @uweigand said the The |
That makes sense. Ideally, these runtimes behave the same. It sounds like the use-case is considered too niche to add a public API. Anyone looking for code to check for the variants (from public static bool IsMono { get; } = Type.GetType("Mono.RuntimeStructs") != null;
public static bool IsOldMono { get; } = Type.GetType("Mono.Runtime") != null;
public static bool IsNewMono { get; } = IsMono && !IsOldMono; |
What are the differences that are causing you problems? |
I still have to create an issue about it in this repo: running a webapp using To make the test pass on existing releases, I was looking for a way to check for Mono runtime. |
I've written up an issue in the sdk repo: #81093. |
A lot of code checking for mono runtime does it by seeing the
Mono.Runtime
type exists.It is the suggested answer in this stack overflow question and is based on the Mono documentation.
It seems this is not working with the runtime based mono builds. I've tested against 7.0 and
main
.When I run:
The output is:
The check can also be found in .NET sources, for example: aspnetcore, msbuild, nuget, roslyn.
Should the type be re-introduced so this check continues to work?
Should a public API be added to perform this check?
cc @akoeplinger @jkotas @omajid @uweigand
The text was updated successfully, but these errors were encountered: