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

Update references assemblies to include private fields for structs#26286

Merged
weshaggard merged 1 commit into
dotnet:masterfrom
weshaggard:UpdatePrivateFieldsForStructsInRefs
Jan 12, 2018
Merged

Update references assemblies to include private fields for structs#26286
weshaggard merged 1 commit into
dotnet:masterfrom
weshaggard:UpdatePrivateFieldsForStructsInRefs

Conversation

@weshaggard
Copy link
Copy Markdown
Member

Contributes to https://github.com/dotnet/corefx/issues/6185.

This is an update to the rest of the reference assemblies in corefx. I updated every reference assembly that as a struct with any private fields. Some of the refs that weren't easy to regenerate I did targeted fixes for and others I regenerated with the latest tools so there are some other normalization changes in some of the refs.

PTAL @jkotas @VSadov @jaredpar @gafter @tmat @nguerrera

@weshaggard
Copy link
Copy Markdown
Member Author

For reference the tools change is dotnet/buildtools#1859

Comment thread dir.props

<PropertyGroup Condition="'$(IsReferenceAssembly)' == 'true'">
<!-- disable warnings about unused fields -->
<NoWarn>$(NoWarn);0169;0649</NoWarn>
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.

Delete this from System.Runtime.csproj now that it is centrally defined?


namespace System.ComponentModel.Composition
{
public static partial class AdaptationConstants
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.

@maryamariyan when I regenerated the ref for System.ComponentModel.Composition a few more public API showed up. Can you confirm you didn't intentionally exclude them originally.?

@@ -82,17 +82,17 @@ public enum MethodSemanticsAttributes
}
namespace 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.

@tmat @nguerrera could you guys please have a scan over the changes to this ref?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I took a look and it looks fine.

// ------------------------------------------------------------------------------


namespace System.Security.Cryptography
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.

@bartonjs would you mind having a scan over the crypto ref's I've regenerated?

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.

Crypto deltas LGTM.

public void Start<TStateMachine>(ref TStateMachine stateMachine) where TStateMachine : System.Runtime.CompilerServices.IAsyncStateMachine { }
}
public partial struct ConfiguredValueTaskAwaitable<TResult>
public readonly partial struct ConfiguredValueTaskAwaitable<TResult>
Copy link
Copy Markdown
Member Author

@weshaggard weshaggard Jan 12, 2018

Choose a reason for hiding this comment

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

@stephentoub while regenerating this a few things got marked as readonly I assume that is more leftover from your other work. In this ref ConfiguredValueTaskAwaiter and ValueTaskAwaiter<TResult> also got marked as readonly based on what the netstandard implementation is but they aren't marked that way in corelib, so I undid it in the ref. Please feel free to make the consistent as you deem fit.

@weshaggard weshaggard force-pushed the UpdatePrivateFieldsForStructsInRefs branch from 2bb1b19 to 2e97d43 Compare January 12, 2018 17:08
public sealed partial class SafeX509ChainHandle : Microsoft.Win32.SafeHandles.SafeHandleZeroOrMinusOneIsInvalid
{
internal SafeX509ChainHandle() : base(default(bool)) { }
public override bool IsInvalid { get { throw null; } }
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 assume the override was "removed" because the type is sealed (so there's no base.IsInvalid concern)?

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.

it was removed because it wasn't in the implementation.

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.

Ah. That would be a good reason, too 😄.

Looks like when we brought back SafeHandleZeroOrMinusOneIsInvalid the override was removed from the src copy but not the ref.

@tmat
Copy link
Copy Markdown
Member

tmat commented Jan 12, 2018

    private readonly object _dummy;

Blob has fields of both reference and value types: byte[] and int. I assume that once there is a _dummy of a reference type we don't need to also add a value type _dummy, but the rules here do not mention that: dotnet/buildtools#1859


Refers to: src/System.Reflection.Metadata/ref/System.Reflection.Metadata.cs:208 in 2e97d43. [](commit_id = 2e97d43, deletion_comment = False)

@tmat
Copy link
Copy Markdown
Member

tmat commented Jan 12, 2018

    private readonly TType _Type_k__BackingField;

why not call this _dummy as well (or _dummy0..n) if we need one for each generic paramter.


Refers to: src/System.Reflection.Metadata/ref/System.Reflection.Metadata.cs:497 in 2e97d43. [](commit_id = 2e97d43, deletion_comment = False)

@weshaggard
Copy link
Copy Markdown
Member Author

Blob has fields of both reference and value types: byte[] and int. I assume that once there is a _dummy of a reference type we don't need to also add a value type _dummy, but the rules here do not mention that: dotnet/buildtools#1859

If it already has the reference one we don't need the value type one for the compiler to do it's job.

why not call this _dummy as well (or _dummy0..n) if we need one for each generic paramter.

For the generic fields I just copy them as is because I didn't want to normalize their types.

@weshaggard weshaggard merged commit 9d32b61 into dotnet:master Jan 12, 2018
@tmat
Copy link
Copy Markdown
Member

tmat commented Jan 12, 2018

Re the generic types - my only concern is using compiler generated names of the property backing fields (in theory they might change in next compiler version).

@weshaggard
Copy link
Copy Markdown
Member Author

Re the generic types - my only concern is using compiler generated names of the property backing fields (in theory they might change in next compiler version).

I don't expect that the name will be used for anything so I don't think it matters.

@karelz karelz added this to the 2.1.0 milestone Jan 20, 2018
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…ieldsForStructsInRefs

Update references assemblies to include private fields for structs

Commit migrated from dotnet/corefx@9d32b61
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.

6 participants