From 7e31494b38d0078e51a9a12d4f18f642ed6cbc93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Tue, 13 Sep 2022 22:27:18 +0200 Subject: [PATCH] Add reference assembly for System.Private.CoreLib.dll (#75311) We now compile against the reference assembly in all places where we were compiling against the mono/coreclr System.Private.CoreLib.dll implementation assembly before. The new reference assembly consumes sources from the existing contracts to avoid checking in a generated version of SPC.dll (this would add ~20k lines of .cs which is mostly duplicated with System.Runtime.cs) Since a few contracts have only partially moved types to SPC we wrap contract types with `#if !BUILDING_CORELIB_REFERENCE` so we can hide them when compiling the SPC reference assembly. --- Directory.Build.props | 2 + docs/coding-guidelines/updating-ref-source.md | 2 +- eng/references.targets | 11 ++ .../System.Private.CoreLib.csproj | 8 +- .../ref/System.Collections.Concurrent.cs | 6 + .../ref/System.Collections.cs | 13 +- .../System.Diagnostics.Debug.Tests.csproj | 7 +- .../ref/System.Diagnostics.StackTrace.cs | 4 + .../System.Memory/ref/System.Memory.cs | 8 + .../ref/System.Private.CoreLib.ExtraApis.cs | 41 +++++ ....Private.CoreLib.ManualShimTypeForwards.cs | 153 ++++++++++++++++++ .../ref/System.Private.CoreLib.csproj | 51 ++++++ .../ref/System.Runtime.InteropServices.cs | 48 ++++++ .../System.Runtime/ref/System.Runtime.cs | 14 ++ .../System.Runtime/src/System.Runtime.csproj | 2 +- .../System.Threading/ref/System.Threading.cs | 10 ++ .../System.Private.CoreLib.csproj | 6 + 17 files changed, 378 insertions(+), 8 deletions(-) create mode 100644 src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.ExtraApis.cs create mode 100644 src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.ManualShimTypeForwards.cs create mode 100644 src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.csproj diff --git a/Directory.Build.props b/Directory.Build.props index 43ed7454304334..c815af2041b714 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -237,8 +237,10 @@ $([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'System.Private.CoreLib', 'src')) + $([MSBuild]::NormalizeDirectory('$(LibrariesProjectRoot)', 'System.Private.CoreLib', 'ref')) $([MSBuild]::NormalizePath('$(CoreClrProjectRoot)', 'System.Private.CoreLib', 'System.Private.CoreLib.csproj')) $([MSBuild]::NormalizePath('$(MonoProjectRoot)', 'System.Private.CoreLib', 'System.Private.CoreLib.csproj')) + $([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'System.Private.Uri', 'src', 'System.Private.Uri.csproj')) true diff --git a/docs/coding-guidelines/updating-ref-source.md b/docs/coding-guidelines/updating-ref-source.md index d3f16179e089a2..641718b7875e39 100644 --- a/docs/coding-guidelines/updating-ref-source.md +++ b/docs/coding-guidelines/updating-ref-source.md @@ -13,7 +13,7 @@ This document provides the steps you need to take to update the reference assemb These steps can also be applied to some unique assemblies which depend on changes in System.Private.Corelib. (partial facades like System.Memory, for example). -1) Run `dotnet build --no-incremental /t:GenerateReferenceSource` from the System.Runtime/src directory. +1) Run `dotnet build --no-incremental /t:GenerateReferenceAssemblySource` from the System.Runtime/src directory. 2) 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. ## For Full Facade Assemblies implementation assemblies diff --git a/eng/references.targets b/eng/references.targets index 7cfb60411ed182..8a238677f67b86 100644 --- a/eng/references.targets +++ b/eng/references.targets @@ -59,4 +59,15 @@ + + + + <_resolvedCoreLibProjectReference Include="@(_ResolvedProjectReferencePaths->WithMetadataValue('MSBuildSourceProjectFile','$(CoreLibProject)'))" /> + + + + + diff --git a/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj index 8515997bcb42e6..bdbfe5b4b0a6bc 100644 --- a/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/coreclr/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -1,4 +1,4 @@ - + false @@ -355,4 +355,10 @@ + + + + true + + diff --git a/src/libraries/System.Collections.Concurrent/ref/System.Collections.Concurrent.cs b/src/libraries/System.Collections.Concurrent/ref/System.Collections.Concurrent.cs index 4afe5340d39b4c..a19395ca8ef31f 100644 --- a/src/libraries/System.Collections.Concurrent/ref/System.Collections.Concurrent.cs +++ b/src/libraries/System.Collections.Concurrent/ref/System.Collections.Concurrent.cs @@ -6,6 +6,7 @@ namespace System.Collections.Concurrent { +#if !BUILDING_CORELIB_REFERENCE [System.Runtime.Versioning.UnsupportedOSPlatform("browser")] public partial class BlockingCollection : System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.ICollection, System.Collections.IEnumerable, System.IDisposable { @@ -126,6 +127,7 @@ void System.Collections.IDictionary.Remove(object key) { } public bool TryRemove(TKey key, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TValue value) { throw null; } public bool TryUpdate(TKey key, TValue newValue, TValue comparisonValue) { throw null; } } +#endif public partial class ConcurrentQueue : System.Collections.Concurrent.IProducerConsumerCollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.ICollection, System.Collections.IEnumerable { public ConcurrentQueue() { } @@ -146,6 +148,7 @@ void System.Collections.ICollection.CopyTo(System.Array array, int index) { } public bool TryDequeue([System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out T result) { throw null; } public bool TryPeek([System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out T result) { throw null; } } +#if !BUILDING_CORELIB_REFERENCE public partial class ConcurrentStack : System.Collections.Concurrent.IProducerConsumerCollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.ICollection, System.Collections.IEnumerable { public ConcurrentStack() { } @@ -176,6 +179,7 @@ public enum EnumerablePartitionerOptions None = 0, NoBuffering = 1, } +#endif public partial interface IProducerConsumerCollection : System.Collections.Generic.IEnumerable, System.Collections.ICollection, System.Collections.IEnumerable { void CopyTo(T[] array, int index); @@ -183,6 +187,7 @@ public partial interface IProducerConsumerCollection : System.Collections.Gen bool TryAdd(T item); bool TryTake([System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out T item); } +#if !BUILDING_CORELIB_REFERENCE public abstract partial class OrderablePartitioner : System.Collections.Concurrent.Partitioner { protected OrderablePartitioner(bool keysOrderedInEachPartition, bool keysOrderedAcrossPartitions, bool keysNormalized) { } @@ -212,4 +217,5 @@ protected Partitioner() { } public virtual System.Collections.Generic.IEnumerable GetDynamicPartitions() { throw null; } public abstract System.Collections.Generic.IList> GetPartitions(int partitionCount); } +#endif } diff --git a/src/libraries/System.Collections/ref/System.Collections.cs b/src/libraries/System.Collections/ref/System.Collections.cs index ceaadeb8ba6696..11cf4649326e18 100644 --- a/src/libraries/System.Collections/ref/System.Collections.cs +++ b/src/libraries/System.Collections/ref/System.Collections.cs @@ -6,6 +6,7 @@ namespace System.Collections { +#if !BUILDING_CORELIB_REFERENCE public sealed partial class BitArray : System.Collections.ICollection, System.Collections.IEnumerable, System.ICloneable { public BitArray(bool[] values) { } @@ -38,9 +39,12 @@ public static partial class StructuralComparisons public static System.Collections.IComparer StructuralComparer { get { throw null; } } public static System.Collections.IEqualityComparer StructuralEqualityComparer { get { throw null; } } } +#endif } + namespace System.Collections.Generic { +#if !BUILDING_CORELIB_REFERENCE public static partial class CollectionExtensions { public static TValue? GetValueOrDefault(this System.Collections.Generic.IReadOnlyDictionary dictionary, TKey key) { throw null; } @@ -48,6 +52,7 @@ public static partial class CollectionExtensions public static bool Remove(this System.Collections.Generic.IDictionary dictionary, TKey key, [System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute(false)] out TValue value) { throw null; } public static bool TryAdd(this System.Collections.Generic.IDictionary dictionary, TKey key, TValue value) { throw null; } } +#endif public abstract partial class Comparer : System.Collections.Generic.IComparer, System.Collections.IComparer { protected Comparer() { } @@ -240,6 +245,7 @@ public void Dispose() { } void System.Collections.IEnumerator.Reset() { } } } +#if !BUILDING_CORELIB_REFERENCE public sealed partial class LinkedListNode { public LinkedListNode(T value) { } @@ -298,6 +304,7 @@ void System.Runtime.Serialization.IDeserializationCallback.OnDeserialization(obj void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } } } +#endif public partial class List : System.Collections.Generic.ICollection, System.Collections.Generic.IEnumerable, System.Collections.Generic.IList, System.Collections.Generic.IReadOnlyCollection, System.Collections.Generic.IReadOnlyList, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList { public List() { } @@ -379,7 +386,7 @@ public void Dispose() { } void System.Collections.IEnumerator.Reset() { } } } - +#if !BUILDING_CORELIB_REFERENCE public partial class PriorityQueue { public PriorityQueue() { } @@ -423,7 +430,7 @@ void System.Collections.IEnumerator.Reset() { } } } } - +#endif public partial class Queue : System.Collections.Generic.IEnumerable, System.Collections.Generic.IReadOnlyCollection, System.Collections.ICollection, System.Collections.IEnumerable { public Queue() { } @@ -466,6 +473,7 @@ private ReferenceEqualityComparer() { } public new bool Equals(object? x, object? y) { throw null; } public int GetHashCode(object? obj) { throw null; } } +#if !BUILDING_CORELIB_REFERENCE public partial class SortedDictionary : System.Collections.Generic.ICollection>, System.Collections.Generic.IDictionary, System.Collections.Generic.IEnumerable>, System.Collections.Generic.IReadOnlyCollection>, System.Collections.Generic.IReadOnlyDictionary, System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable where TKey : notnull { public SortedDictionary() { } @@ -718,4 +726,5 @@ public void Dispose() { } void System.Collections.IEnumerator.Reset() { } } } +#endif } diff --git a/src/libraries/System.Diagnostics.Debug/tests/System.Diagnostics.Debug.Tests.csproj b/src/libraries/System.Diagnostics.Debug/tests/System.Diagnostics.Debug.Tests.csproj index e842a465e60cdc..3071a3573d557f 100644 --- a/src/libraries/System.Diagnostics.Debug/tests/System.Diagnostics.Debug.Tests.csproj +++ b/src/libraries/System.Diagnostics.Debug/tests/System.Diagnostics.Debug.Tests.csproj @@ -1,17 +1,18 @@ System.Diagnostics.Tests - true - None $(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix true + + false - + + diff --git a/src/libraries/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.cs b/src/libraries/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.cs index b3cb0bdb3b33e1..7ffb3a29459d05 100644 --- a/src/libraries/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.cs +++ b/src/libraries/System.Diagnostics.StackTrace/ref/System.Diagnostics.StackTrace.cs @@ -52,6 +52,7 @@ public StackTrace(int skipFrames, bool fNeedFileInfo) { } } namespace System.Diagnostics.SymbolStore { +#if !BUILDING_CORELIB_REFERENCE public partial interface ISymbolBinder { [System.ObsoleteAttribute("ISymbolBinder.GetReader has been deprecated because it is not 64-bit compatible. Use ISymbolBinder1.GetReader instead. ISymbolBinder1.GetReader accepts the importer interface pointer as an IntPtr instead of an Int32, and thus works on both 32-bit and 64-bit architectures.")] @@ -74,11 +75,13 @@ public partial interface ISymbolDocument byte[] GetCheckSum(); byte[] GetSourceRange(int startLine, int startColumn, int endLine, int endColumn); } +#endif public partial interface ISymbolDocumentWriter { void SetCheckSum(System.Guid algorithmId, byte[] checkSum); void SetSource(byte[] source); } +#if !BUILDING_CORELIB_REFERENCE public partial interface ISymbolMethod { System.Diagnostics.SymbolStore.ISymbolScope RootScope { get; } @@ -205,4 +208,5 @@ public partial class SymLanguageVendor public static readonly System.Guid Microsoft; public SymLanguageVendor() { } } +#endif } diff --git a/src/libraries/System.Memory/ref/System.Memory.cs b/src/libraries/System.Memory/ref/System.Memory.cs index 1ddd8df16a6b5a..636af7b7babd6c 100644 --- a/src/libraries/System.Memory/ref/System.Memory.cs +++ b/src/libraries/System.Memory/ref/System.Memory.cs @@ -165,6 +165,7 @@ public ref struct TryWriteInterpolatedStringHandler public bool AppendFormatted(string? value, int alignment = 0, string? format = null) { throw null; } } } +#if !BUILDING_CORELIB_REFERENCE public readonly partial struct SequencePosition : System.IEquatable { private readonly object _dummy; @@ -180,9 +181,11 @@ public ref struct TryWriteInterpolatedStringHandler [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public object? GetObject() { throw null; } } +#endif } namespace System.Buffers { +#if !BUILDING_CORELIB_REFERENCE public sealed partial class ArrayBufferWriter : System.Buffers.IBufferWriter { public ArrayBufferWriter() { } @@ -315,6 +318,7 @@ public void Rewind(long count) { } public bool TryReadToAny(out System.Buffers.ReadOnlySequence sequence, System.ReadOnlySpan delimiters, bool advancePastDelimiter = true) { throw null; } public bool TryReadToAny(out System.ReadOnlySpan span, System.ReadOnlySpan delimiters, bool advancePastDelimiter = true) { throw null; } } +#endif public readonly partial struct StandardFormat : System.IEquatable { private readonly int _dummyPrimitive; @@ -541,6 +545,7 @@ public static partial class MemoryMarshal public static bool TryWrite(System.Span destination, ref T value) where T : struct { throw null; } public static void Write(System.Span destination, ref T value) where T : struct { } } +#if !BUILDING_CORELIB_REFERENCE public static partial class SequenceMarshal { public static bool TryGetArray(System.Buffers.ReadOnlySequence sequence, out System.ArraySegment segment) { throw null; } @@ -548,9 +553,11 @@ public static partial class SequenceMarshal public static bool TryGetReadOnlySequenceSegment(System.Buffers.ReadOnlySequence sequence, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Buffers.ReadOnlySequenceSegment? startSegment, out int startIndex, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Buffers.ReadOnlySequenceSegment? endSegment, out int endIndex) { throw null; } public static bool TryRead(ref System.Buffers.SequenceReader reader, out T value) where T : unmanaged { throw null; } } +#endif } namespace System.Text { +#if !BUILDING_CORELIB_REFERENCE public static partial class EncodingExtensions { public static void Convert(this System.Text.Decoder decoder, in System.Buffers.ReadOnlySequence bytes, System.Buffers.IBufferWriter writer, bool flush, out long charsUsed, out bool completed) { throw null; } @@ -566,6 +573,7 @@ public static partial class EncodingExtensions public static long GetChars(this System.Text.Encoding encoding, System.ReadOnlySpan bytes, System.Buffers.IBufferWriter writer) { throw null; } public static string GetString(this System.Text.Encoding encoding, in System.Buffers.ReadOnlySequence bytes) { throw null; } } +#endif public ref partial struct SpanLineEnumerator { private object _dummy; diff --git a/src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.ExtraApis.cs b/src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.ExtraApis.cs new file mode 100644 index 00000000000000..14b395cf4c868f --- /dev/null +++ b/src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.ExtraApis.cs @@ -0,0 +1,41 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// NOTE: Types/members which are not publicly exposed in System.Runtime.dll but still used internally by libraries. +// Manually maintained, keep in sync with System.Private.CoreLib.ExtraApis.txt + +namespace System.Runtime.Serialization +{ + public readonly partial struct DeserializationToken : System.IDisposable + { +#pragma warning disable CS0414 + private readonly object _dummy = null; + private readonly int _dummyPrimitive = 0; +#pragma warning restore CS0414 + internal DeserializationToken(object tracker) { } + public void Dispose() { } + } + public sealed partial class SerializationInfo + { + public static System.Runtime.Serialization.DeserializationToken StartDeserialization() { throw null; } + } +} +namespace System.Diagnostics +{ + public partial class DebugProvider + { + public DebugProvider() { } + [System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute] + public virtual void Fail(string? message, string? detailMessage) { throw null; } + public static void FailCore(string stackTrace, string? message, string? detailMessage, string errorSource) { } + public virtual void OnIndentLevelChanged(int indentLevel) { } + public virtual void OnIndentSizeChanged(int indentSize) { } + public virtual void Write(string? message) { } + public static void WriteCore(string message) { } + public virtual void WriteLine(string? message) { } + } + public static partial class Debug + { + public static System.Diagnostics.DebugProvider SetProvider(System.Diagnostics.DebugProvider provider) { throw null; } + } +} diff --git a/src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.ManualShimTypeForwards.cs b/src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.ManualShimTypeForwards.cs new file mode 100644 index 00000000000000..504e6898bb2f91 --- /dev/null +++ b/src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.ManualShimTypeForwards.cs @@ -0,0 +1,153 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +// NOTE: Types/members which are not publicly exposed in System.Runtime.dll but are forwarded from the mscorlib.dll shim. +// Manually maintained. + +namespace System +{ + public sealed partial class CultureAwareComparer : System.StringComparer, System.Runtime.Serialization.ISerializable + { + internal CultureAwareComparer() { } + public override int Compare(string? x, string? y) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override bool Equals(string? x, string? y) { throw null; } + public override int GetHashCode() { throw null; } + public override int GetHashCode(string obj) { throw null; } + public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public partial class OrdinalComparer : System.StringComparer + { + internal OrdinalComparer() { } + public override int Compare(string? x, string? y) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override bool Equals(string? x, string? y) { throw null; } + public override int GetHashCode() { throw null; } + public override int GetHashCode(string obj) { throw null; } + } + public sealed partial class UnitySerializationHolder : System.Runtime.Serialization.IObjectReference, System.Runtime.Serialization.ISerializable + { + public UnitySerializationHolder(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + public object GetRealObject(System.Runtime.Serialization.StreamingContext context) { throw null; } + } +} +namespace System.Collections +{ + public partial class ListDictionaryInternal : System.Collections.ICollection, System.Collections.IDictionary, System.Collections.IEnumerable + { + public ListDictionaryInternal() { } + public int Count { get { throw null; } } + public bool IsFixedSize { get { throw null; } } + public bool IsReadOnly { get { throw null; } } + public bool IsSynchronized { get { throw null; } } + public object? this[object key] { get { throw null; } set { } } + public System.Collections.ICollection Keys { get { throw null; } } + public object SyncRoot { get { throw null; } } + public System.Collections.ICollection Values { get { throw null; } } + public void Add(object key, object? value) { } + public void Clear() { } + public bool Contains(object key) { throw null; } + public void CopyTo(System.Array array, int index) { } + public System.Collections.IDictionaryEnumerator GetEnumerator() { throw null; } + public void Remove(object key) { } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } +} +namespace System.Collections.Generic +{ + public sealed partial class ByteEqualityComparer : System.Collections.Generic.EqualityComparer + { + public ByteEqualityComparer() { } + public override bool Equals(byte x, byte y) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override int GetHashCode() { throw null; } + public override int GetHashCode(byte b) { throw null; } + } + public sealed partial class EnumEqualityComparer : System.Collections.Generic.EqualityComparer, System.Runtime.Serialization.ISerializable where T : struct + { + public EnumEqualityComparer() { } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override bool Equals(T x, T y) { throw null; } + public override int GetHashCode() { throw null; } + public override int GetHashCode(T obj) { throw null; } + public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public sealed partial class GenericComparer : System.Collections.Generic.Comparer where T : System.IComparable + { + public GenericComparer() { } + public override int Compare(T? x, T? y) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override int GetHashCode() { throw null; } + } + public sealed partial class GenericEqualityComparer : System.Collections.Generic.EqualityComparer where T : System.IEquatable + { + public GenericEqualityComparer() { } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override bool Equals(T? x, T? y) { throw null; } + public override int GetHashCode() { throw null; } + public override int GetHashCode([System.Diagnostics.CodeAnalysis.DisallowNullAttribute] T obj) { throw null; } + } + public partial class NonRandomizedStringEqualityComparer : System.Collections.Generic.IEqualityComparer, System.Runtime.Serialization.ISerializable + { + protected NonRandomizedStringEqualityComparer(System.Runtime.Serialization.SerializationInfo information, System.Runtime.Serialization.StreamingContext context) { } + public virtual bool Equals(string? x, string? y) { throw null; } + public virtual int GetHashCode(string? obj) { throw null; } + public static System.Collections.Generic.IEqualityComparer? GetStringComparer(object? comparer) { throw null; } + public virtual System.Collections.Generic.IEqualityComparer GetUnderlyingEqualityComparer() { throw null; } + void System.Runtime.Serialization.ISerializable.GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public sealed partial class NullableComparer : System.Collections.Generic.Comparer, System.Runtime.Serialization.ISerializable where T : struct + { + public NullableComparer() { } + public override int Compare(T? x, T? y) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override int GetHashCode() { throw null; } + public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public sealed partial class NullableEqualityComparer : System.Collections.Generic.EqualityComparer, System.Runtime.Serialization.ISerializable where T : struct + { + public NullableEqualityComparer() { } + public override bool Equals(T? x, T? y) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override int GetHashCode() { throw null; } + public override int GetHashCode(T? obj) { throw null; } + public void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } + public sealed partial class ObjectComparer : System.Collections.Generic.Comparer + { + public ObjectComparer() { } + public override int Compare(T? x, T? y) { throw null; } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override int GetHashCode() { throw null; } + } + public sealed partial class ObjectEqualityComparer : System.Collections.Generic.EqualityComparer + { + public ObjectEqualityComparer() { } + public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? obj) { throw null; } + public override bool Equals(T? x, T? y) { throw null; } + public override int GetHashCode() { throw null; } + public override int GetHashCode([System.Diagnostics.CodeAnalysis.DisallowNullAttribute] T obj) { throw null; } + } +} +namespace System.Diagnostics.Contracts +{ + public sealed partial class ContractException : System.Exception + { + public ContractException(System.Diagnostics.Contracts.ContractFailureKind kind, string? failure, string? userMessage, string? condition, System.Exception? innerException) { } + public string? Condition { get { throw null; } } + public string Failure { get { throw null; } } + public System.Diagnostics.Contracts.ContractFailureKind Kind { get { throw null; } } + public string? UserMessage { get { throw null; } } + public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) { } + } +} +namespace System.Reflection.Emit +{ + public enum PEFileKinds + { + Dll = 1, + ConsoleApplication = 2, + WindowApplication = 3, + } +} diff --git a/src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.csproj b/src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.csproj new file mode 100644 index 00000000000000..e8787e79c478f2 --- /dev/null +++ b/src/libraries/System.Private.CoreLib/ref/System.Private.CoreLib.csproj @@ -0,0 +1,51 @@ + + + $(NetCoreAppCurrent) + true + enable + + v4.0.30319 + + $(NoWarn);0809;0618;CS8614;CS3015 + SilverlightPlatform + true + $(DefineConstants);BUILDING_CORELIB_REFERENCE + + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs b/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs index e7eb8164ddbdc6..cd44980db97bcd 100644 --- a/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs +++ b/src/libraries/System.Runtime.InteropServices/ref/System.Runtime.InteropServices.cs @@ -76,6 +76,7 @@ public void Write(long position, ref T structure) where T : struct { } } namespace System.Runtime.CompilerServices { +#if !BUILDING_CORELIB_REFERENCE [System.Runtime.Versioning.SupportedOSPlatformAttribute("windows")] [System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter, Inherited=false)] public sealed partial class IDispatchConstantAttribute : System.Runtime.CompilerServices.CustomConstantAttribute @@ -89,6 +90,7 @@ public sealed partial class IUnknownConstantAttribute : System.Runtime.CompilerS public IUnknownConstantAttribute() { } public override object Value { get { throw null; } } } +#endif } namespace System.Runtime.InteropServices { @@ -111,12 +113,14 @@ public readonly partial struct ArrayWithOffset public static bool operator ==(System.Runtime.InteropServices.ArrayWithOffset a, System.Runtime.InteropServices.ArrayWithOffset b) { throw null; } public static bool operator !=(System.Runtime.InteropServices.ArrayWithOffset a, System.Runtime.InteropServices.ArrayWithOffset b) { throw null; } } +#if !BUILDING_CORELIB_REFERENCE [System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Interface, Inherited=false)] public sealed partial class AutomationProxyAttribute : System.Attribute { public AutomationProxyAttribute(bool val) { } public bool Value { get { throw null; } } } +#endif [System.AttributeUsageAttribute(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Interface | System.AttributeTargets.Struct, Inherited=false)] public sealed partial class BestFitMappingAttribute : System.Attribute { @@ -180,6 +184,7 @@ public static partial class CollectionsMarshal public static ref TValue GetValueRefOrNullRef(System.Collections.Generic.Dictionary dictionary, TKey key) where TKey : notnull { throw null; } public static ref TValue? GetValueRefOrAddDefault(System.Collections.Generic.Dictionary dictionary, TKey key, out bool exists) where TKey : notnull { throw null; } } +#if !BUILDING_CORELIB_REFERENCE [System.AttributeUsageAttribute(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.Property | System.AttributeTargets.ReturnValue, Inherited=false)] public sealed partial class ComAliasNameAttribute : System.Attribute { @@ -223,6 +228,7 @@ public sealed partial class ComConversionLossAttribute : System.Attribute { public ComConversionLossAttribute() { } } +#endif [System.AttributeUsageAttribute(System.AttributeTargets.Class, Inherited=false)] public sealed partial class ComDefaultInterfaceAttribute : System.Attribute { @@ -273,11 +279,13 @@ public enum ComMemberType PropGet = 1, PropSet = 2, } +#if !BUILDING_CORELIB_REFERENCE [System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)] public sealed partial class ComRegisterFunctionAttribute : System.Attribute { public ComRegisterFunctionAttribute() { } } +#endif [System.AttributeUsageAttribute(System.AttributeTargets.Class, Inherited=true)] [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class ComSourceInterfacesAttribute : System.Attribute @@ -289,11 +297,13 @@ public ComSourceInterfacesAttribute(System.Type sourceInterface1, System.Type so public ComSourceInterfacesAttribute(System.Type sourceInterface1, System.Type sourceInterface2, System.Type sourceInterface3, System.Type sourceInterface4) { } public string Value { get { throw null; } } } +#if !BUILDING_CORELIB_REFERENCE [System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)] public sealed partial class ComUnregisterFunctionAttribute : System.Attribute { public ComUnregisterFunctionAttribute() { } } +#endif [System.CLSCompliantAttribute(false)] public readonly partial struct CULong : System.IEquatable { @@ -403,6 +413,7 @@ public sealed partial class GuidAttribute : System.Attribute public GuidAttribute(string guid) { } public string Value { get { throw null; } } } +#if !BUILDING_CORELIB_REFERENCE public sealed partial class HandleCollector { public HandleCollector(string? name, int initialThreshold) { } @@ -414,6 +425,7 @@ public HandleCollector(string? name, int initialThreshold, int maximumThreshold) public void Add() { } public void Remove() { } } +#endif public readonly partial struct HandleRef { private readonly object _dummy; @@ -451,12 +463,14 @@ public partial interface IDynamicInterfaceCastable bool IsInterfaceImplemented(System.RuntimeTypeHandle interfaceType, bool throwIfNotImplemented); System.RuntimeTypeHandle GetInterfaceImplementation(System.RuntimeTypeHandle interfaceType); } +#if !BUILDING_CORELIB_REFERENCE [System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false)] public sealed partial class ImportedFromTypeLibAttribute : System.Attribute { public ImportedFromTypeLibAttribute(string tlbFile) { } public string Value { get { throw null; } } } +#endif [System.AttributeUsageAttribute(System.AttributeTargets.Interface, Inherited=false)] public sealed partial class InterfaceTypeAttribute : System.Attribute { @@ -484,6 +498,7 @@ public sealed partial class LCIDConversionAttribute : System.Attribute public LCIDConversionAttribute(int lcid) { } public int Value { get { throw null; } } } +#if !BUILDING_CORELIB_REFERENCE [System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false, AllowMultiple=false)] public sealed partial class ManagedToNativeComInteropStubAttribute : System.Attribute { @@ -491,6 +506,7 @@ public ManagedToNativeComInteropStubAttribute(System.Type classType, string meth public System.Type ClassType { get { throw null; } } public string MethodName { get { throw null; } } } +#endif public static partial class Marshal { public static readonly int SystemDefaultCharSize; @@ -934,6 +950,7 @@ public sealed partial class PreserveSigAttribute : System.Attribute { public PreserveSigAttribute() { } } +#if !BUILDING_CORELIB_REFERENCE [System.AttributeUsageAttribute(System.AttributeTargets.Assembly, Inherited=false, AllowMultiple=true)] public sealed partial class PrimaryInteropAssemblyAttribute : System.Attribute { @@ -941,12 +958,14 @@ public PrimaryInteropAssemblyAttribute(int major, int minor) { } public int MajorVersion { get { throw null; } } public int MinorVersion { get { throw null; } } } +#endif [System.AttributeUsageAttribute(System.AttributeTargets.Class, Inherited=false)] public sealed partial class ProgIdAttribute : System.Attribute { public ProgIdAttribute(string progId) { } public string Value { get { throw null; } } } +#if !BUILDING_CORELIB_REFERENCE public static partial class RuntimeEnvironment { [System.ObsoleteAttribute("RuntimeEnvironment members SystemConfigurationFile, GetRuntimeInterfaceAsIntPtr, and GetRuntimeInterfaceAsObject are not supported and throw PlatformNotSupportedException.", DiagnosticId = "SYSLIB0019", UrlFormat = "https://aka.ms/dotnet-warnings/{0}")] @@ -959,6 +978,7 @@ public static partial class RuntimeEnvironment public static object GetRuntimeInterfaceAsObject(System.Guid clsid, System.Guid riid) { throw null; } public static string GetSystemVersion() { throw null; } } +#endif public partial class SafeArrayRankMismatchException : System.SystemException { public SafeArrayRankMismatchException() { } @@ -993,6 +1013,7 @@ public TypeIdentifierAttribute(string? scope, string? identifier) { } public string? Identifier { get { throw null; } } public string? Scope { get { throw null; } } } +#if !BUILDING_CORELIB_REFERENCE [System.AttributeUsageAttribute(System.AttributeTargets.Method, Inherited=false)] public sealed partial class TypeLibFuncAttribute : System.Attribute { @@ -1079,6 +1100,7 @@ public TypeLibVersionAttribute(int major, int minor) { } public int MajorVersion { get { throw null; } } public int MinorVersion { get { throw null; } } } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public sealed partial class UnknownWrapper { @@ -1204,6 +1226,7 @@ public sealed partial class VariantWrapper public VariantWrapper(object? obj) { } public object? WrappedObject { get { throw null; } } } +#if !BUILDING_CORELIB_REFERENCE [System.FlagsAttribute] public enum CreateComInterfaceFlags { @@ -1262,9 +1285,11 @@ public UnmanagedCallersOnlyAttribute() { } public System.Type[]? CallConvs; public string? EntryPoint; } +#endif } namespace System.Runtime.InteropServices.ComTypes { +#if !BUILDING_CORELIB_REFERENCE [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.FlagsAttribute] public enum ADVF @@ -1277,6 +1302,7 @@ public enum ADVF ADVFCACHE_ONSAVE = 32, ADVF_DATAONSTOP = 64, } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Explicit)] public partial struct BINDPTR @@ -1318,12 +1344,14 @@ public partial struct CONNECTDATA public int dwCookie; public object pUnk; } +#if !BUILDING_CORELIB_REFERENCE [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public enum DATADIR { DATADIR_GET = 1, DATADIR_SET = 2, } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public enum DESCKIND { @@ -1343,6 +1371,7 @@ public partial struct DISPPARAMS public System.IntPtr rgdispidNamedArgs; public System.IntPtr rgvarg; } +#if !BUILDING_CORELIB_REFERENCE [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.FlagsAttribute] public enum DVASPECT @@ -1352,6 +1381,7 @@ public enum DVASPECT DVASPECT_ICON = 4, DVASPECT_DOCPRINT = 8, } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct ELEMDESC @@ -1388,6 +1418,7 @@ public partial struct FILETIME public int dwHighDateTime; public int dwLowDateTime; } +#if !BUILDING_CORELIB_REFERENCE [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct FORMATETC @@ -1398,6 +1429,7 @@ public partial struct FORMATETC public System.IntPtr ptd; public System.Runtime.InteropServices.ComTypes.TYMED tymed; } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct FUNCDESC @@ -1442,6 +1474,7 @@ public enum FUNCKIND FUNC_STATIC = 3, FUNC_DISPATCH = 4, } +#if !BUILDING_CORELIB_REFERENCE [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)] public partial interface IAdviseSink @@ -1452,6 +1485,7 @@ public partial interface IAdviseSink void OnSave(); void OnViewChange(int aspect, int index); } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)] public partial interface IBindCtx @@ -1484,6 +1518,7 @@ public partial interface IConnectionPointContainer void EnumConnectionPoints(out System.Runtime.InteropServices.ComTypes.IEnumConnectionPoints ppEnum); void FindConnectionPoint(ref System.Guid riid, out System.Runtime.InteropServices.ComTypes.IConnectionPoint? ppCP); } +#if !BUILDING_CORELIB_REFERENCE [System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)] public partial interface IDataObject { @@ -1497,6 +1532,7 @@ public partial interface IDataObject int QueryGetData(ref System.Runtime.InteropServices.ComTypes.FORMATETC format); void SetData(ref System.Runtime.InteropServices.ComTypes.FORMATETC formatIn, ref System.Runtime.InteropServices.ComTypes.STGMEDIUM medium, bool release); } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct IDLDESC @@ -1532,6 +1568,7 @@ public partial interface IEnumConnections void Reset(); int Skip(int celt); } +#if !BUILDING_CORELIB_REFERENCE [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)] public partial interface IEnumFORMATETC @@ -1541,6 +1578,7 @@ public partial interface IEnumFORMATETC int Reset(); int Skip(int celt); } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)] public partial interface IEnumMoniker @@ -1550,6 +1588,7 @@ public partial interface IEnumMoniker void Reset(); int Skip(int celt); } +#if !BUILDING_CORELIB_REFERENCE [System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)] public partial interface IEnumSTATDATA { @@ -1558,6 +1597,7 @@ public partial interface IEnumSTATDATA int Reset(); int Skip(int celt); } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown)] public partial interface IEnumString @@ -1791,6 +1831,7 @@ public enum PARAMFLAG : short PARAMFLAG_FHASDEFAULT = (short)32, PARAMFLAG_FHASCUSTDATA = (short)64, } +#if !BUILDING_CORELIB_REFERENCE [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct STATDATA @@ -1800,6 +1841,7 @@ public partial struct STATDATA public int connection; public System.Runtime.InteropServices.ComTypes.FORMATETC formatetc; } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct STATSTG @@ -1816,6 +1858,7 @@ public partial struct STATSTG public int reserved; public int type; } +#if !BUILDING_CORELIB_REFERENCE [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct STGMEDIUM @@ -1824,6 +1867,7 @@ public partial struct STGMEDIUM public System.Runtime.InteropServices.ComTypes.TYMED tymed; public System.IntPtr unionmember; } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public enum SYSKIND { @@ -1832,6 +1876,7 @@ public enum SYSKIND SYS_MAC = 2, SYS_WIN64 = 3, } +#if !BUILDING_CORELIB_REFERENCE [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.FlagsAttribute] public enum TYMED @@ -1845,6 +1890,7 @@ public enum TYMED TYMED_MFPICT = 32, TYMED_ENHMF = 64, } +#endif [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public partial struct TYPEATTR @@ -2021,6 +2067,7 @@ public void MakeReadOnly() { } public void RemoveAt(int index) { } public void SetAt(int index, char c) { } } +#if !BUILDING_CORELIB_REFERENCE public static partial class SecureStringMarshal { public static System.IntPtr SecureStringToCoTaskMemAnsi(System.Security.SecureString s) { throw null; } @@ -2028,4 +2075,5 @@ public static partial class SecureStringMarshal public static System.IntPtr SecureStringToGlobalAllocAnsi(System.Security.SecureString s) { throw null; } public static System.IntPtr SecureStringToGlobalAllocUnicode(System.Security.SecureString s) { throw null; } } +#endif } diff --git a/src/libraries/System.Runtime/ref/System.Runtime.cs b/src/libraries/System.Runtime/ref/System.Runtime.cs index 17d5d0e7e131a2..66aa431bb4861f 100644 --- a/src/libraries/System.Runtime/ref/System.Runtime.cs +++ b/src/libraries/System.Runtime/ref/System.Runtime.cs @@ -2861,10 +2861,12 @@ protected FieldAccessException(System.Runtime.Serialization.SerializationInfo in public FieldAccessException(string? message) { } public FieldAccessException(string? message, System.Exception? inner) { } } +#if !BUILDING_CORELIB_REFERENCE public partial class FileStyleUriParser : System.UriParser { public FileStyleUriParser() { } } +#endif [System.AttributeUsageAttribute(System.AttributeTargets.Enum, Inherited=false)] public partial class FlagsAttribute : System.Attribute { @@ -2890,10 +2892,12 @@ protected FormattableString() { } public override string ToString() { throw null; } public abstract string ToString(System.IFormatProvider? formatProvider); } +#if !BUILDING_CORELIB_REFERENCE public partial class FtpStyleUriParser : System.UriParser { public FtpStyleUriParser() { } } +#endif public delegate TResult Func(); public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9); public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10); @@ -2996,6 +3000,7 @@ public enum GCNotificationStatus Timeout = 3, NotApplicable = 4, } +#if !BUILDING_CORELIB_REFERENCE public partial class GenericUriParser : System.UriParser { public GenericUriParser(System.GenericUriParserOptions options) { } @@ -3020,6 +3025,7 @@ public partial class GopherStyleUriParser : System.UriParser { public GopherStyleUriParser() { } } +#endif public readonly partial struct Guid : System.IComparable, System.IComparable, System.IEquatable, System.ISpanFormattable #if FEATURE_GENERIC_MATH #pragma warning disable SA1001 @@ -3386,10 +3392,12 @@ public void AddBytes(System.ReadOnlySpan value) { } public override int GetHashCode() { throw null; } public int ToHashCode() { throw null; } } +#if !BUILDING_CORELIB_REFERENCE public partial class HttpStyleUriParser : System.UriParser { public HttpStyleUriParser() { } } +#endif #if FEATURE_GENERIC_MATH [System.Runtime.Versioning.RequiresPreviewFeaturesAttribute("Generic Math is in preview.", Url = "https://aka.ms/dotnet-warnings/generic-math-preview")] public partial interface IAdditionOperators @@ -4516,10 +4524,12 @@ public Lazy(TMetadata metadata, bool isThreadSafe) { } public Lazy(TMetadata metadata, System.Threading.LazyThreadSafetyMode mode) { } public TMetadata Metadata { get { throw null; } } } +#if !BUILDING_CORELIB_REFERENCE public partial class LdapStyleUriParser : System.UriParser { public LdapStyleUriParser() { } } +#endif public enum LoaderOptimization { NotSpecified = 0, @@ -4878,6 +4888,7 @@ public MulticastNotSupportedException() { } public MulticastNotSupportedException(string? message) { } public MulticastNotSupportedException(string? message, System.Exception? inner) { } } +#if !BUILDING_CORELIB_REFERENCE public partial class NetPipeStyleUriParser : System.UriParser { public NetPipeStyleUriParser() { } @@ -4890,6 +4901,7 @@ public partial class NewsStyleUriParser : System.UriParser { public NewsStyleUriParser() { } } +#endif [System.AttributeUsageAttribute(System.AttributeTargets.Field, Inherited=false)] public sealed partial class NonSerializedAttribute : System.Attribute { @@ -7693,6 +7705,7 @@ public UnhandledExceptionEventArgs(object exception, bool isTerminating) { } public bool IsTerminating { get { throw null; } } } public delegate void UnhandledExceptionEventHandler(object sender, System.UnhandledExceptionEventArgs e); +#if !BUILDING_CORELIB_REFERENCE public partial class Uri : System.Runtime.Serialization.ISerializable { public static readonly string SchemeDelimiter; @@ -7896,6 +7909,7 @@ public enum UriPartial Path = 2, Query = 3, } +#endif public partial struct ValueTuple : System.Collections.IStructuralComparable, System.Collections.IStructuralEquatable, System.IComparable, System.IComparable, System.IEquatable, System.Runtime.CompilerServices.ITuple { object? System.Runtime.CompilerServices.ITuple.this[int index] { get { throw null; } } diff --git a/src/libraries/System.Runtime/src/System.Runtime.csproj b/src/libraries/System.Runtime/src/System.Runtime.csproj index 38cdb0e8526dc3..3fc27869c3381b 100644 --- a/src/libraries/System.Runtime/src/System.Runtime.csproj +++ b/src/libraries/System.Runtime/src/System.Runtime.csproj @@ -15,6 +15,6 @@ - + diff --git a/src/libraries/System.Threading/ref/System.Threading.cs b/src/libraries/System.Threading/ref/System.Threading.cs index 1237c49cecaedc..e55f5c656315b7 100644 --- a/src/libraries/System.Threading/ref/System.Threading.cs +++ b/src/libraries/System.Threading/ref/System.Threading.cs @@ -50,6 +50,7 @@ public sealed partial class AutoResetEvent : System.Threading.EventWaitHandle { public AutoResetEvent(bool initialState) : base (default(bool), default(System.Threading.EventResetMode)) { } } +#if !BUILDING_CORELIB_REFERENCE public partial class Barrier : System.IDisposable { public Barrier(int participantCount) { } @@ -86,7 +87,9 @@ protected BarrierPostPhaseException(System.Runtime.Serialization.SerializationIn public BarrierPostPhaseException(string? message) { } public BarrierPostPhaseException(string? message, System.Exception? innerException) { } } +#endif public delegate void ContextCallback(object? state); +#if !BUILDING_CORELIB_REFERENCE public partial class CountdownEvent : System.IDisposable { public CountdownEvent(int initialCount) { } @@ -117,6 +120,7 @@ public void Wait(System.Threading.CancellationToken cancellationToken) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] public bool Wait(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; } } +#endif public enum EventResetMode { AutoReset = 0, @@ -147,6 +151,7 @@ public static void RestoreFlow() { } public static void Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object? state) { } public static System.Threading.AsyncFlowControl SuppressFlow() { throw null; } } +#if !BUILDING_CORELIB_REFERENCE public partial class HostExecutionContext : System.IDisposable { public HostExecutionContext() { } @@ -163,6 +168,7 @@ public HostExecutionContextManager() { } public virtual void Revert(object previousState) { } public virtual object SetHostExecutionContext(System.Threading.HostExecutionContext hostExecutionContext) { throw null; } } +#endif public static partial class Interlocked { public static int Add(ref int location1, int value) { throw null; } @@ -235,6 +241,7 @@ public static partial class LazyInitializer public static T EnsureInitialized([System.Diagnostics.CodeAnalysis.NotNullAttribute] ref T? target, System.Func valueFactory) where T : class { throw null; } public static T EnsureInitialized([System.Diagnostics.CodeAnalysis.NotNullAttribute] ref T? target, [System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute("syncLock")] ref object? syncLock, System.Func valueFactory) where T : class { throw null; } } +#if !BUILDING_CORELIB_REFERENCE public partial struct LockCookie { private int _dummyPrimitive; @@ -244,6 +251,7 @@ public partial struct LockCookie public static bool operator ==(System.Threading.LockCookie a, System.Threading.LockCookie b) { throw null; } public static bool operator !=(System.Threading.LockCookie a, System.Threading.LockCookie b) { throw null; } } +#endif public partial class LockRecursionException : System.Exception { public LockRecursionException() { } @@ -321,6 +329,7 @@ public Mutex(bool initiallyOwned, string? name) { } public void ReleaseMutex() { } public static bool TryOpenExisting(string name, [System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] out System.Threading.Mutex? result) { throw null; } } +#if !BUILDING_CORELIB_REFERENCE public sealed partial class ReaderWriterLock : System.Runtime.ConstrainedExecution.CriticalFinalizerObject { public ReaderWriterLock() { } @@ -345,6 +354,7 @@ public void RestoreLock(ref System.Threading.LockCookie lockCookie) { } [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")] public System.Threading.LockCookie UpgradeToWriterLock(System.TimeSpan timeout) { throw null; } } +#endif public partial class ReaderWriterLockSlim : System.IDisposable { public ReaderWriterLockSlim() { } diff --git a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj index cb69737648039a..05459da848e340 100644 --- a/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj +++ b/src/mono/System.Private.CoreLib/System.Private.CoreLib.csproj @@ -347,4 +347,10 @@ + + + true + + +