-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add EnvironmentAugments to coreclr #6205
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
| // See the LICENSE file in the project root for more information. | ||
|
|
||
| using System; | ||
|
|
||
| namespace Internal.Runtime.Augments | ||
| { | ||
| /// <summary>For internal use only. Exposes runtime functionality to the Environments implementation in corefx.</summary> | ||
| public static class EnvironmentAugments | ||
| { | ||
| public static int CurrentManagedThreadId => Environment.CurrentManagedThreadId; | ||
| public static void Exit(int exitCode) => Environment.Exit(exitCode); | ||
| public static int ExitCode { get { return Environment.ExitCode; } set { Environment.ExitCode = value; } } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not think that the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll add a test for it in corefx. If it doesn't work I'll open an issue on that. I don't think we'd change this augments implementation based on that, but rather would fix in the runtime whatever we'd need to get it working. There's already a corefx test verifying that this value roundtrips, but that doesn't mean it actually ends up propagating the value out of the process.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agree - it would need to be fixed in runtime. Same goes for CoreRT - we should make it work in .NET Native / CoreRT as well.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're correct; I just verified it doesn't propagate to the process' exit code. |
||
| public static void FailFast(string message, Exception error) => Environment.FailFast(message, error); | ||
| public static string[] GetCommandLineArgs() => Environment.GetCommandLineArgs(); | ||
| public static bool HasShutdownStarted => Environment.HasShutdownStarted; | ||
| public static string StackTrace => Environment.StackTrace; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will return extra useless lines in the stacktrace based on how the optimizations kicked in. We will need to:
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (Similar for corert.)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Opened https://github.com/dotnet/coreclr/issues/6209 to track |
||
| public static int TickCount => Environment.TickCount; | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can <Type Name="System.Environment"> come out now then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No. If nothing else, corefx master still depends on it. But even after that's changed, I'm not sure we can remove the existing Environment exports, in case we need to support an existing System.Runtime.Extensions.dll working with a newer System.Private.Corelib.dll... not sure if that's a supported scenario or not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure whether we consider S.P.Corelib.dll implicitly undocumented from now on -- whether we retain freedom to remove things after we ship it next ..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even if we say we don't support code outside of coreclr/corefx using its surface area (which is a very reasonable thing to say IMO), corefx 1.0 is using this surface area, so the question I was posing was about whether we support using, for example, a 1.0 corefx (and in this specific case a 1.0 System.Runtime.Extensions.dll) with a 1.1 coreclr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree that it needs the
Environmentneed stay for now until corefx is updated. Everything will break otherwise.I have said number of times that we need to be a plan where only latest CoreCLR is guaranteed to work with latest System.Runtime.Extensions and friends (assemblies that depend on internal contracts). The matrix of different combinations will go through the roof otherwise, and we are unlikely to ensure that all combinations work anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1.0 corefx assemblies that depend on public contracts only should be supported with a 1.1 CoreCLR. For example,
System.Reflection.Metadata.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy with that answer. 😄