Add EnvironmentAugments to coreclr#6205
Conversation
50ff539 to
1048832
Compare
| <Member Name="FailFast(System.String,System.Exception)" /> | ||
| <Member Name="Exit(System.Int32)" /> | ||
| </Type> | ||
| <Type Name="Internal.Runtime.Augments.EnvironmentAugments"> |
There was a problem hiding this comment.
can <Type Name="System.Environment"> come out now then?
There was a problem hiding this comment.
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.
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.
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.
I agree that it needs the Environment need stay for now until corefx is updated. Everything will break otherwise.
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.
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.
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
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.
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
I'm happy with that answer. 😄
|
LGTM |
| { | ||
| 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; } } |
There was a problem hiding this comment.
I do not think that the ExitCode setter works as expected in CoreCLR today.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Agree - it would need to be fixed in runtime. Same goes for CoreRT - we should make it work in .NET Native / CoreRT as well.
There was a problem hiding this comment.
You're correct; I just verified it doesn't propagate to the process' exit code.
|
LGTM |
| 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; |
There was a problem hiding this comment.
This will return extra useless lines in the stacktrace based on how the optimizations kicked in. We will need to:
- Disable optimizations on the forwarder in corefx to make sure that there is fixed number of frames to skip
- Skip the given number of frames here by calling StackTrace constructor with
skipFramesargument, instead of just forwarding to Environment.
There was a problem hiding this comment.
Opened https://github.com/dotnet/coreclr/issues/6209 to track
|
This is going to cause build breaks on the TFS side, perhaps, because of the model.xml updates. I will coordinate the merge with some other changes that are touching model.xml and fix up the build breaks. @dotnet-bot test Linux ARM Emulator Cross Debug Build please (Both of the above failures look infrastructure related, a device could not unmount). |
| <SystemSources Condition="'$(FeatureCominterop)' == 'true'" Include="$(BclSourcesRoot)\System\Variant.cs" /> | ||
| <SystemSources Condition="'$(FeatureClassicCominterop)' == 'true'" Include="$(BclSourcesRoot)\System\OleAutBinder.cs" /> | ||
| </ItemGroup> | ||
| <ItemGroup> |
There was a problem hiding this comment.
This should have Condition="'$(FeatureCoreClr)'=='true'"
The asmmeta updates are no longer needed for CoreCLR, they are needed for full framework only. As long as this is changing just CoreCLR - we should make this happen by including the new file for CoreCLR only, it will be fine. |
1048832 to
340f1b0
Compare
Added the condition to the entry. |
…gments Add EnvironmentAugments to coreclr Commit migrated from dotnet/coreclr@c93479b
Continuation of dotnet/corefx#9851
cc: @jkotas, @danmosemsft