Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Add EnvironmentAugments to coreclr#6205

Merged
stephentoub merged 2 commits into
dotnet:masterfrom
stephentoub:environmentaugments
Jul 13, 2016
Merged

Add EnvironmentAugments to coreclr#6205
stephentoub merged 2 commits into
dotnet:masterfrom
stephentoub:environmentaugments

Conversation

@stephentoub
Copy link
Copy Markdown
Member

Continuation of dotnet/corefx#9851
cc: @jkotas, @danmosemsft

Comment thread src/mscorlib/model.xml
<Member Name="FailFast(System.String,System.Exception)" />
<Member Name="Exit(System.Int32)" />
</Type>
<Type Name="Internal.Runtime.Augments.EnvironmentAugments">
Copy link
Copy Markdown
Member

@danmoseley danmoseley Jul 9, 2016

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?

Copy link
Copy Markdown
Member Author

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.

Copy link
Copy Markdown
Member

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 ..

Copy link
Copy Markdown
Member Author

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.

Copy link
Copy Markdown
Member

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 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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. 😄

@danmoseley
Copy link
Copy Markdown
Member

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; } }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not think that the ExitCode setter works as expected in CoreCLR today.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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.

@jkotas
Copy link
Copy Markdown
Member

jkotas commented Jul 9, 2016

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;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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:

  • 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 skipFrames argument, instead of just forwarding to Environment.

Copy link
Copy Markdown
Member

@jkotas jkotas Jul 10, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Similar for corert.)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ellismg
Copy link
Copy Markdown

ellismg commented Jul 13, 2016

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
@dotnet-bot test Linux ARM Emulator Cross Release 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>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should have Condition="'$(FeatureCoreClr)'=='true'"

@jkotas
Copy link
Copy Markdown
Member

jkotas commented Jul 13, 2016

This is going to cause build breaks on the TFS side

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.

@stephentoub stephentoub force-pushed the environmentaugments branch from 1048832 to 340f1b0 Compare July 13, 2016 20:52
@stephentoub
Copy link
Copy Markdown
Member Author

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.

Added the condition to the entry.

@stephentoub stephentoub merged commit c93479b into dotnet:master Jul 13, 2016
@stephentoub stephentoub deleted the environmentaugments branch July 13, 2016 22:51
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…gments

Add EnvironmentAugments to coreclr

Commit migrated from dotnet/coreclr@c93479b
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants