Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Merge relevant changes from the auto-generated System.Runtime ref #33512

Merged
merged 3 commits into from
Nov 15, 2018

Conversation

ahsonkhan
Copy link
Member

@ahsonkhan ahsonkhan commented Nov 15, 2018

Though documentation on updating the System.Runtime ref is a bit lacking, the steps I followed might help others (in particular for System.Runtime):

  1. Build coreclr release.
  2. Build corefx release with coreclr bits (see link below for details).
  3. Run msbuild /t:GenerateReferenceSource /p:ConfigurationGroup=Release from the System.Runtime/ref directory.
  4. Filter out all unrelated changes and extract the changes you care about (ignore certain attributes being removed). Generally, this step is not required for other reference assemblies.

https://github.com/dotnet/corefx/blob/master/Documentation/project-docs/developer-guide.md#testing-with-private-coreclr-bits

Added this documentation here: #33515

@@ -7728,6 +7718,12 @@ public struct ChunkEnumerator
void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { }
public override string ToString() { throw null; }
public string ToString(int startIndex, int length) { throw null; }
public partial struct ChunkEnumerator
Copy link
Member Author

Choose a reason for hiding this comment

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

From #29877

cc @vancem, please review for correctness

public bool RunContinuationsAsynchronously { get { throw null; } set { throw null; } }
public void SetException(System.Exception error) { throw null; }
public void SetResult(TResult result) { throw null; }
public bool RunContinuationsAsynchronously { get { throw null; } set { } }
Copy link
Member Author

Choose a reason for hiding this comment

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

From #33104

cc @stephentoub, please review for correctness

@@ -346,7 +346,7 @@ public partial class ArrayTypeMismatchException : System.SystemException
public ArrayTypeMismatchException(string message, System.Exception innerException) { }
}
public delegate void AsyncCallback(System.IAsyncResult ar);
[System.AttributeUsageAttribute((System.AttributeTargets)(32767), Inherited=true, AllowMultiple=false)]
[System.AttributeUsageAttribute(System.AttributeTargets.All, Inherited=true, AllowMultiple=false)]
Copy link
Member

Choose a reason for hiding this comment

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

It's great to see these values fixed to be readable :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, definitely!

@@ -67,15 +67,15 @@ public partial class AccessViolationException : System.SystemException
public delegate void Action<in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8, in T9>(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9);
public static partial class Activator
{
public static System.Runtime.Remoting.ObjectHandle CreateInstance(string assemblyName, string typeName) { throw null; }
Copy link
Member Author

Choose a reason for hiding this comment

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

From #30809

cc @MarcoRossignoli, please review for correctness

Copy link
Member

@MarcoRossignoli MarcoRossignoli Nov 15, 2018

Choose a reason for hiding this comment

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

too late for me...but seems ok...one curiosity, it works also for new ref project?I mean if we create an empty file and run tool...for issue like https://github.com/dotnet/corefx/issues/33117

Copy link
Member Author

@ahsonkhan ahsonkhan Nov 15, 2018

Choose a reason for hiding this comment

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

Good question!

If the file doesn't exist, then the tool throws an exception (can't find the expected file). We can probably fix it to create the ref file or at least fail gracefully.

Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path 'E:\GitHub\Fork\corefx\src\System.Json\ref\System.Json.cs'.
     at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
     at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
     at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
     at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
     at System.IO.StreamWriter..ctor(String path, Boolean append)
     at System.IO.File.CreateText(String path)
     at GenAPI.Program.Main(String[] args)

cc @weshaggard

If, however, we create an empty file first in the correct folder (ref directory), then yes, it would work.

I just tried it with System.Json and it worked great. We just have to make sure to add back Obsolete or EditorBrowsableNever attributes that might exist in the source (fyi, System.Json doesn't have such attributes so the generated ref should be correct).

cc @danmosemsft

@@ -5159,15 +5158,15 @@ public partial class FileStream : System.IO.Stream
public override int Read(byte[] array, int offset, int count) { throw null; }
public override int Read(System.Span<byte> buffer) { throw null; }
public override System.Threading.Tasks.Task<int> ReadAsync(byte[] buffer, int offset, int count, System.Threading.CancellationToken cancellationToken) { throw null; }
public override System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<byte> buffer, System.Threading.CancellationToken cancellationToken = default) { throw null; }
public override System.Threading.Tasks.ValueTask<int> ReadAsync(System.Memory<byte> buffer, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; }
Copy link
Member

Choose a reason for hiding this comment

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

It'd be nice if the tool didn't require expanding this, but I realize that's how it's currently implemented.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep. We should fix it. dotnet/arcade#1341

@@ -2346,9 +2345,9 @@ public sealed partial class String : System.Collections.Generic.IEnumerable<char
public static System.String Format(System.String format, params object[] args) { throw null; }
public System.CharEnumerator GetEnumerator() { throw null; }
public override int GetHashCode() { throw null; }
public static int GetHashCode(System.ReadOnlySpan<char> value) { throw null; }
Copy link
Member Author

Choose a reason for hiding this comment

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

From #33316

cc @GrabYourPitchforks, please review for correctness

@ahsonkhan ahsonkhan requested a review from weshaggard November 15, 2018 01:17
public override int ReadByte() { throw null; }
public override long Seek(long offset, System.IO.SeekOrigin origin) { throw null; }
public override void SetLength(long value) { }
public virtual void Unlock(long position, long length) { }
public override void Write(byte[] array, int offset, int count) { }
public override void Write(System.ReadOnlySpan<byte> buffer) { throw null; }
public override void Write(System.ReadOnlySpan<byte> buffer) { }
Copy link
Member Author

Choose a reason for hiding this comment

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

void returning methods don't need a method body, if anyone was wondering

public bool RunContinuationsAsynchronously { get { throw null; } set { throw null; } }
public void SetException(System.Exception error) { throw null; }
public void SetResult(TResult result) { throw null; }
public bool RunContinuationsAsynchronously { get { throw null; } set { } }
Copy link
Member Author

Choose a reason for hiding this comment

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

set doesn't need a method body, if anyone was wondering

@ahsonkhan ahsonkhan merged commit a624719 into dotnet:master Nov 15, 2018
@ahsonkhan ahsonkhan deleted the FixSystemRuntimeRef branch November 15, 2018 04:54
@karelz karelz added this to the 3.0 milestone Nov 15, 2018
jlennox pushed a commit to jlennox/corefx that referenced this pull request Dec 16, 2018
…tnet#33512)

* Merge relevant changes from the auto-generated System.Runtime ref

* Update attributes and default enum values

* Add back accidentally removed EditorBrowsableState attribute
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…tnet/corefx#33512)

* Merge relevant changes from the auto-generated System.Runtime ref

* Update attributes and default enum values

* Add back accidentally removed EditorBrowsableState attribute


Commit migrated from dotnet/corefx@a624719
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants