</AssemblyAttribute>
</ItemGroup>
+ <PropertyGroup Condition="'$(TargetsAnyOS)' == 'true' and !$(TargetFrameworks.Contains('$(TargetFramework)-Browser'))">
+ <CrossPlatformAndHasNoBrowserTarget>true</CrossPlatformAndHasNoBrowserTarget>
+ </PropertyGroup>
+
+ <!-- Enables browser warnings for cross platform or Brwoser targeted builds -->
+ <ItemGroup Condition="('$(TargetsBrowser)' == 'true' or '$(CrossPlatformAndHasNoBrowserTarget)' == 'true') and '$(IsTestProject)' != 'true'">
+ <SupportedPlatform Include="browser"/>
+ </ItemGroup>
+
<ItemGroup>
<_unsupportedOSPlatforms Include="$(UnsupportedOSPlatforms)" />
</ItemGroup>
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
/// a send operation while another is in progress or a receive operation while another is in progress will
/// result in an exception.
/// </remarks>
+ [UnsupportedOSPlatform("browser")]
internal sealed partial class ManagedWebSocket : WebSocket
{
/// <summary>Creates a <see cref="ManagedWebSocket"/> from a <see cref="Stream"/> connected to a websocket endpoint.</summary>
namespace Microsoft.Extensions.Logging
{
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static partial class ConsoleLoggerExtensions
{
public static Microsoft.Extensions.Logging.ILoggingBuilder AddConsole(this Microsoft.Extensions.Logging.ILoggingBuilder builder) { throw null; }
[System.ObsoleteAttribute("ConsoleLoggerOptions.UseUtcTimestamp has been deprecated. Please use ConsoleFormatterOptions.UseUtcTimestamp instead.", false)]
public bool UseUtcTimestamp { get { throw null; } set { } }
}
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[Microsoft.Extensions.Logging.ProviderAliasAttribute("Console")]
public partial class ConsoleLoggerProvider : Microsoft.Extensions.Logging.ILoggerProvider, Microsoft.Extensions.Logging.ISupportExternalScope, System.IDisposable
{
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
+ <IncludePlatformAttributes>true</IncludePlatformAttributes>
</PropertyGroup>
<ItemGroup>
using System;
using System.IO;
+using System.Runtime.Versioning;
namespace Microsoft.Extensions.Logging.Console
{
+ [UnsupportedOSPlatform("browser")]
internal class AnsiParsingLogConsole : IConsole
{
private readonly TextWriter _textWriter;
using System;
using System.IO;
+using System.Runtime.Versioning;
using Microsoft.Extensions.Logging.Abstractions;
namespace Microsoft.Extensions.Logging.Console
{
+ [UnsupportedOSPlatform("browser")]
internal class ConsoleLogger : ILogger
{
private readonly string _name;
using System;
using System.Diagnostics.CodeAnalysis;
+using System.Runtime.Versioning;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Microsoft.Extensions.Logging
{
+ [UnsupportedOSPlatform("browser")]
public static class ConsoleLoggerExtensions
{
/// <summary>
}
}
+ [UnsupportedOSPlatform("browser")]
internal class ConsoleLoggerFormatterConfigureOptions<TFormatter, TOptions> : ConfigureFromConfigurationOptions<TOptions>
where TOptions : ConsoleFormatterOptions
where TFormatter : ConsoleFormatter
}
}
+ [UnsupportedOSPlatform("browser")]
internal class ConsoleLoggerFormatterOptionsChangeTokenSource<TFormatter, TOptions> : ConfigurationChangeTokenSource<TOptions>
where TOptions : ConsoleFormatterOptions
where TFormatter : ConsoleFormatter
using System;
using System.Collections.Concurrent;
+using System.Runtime.Versioning;
using System.Threading;
namespace Microsoft.Extensions.Logging.Console
{
+ [UnsupportedOSPlatform("browser")]
internal class ConsoleLoggerProcessor : IDisposable
{
private const int _maxQueuedMessages = 1024;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
using Microsoft.Extensions.Options;
namespace Microsoft.Extensions.Logging.Console
/// <summary>
/// A provider of <see cref="ConsoleLogger"/> instances.
/// </summary>
+ [UnsupportedOSPlatform("browser")]
[ProviderAlias("Console")]
public class ConsoleLoggerProvider : ILoggerProvider, ISupportExternalScope
{
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>$(NetCoreAppCurrent);netcoreapp3.0;netstandard2.0;net461</TargetFrameworks>
<DefineConstants>$(DefineConstants);NO_SUPPRESS_GC_TRANSITION</DefineConstants>
<!-- Use targeting pack references instead of granular ones in the project file. -->
<DisableImplicitAssemblyReferences>false</DisableImplicitAssemblyReferences>
+ <IncludePlatformAttributes>true</IncludePlatformAttributes>
</PropertyGroup>
<ItemGroup>
namespace System.Collections.Concurrent
{
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public partial class BlockingCollection<T> : System.Collections.Generic.IEnumerable<T>, System.Collections.Generic.IReadOnlyCollection<T>, System.Collections.ICollection, System.Collections.IEnumerable, System.IDisposable
{
public BlockingCollection() { }
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
+using System.Runtime.Versioning;
using System.Threading;
namespace System.Collections.Concurrent
/// away as an <see cref="System.Collections.Concurrent.IProducerConsumerCollection{T}"/>.
/// </remarks>
/// <typeparam name="T">Specifies the type of elements in the collection.</typeparam>
+ [UnsupportedOSPlatform("browser")]
[DebuggerTypeProxy(typeof(BlockingCollectionDebugView<>))]
[DebuggerDisplay("Count = {Count}, Type = {_collection}")]
public class BlockingCollection<T> : IEnumerable<T>, ICollection, IDisposable, IReadOnlyCollection<T>
}
/// <summary>Returns a snapshot of the underlying collection's elements.</summary>
+ [UnsupportedOSPlatform("browser")]
[DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
public T[] Items
{
{
protected TypeDescriptionProvider() { }
protected TypeDescriptionProvider(System.ComponentModel.TypeDescriptionProvider parent) { }
- [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public virtual object CreateInstance(System.IServiceProvider provider, System.Type objectType, System.Type[] argTypes, object[] args) { throw null; }
public virtual System.Collections.IDictionary GetCache(object instance) { throw null; }
public virtual System.ComponentModel.ICustomTypeDescriptor GetExtendedTypeDescriptor(object instance) { throw null; }
public static System.ComponentModel.Design.IDesigner CreateDesigner(System.ComponentModel.IComponent component, System.Type designerBaseType) { throw null; }
public static System.ComponentModel.EventDescriptor CreateEvent(System.Type componentType, System.ComponentModel.EventDescriptor oldEventDescriptor, params System.Attribute[] attributes) { throw null; }
public static System.ComponentModel.EventDescriptor CreateEvent(System.Type componentType, string name, System.Type type, params System.Attribute[] attributes) { throw null; }
- [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public static object CreateInstance(System.IServiceProvider provider, System.Type objectType, System.Type[] argTypes, object[] args) { throw null; }
public static System.ComponentModel.PropertyDescriptor CreateProperty(System.Type componentType, System.ComponentModel.PropertyDescriptor oldPropertyDescriptor, params System.Attribute[] attributes) { throw null; }
public static System.ComponentModel.PropertyDescriptor CreateProperty(System.Type componentType, string name, System.Type type, params System.Attribute[] attributes) { throw null; }
/// parent provider was passed. If a parent provider was passed, this
/// method will invoke the parent provider's CreateInstance method.
/// </summary>
- [UnsupportedOSPlatform("browser")]
public virtual object CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, object[] args)
{
if (_parent != null)
/// a TypeDescriptionProvider object that is associated with the given
/// data type. If it finds one, it will delegate the call to that object.
/// </summary>
- [UnsupportedOSPlatform("browser")]
public static object CreateInstance(IServiceProvider provider, Type objectType, Type[] argTypes, object[] args)
{
if (objectType == null)
string? processName = s_processName;
if (processName is null)
{
- try
+ if (OperatingSystem.IsBrowser()) // Process isn't supported on Browser
{
- using Process process = Process.GetCurrentProcess();
- s_processName = processName = process.ProcessName;
+ s_processName = processName = string.Empty;
}
- catch (PlatformNotSupportedException) // Process isn't supported on Browser
+ else
{
- s_processName = processName = string.Empty;
+ using Process process = Process.GetCurrentProcess();
+ s_processName = processName = process.ProcessName;
}
}
namespace System.Diagnostics.Tracing
{
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public abstract partial class DiagnosticCounter : System.IDisposable
{
internal DiagnosticCounter() { }
public void AddMetadata(string key, string? value) { }
public void Dispose() { }
}
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public partial class PollingCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public PollingCounter(string name, System.Diagnostics.Tracing.EventSource eventSource, System.Func<double> metricProvider) { }
public override string ToString() { throw null; }
}
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public partial class IncrementingEventCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public IncrementingEventCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) { }
public void Increment(double increment = 1) { }
public override string ToString() { throw null; }
}
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public partial class IncrementingPollingCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public IncrementingPollingCounter(string name, System.Diagnostics.Tracing.EventSource eventSource, System.Func<double> totalValueProvider) { }
public System.TimeSpan DisplayRateTimeScale { get { throw null; } set { } }
public override string ToString() { throw null; }
}
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public partial class EventCounter : System.Diagnostics.Tracing.DiagnosticCounter
{
public EventCounter(string name, System.Diagnostics.Tracing.EventSource eventSource) { }
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<StrongNameKeyId>Microsoft</StrongNameKeyId>
+ <UnsupportedOSPlatforms>browser</UnsupportedOSPlatforms>
</PropertyGroup>
</Project>
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<StrongNameKeyId>Microsoft</StrongNameKeyId>
+ <UnsupportedOSPlatforms>browser</UnsupportedOSPlatforms>
</PropertyGroup>
</Project>
\ No newline at end of file
public System.Net.CookieContainer CookieContainer { get { throw null; } set { } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public System.Net.ICredentials? Credentials { get { throw null; } set { } }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public static System.Func<System.Net.Http.HttpRequestMessage, System.Security.Cryptography.X509Certificates.X509Certificate2?, System.Security.Cryptography.X509Certificates.X509Chain?, System.Net.Security.SslPolicyErrors, bool> DangerousAcceptAnyServerCertificateValidator { get { throw null; } }
[System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public System.Net.ICredentials? DefaultProxyCredentials { get { throw null; } set { } }
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<WindowsRID>win</WindowsRID>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Compile Include="System\Net\Http\Headers\UriHeaderParser.cs" />
<Compile Include="System\Net\Http\Headers\ViaHeaderValue.cs" />
<Compile Include="System\Net\Http\Headers\WarningHeaderValue.cs" />
- <Compile Include="$(CommonPath)System\Net\Security\SslClientAuthenticationOptionsExtensions.cs"
- Link="Common\System\Net\Security\SslClientAuthenticationOptionsExtensions.cs" />
<Compile Include="$(CommonPath)System\IO\DelegatingStream.cs"
Link="Common\System\IO\DelegatingStream.cs" />
<Compile Include="$(CommonPath)System\IO\ReadOnlyMemoryStream.cs"
<Compile Include="System\Net\Http\SocketsHttpHandler\RedirectHandler.cs" />
<Compile Include="System\Net\Http\SocketsHttpHandler\SocketsHttpConnectionContext.cs" />
<Compile Include="System\Net\Http\SocketsHttpHandler\SocketsHttpHandler.cs" />
+ <Compile Include="System\Net\Http\HttpTelemetry.AnyOS.cs" />
<Compile Include="System\Net\Http\HttpUtilities.AnyOS.cs" />
<Compile Include="System\Net\Http\SocketsHttpHandler\SystemProxyInfo.cs" />
<Compile Include="$(CommonPath)System\Net\NTAuthentication.Common.cs"
Link="Common\System\Net\SecurityStatusPal.cs" />
<Compile Include="$(CommonPath)System\Net\Security\SSPIHandleCache.cs"
Link="Common\System\Net\Security\SSPIHandleCache.cs" />
+ <Compile Include="$(CommonPath)System\Net\Security\SslClientAuthenticationOptionsExtensions.cs"
+ Link="Common\System\Net\Security\SslClientAuthenticationOptionsExtensions.cs" />
<Compile Include="$(CommonPath)System\Net\Security\NetEventSource.Security.cs"
Link="Common\System\Net\Security\NetEventSource.Security.cs" />
<Compile Include="$(CommonPath)System\Net\ExceptionCheck.cs"
<Compile Include="System\Net\Http\BrowserHttpHandler\SystemProxyInfo.Browser.cs" />
<Compile Include="System\Net\Http\BrowserHttpHandler\SocketsHttpHandler.cs" />
<Compile Include="System\Net\Http\BrowserHttpHandler\BrowserHttpHandler.cs" />
+ <Compile Include="System\Net\Http\BrowserHttpHandler\HttpTelemetry.Browser.cs" />
<Compile Include="System\Net\Http\BrowserHttpHandler\HttpUtilities.Browser.cs" />
<Compile Include="$(CommonPath)System\Net\Http\HttpHandlerDefaults.cs"
Link="Common\System\Net\Http\HttpHandlerDefaults.cs" />
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Diagnostics.Tracing;
+
+namespace System.Net.Http
+{
+ internal sealed partial class HttpTelemetry
+ {
+ public void Http11RequestLeftQueue(double timeOnQueueMilliseconds)
+ {
+ }
+
+ public void Http20RequestLeftQueue(double timeOnQueueMilliseconds)
+ {
+ }
+
+ protected override void OnEventCommand(EventCommandEventArgs command)
+ {
+ }
+ }
+}
// Wait for the send request to complete, getting back the response.
response = async ?
await base.SendAsync(request, cts.Token).ConfigureAwait(false) :
+#pragma warning disable CA1416 // Validate platform compatibility, not supported on browser, safe to suppress
base.Send(request, cts.Token);
+#pragma warning restore CA1416
ThrowForNullResponse(response);
// Buffer the response content if we've been asked to.
// lazy-load the validator func so it can be trimmed by the ILLinker if it isn't used.
private static Func<HttpRequestMessage, X509Certificate2?, X509Chain?, SslPolicyErrors, bool>? s_dangerousAcceptAnyServerCertificateValidator;
+ [UnsupportedOSPlatform("browser")]
public static Func<HttpRequestMessage, X509Certificate2?, X509Chain?, SslPolicyErrors, bool> DangerousAcceptAnyServerCertificateValidator =>
Volatile.Read(ref s_dangerousAcceptAnyServerCertificateValidator) ??
Interlocked.CompareExchange(ref s_dangerousAcceptAnyServerCertificateValidator, delegate { return true; }, null) ??
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+using System.Diagnostics;
+using System.Diagnostics.Tracing;
+using System.Threading;
+
+namespace System.Net.Http
+{
+ internal sealed partial class HttpTelemetry
+ {
+ private IncrementingPollingCounter? _startedRequestsPerSecondCounter;
+ private IncrementingPollingCounter? _failedRequestsPerSecondCounter;
+ private PollingCounter? _startedRequestsCounter;
+ private PollingCounter? _currentRequestsCounter;
+ private PollingCounter? _failedRequestsCounter;
+ private PollingCounter? _totalHttp11ConnectionsCounter;
+ private PollingCounter? _totalHttp20ConnectionsCounter;
+ private EventCounter? _http11RequestsQueueDurationCounter;
+ private EventCounter? _http20RequestsQueueDurationCounter;
+
+ [NonEvent]
+ public void Http11RequestLeftQueue(double timeOnQueueMilliseconds)
+ {
+ _http11RequestsQueueDurationCounter!.WriteMetric(timeOnQueueMilliseconds);
+ RequestLeftQueue(timeOnQueueMilliseconds, versionMajor: 1, versionMinor: 1);
+ }
+
+ [NonEvent]
+ public void Http20RequestLeftQueue(double timeOnQueueMilliseconds)
+ {
+ _http20RequestsQueueDurationCounter!.WriteMetric(timeOnQueueMilliseconds);
+ RequestLeftQueue(timeOnQueueMilliseconds, versionMajor: 2, versionMinor: 0);
+ }
+
+ protected override void OnEventCommand(EventCommandEventArgs command)
+ {
+ if (command.Command == EventCommand.Enable)
+ {
+ // This is the convention for initializing counters in the RuntimeEventSource (lazily on the first enable command).
+ // They aren't disabled afterwards...
+
+ // The cumulative number of HTTP requests started since the process started.
+ _startedRequestsCounter ??= new PollingCounter("requests-started", this, () => Interlocked.Read(ref _startedRequests))
+ {
+ DisplayName = "Requests Started",
+ };
+
+ // The number of HTTP requests started per second since the process started.
+ _startedRequestsPerSecondCounter ??= new IncrementingPollingCounter("requests-started-rate", this, () => Interlocked.Read(ref _startedRequests))
+ {
+ DisplayName = "Requests Started Rate",
+ DisplayRateTimeScale = TimeSpan.FromSeconds(1)
+ };
+
+ // The cumulative number of HTTP requests failed since the process started.
+ // Failed means that an exception occurred during the handler's Send(Async) call as a result of a connection related error, timeout, or explicitly cancelled.
+ // In case of using HttpClient's SendAsync(and friends) with buffering, this includes exceptions that occured while buffering the response content
+ // In case of using HttpClient's helper methods (GetString/ByteArray/Stream), this includes responses with non-success status codes
+ _failedRequestsCounter ??= new PollingCounter("requests-failed", this, () => Interlocked.Read(ref _failedRequests))
+ {
+ DisplayName = "Requests Failed"
+ };
+
+ // The number of HTTP requests failed per second since the process started.
+ _failedRequestsPerSecondCounter ??= new IncrementingPollingCounter("requests-failed-rate", this, () => Interlocked.Read(ref _failedRequests))
+ {
+ DisplayName = "Requests Failed Rate",
+ DisplayRateTimeScale = TimeSpan.FromSeconds(1)
+ };
+
+ // The current number of active HTTP requests that have started but not yet completed or failed.
+ // Use (-_stoppedRequests + _startedRequests) to avoid returning a negative value if _stoppedRequests is
+ // incremented after reading _startedRequests due to race conditions with completing the HTTP request.
+ _currentRequestsCounter ??= new PollingCounter("current-requests", this, () => -Interlocked.Read(ref _stoppedRequests) + Interlocked.Read(ref _startedRequests))
+ {
+ DisplayName = "Current Requests"
+ };
+
+ _totalHttp11ConnectionsCounter ??= new PollingCounter("http11-connections-current-total", this, () => Interlocked.Read(ref _openedHttp11Connections))
+ {
+ DisplayName = "Current Http 1.1 Connections"
+ };
+
+ _totalHttp20ConnectionsCounter ??= new PollingCounter("http20-connections-current-total", this, () => Interlocked.Read(ref _openedHttp20Connections))
+ {
+ DisplayName = "Current Http 2.0 Connections"
+ };
+
+ _http11RequestsQueueDurationCounter ??= new EventCounter("http11-requests-queue-duration", this)
+ {
+ DisplayName = "HTTP 1.1 Requests Queue Duration",
+ DisplayUnits = "ms"
+ };
+
+ _http20RequestsQueueDurationCounter ??= new EventCounter("http20-requests-queue-duration", this)
+ {
+ DisplayName = "HTTP 2.0 Requests Queue Duration",
+ DisplayUnits = "ms"
+ };
+ }
+ }
+ }
+}
namespace System.Net.Http
{
[EventSource(Name = "System.Net.Http")]
- internal sealed class HttpTelemetry : EventSource
+ internal sealed partial class HttpTelemetry : EventSource
{
public static readonly HttpTelemetry Log = new HttpTelemetry();
- private IncrementingPollingCounter? _startedRequestsPerSecondCounter;
- private IncrementingPollingCounter? _failedRequestsPerSecondCounter;
- private PollingCounter? _startedRequestsCounter;
- private PollingCounter? _currentRequestsCounter;
- private PollingCounter? _failedRequestsCounter;
- private PollingCounter? _totalHttp11ConnectionsCounter;
- private PollingCounter? _totalHttp20ConnectionsCounter;
- private EventCounter? _http11RequestsQueueDurationCounter;
- private EventCounter? _http20RequestsQueueDurationCounter;
-
private long _startedRequests;
private long _stoppedRequests;
private long _failedRequests;
}
[NonEvent]
- public void Http11RequestLeftQueue(double timeOnQueueMilliseconds)
- {
- _http11RequestsQueueDurationCounter!.WriteMetric(timeOnQueueMilliseconds);
- RequestLeftQueue(timeOnQueueMilliseconds, versionMajor: 1, versionMinor: 1);
- }
-
- [NonEvent]
- public void Http20RequestLeftQueue(double timeOnQueueMilliseconds)
- {
- _http20RequestsQueueDurationCounter!.WriteMetric(timeOnQueueMilliseconds);
- RequestLeftQueue(timeOnQueueMilliseconds, versionMajor: 2, versionMinor: 0);
- }
-
- protected override void OnEventCommand(EventCommandEventArgs command)
- {
- if (command.Command == EventCommand.Enable)
- {
- // This is the convention for initializing counters in the RuntimeEventSource (lazily on the first enable command).
- // They aren't disabled afterwards...
-
- // The cumulative number of HTTP requests started since the process started.
- _startedRequestsCounter ??= new PollingCounter("requests-started", this, () => Interlocked.Read(ref _startedRequests))
- {
- DisplayName = "Requests Started",
- };
-
- // The number of HTTP requests started per second since the process started.
- _startedRequestsPerSecondCounter ??= new IncrementingPollingCounter("requests-started-rate", this, () => Interlocked.Read(ref _startedRequests))
- {
- DisplayName = "Requests Started Rate",
- DisplayRateTimeScale = TimeSpan.FromSeconds(1)
- };
-
- // The cumulative number of HTTP requests failed since the process started.
- // Failed means that an exception occurred during the handler's Send(Async) call as a result of a connection related error, timeout, or explicitly cancelled.
- // In case of using HttpClient's SendAsync(and friends) with buffering, this includes exceptions that occured while buffering the response content
- // In case of using HttpClient's helper methods (GetString/ByteArray/Stream), this includes responses with non-success status codes
- _failedRequestsCounter ??= new PollingCounter("requests-failed", this, () => Interlocked.Read(ref _failedRequests))
- {
- DisplayName = "Requests Failed"
- };
-
- // The number of HTTP requests failed per second since the process started.
- _failedRequestsPerSecondCounter ??= new IncrementingPollingCounter("requests-failed-rate", this, () => Interlocked.Read(ref _failedRequests))
- {
- DisplayName = "Requests Failed Rate",
- DisplayRateTimeScale = TimeSpan.FromSeconds(1)
- };
-
- // The current number of active HTTP requests that have started but not yet completed or failed.
- // Use (-_stoppedRequests + _startedRequests) to avoid returning a negative value if _stoppedRequests is
- // incremented after reading _startedRequests due to race conditions with completing the HTTP request.
- _currentRequestsCounter ??= new PollingCounter("current-requests", this, () => -Interlocked.Read(ref _stoppedRequests) + Interlocked.Read(ref _startedRequests))
- {
- DisplayName = "Current Requests"
- };
-
- _totalHttp11ConnectionsCounter ??= new PollingCounter("http11-connections-current-total", this, () => Interlocked.Read(ref _openedHttp11Connections))
- {
- DisplayName = "Current Http 1.1 Connections"
- };
-
- _totalHttp20ConnectionsCounter ??= new PollingCounter("http20-connections-current-total", this, () => Interlocked.Read(ref _openedHttp20Connections))
- {
- DisplayName = "Current Http 2.0 Connections"
- };
-
- _http11RequestsQueueDurationCounter ??= new EventCounter("http11-requests-queue-duration", this)
- {
- DisplayName = "HTTP 1.1 Requests Queue Duration",
- DisplayUnits = "ms"
- };
-
- _http20RequestsQueueDurationCounter ??= new EventCounter("http20-requests-queue-duration", this)
- {
- DisplayName = "HTTP 2.0 Requests Queue Duration",
- DisplayUnits = "ms"
- };
- }
- }
-
- [NonEvent]
private unsafe void WriteEvent(int eventId, string? arg1, string? arg2, int arg3, string? arg4, byte arg5, byte arg6, HttpVersionPolicy arg7)
{
if (IsEnabled())
public static int DefaultConnectionLimit { get { throw null; } set { } }
public static int DnsRefreshTimeout { get { throw null; } set { } }
public static bool EnableDnsRoundRobin { get { throw null; } set { } }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static System.Net.Security.EncryptionPolicy EncryptionPolicy { get { throw null; } }
public static bool Expect100Continue { get { throw null; } set { } }
public static int MaxServicePointIdleTime { get { throw null; } set { } }
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Net.Security;
+using System.Runtime.Versioning;
using System.Threading;
namespace System.Net
public static bool CheckCertificateRevocationList { get; set; }
+ [UnsupportedOSPlatform("browser")]
public static EncryptionPolicy EncryptionPolicy { get; } = EncryptionPolicy.RequireEncryption;
[Obsolete(Obsoletions.WebRequestMessage, DiagnosticId = Obsoletions.WebRequestDiagId, UrlFormat = Obsoletions.SharedUrlFormat)]
using System.Globalization;
using System.Net.NetworkInformation;
using System.Runtime.Serialization;
+using System.Runtime.Versioning;
using System.Text.RegularExpressions;
namespace System.Net
string hostString = host.Host;
+#pragma warning disable CA1416 // Validate platform compatibility, issue: https://github.com/dotnet/runtime/issues/43751
if (IPAddress.TryParse(hostString, out IPAddress? hostAddress))
{
return IPAddress.IsLoopback(hostAddress) || IsAddressLocal(hostAddress);
// If it matches the primary domain, it's local. (Whether or not the hostname matches.)
string local = "." + IPGlobalProperties.GetIPGlobalProperties().DomainName;
+#pragma warning restore CA1416 // Validate platform compatibility
return
local.Length == (hostString.Length - dot) &&
string.Compare(local, 0, hostString, dot, local.Length, StringComparison.OrdinalIgnoreCase) == 0;
}
+ [UnsupportedOSPlatform("browser")]
private static bool IsAddressLocal(IPAddress ipAddress)
{
// Perf note: The .NET Framework caches this and then uses network change notifications to track
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<StrongNameKeyId>Open</StrongNameKeyId>
+ <IncludePlatformAttributes>true</IncludePlatformAttributes>
</PropertyGroup>
</Project>
\ No newline at end of file
namespace System.Net.WebSockets
{
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static partial class WebSocketProtocol
{
public static System.Net.WebSockets.WebSocket CreateFromStream(System.IO.Stream stream, bool isServer, string? subProtocol, System.TimeSpan keepAliveInterval) { throw null; }
// The .NET Foundation licenses this file to you under the MIT license.
using System.IO;
+using System.Runtime.Versioning;
using System.Threading;
namespace System.Net.WebSockets
{
+ [UnsupportedOSPlatform("browser")]
public static class WebSocketProtocol
{
public static WebSocket CreateFromStream(
public abstract System.Threading.Tasks.Task CloseAsync(System.Net.WebSockets.WebSocketCloseStatus closeStatus, string? statusDescription, System.Threading.CancellationToken cancellationToken);
public abstract System.Threading.Tasks.Task CloseOutputAsync(System.Net.WebSockets.WebSocketCloseStatus closeStatus, string? statusDescription, System.Threading.CancellationToken cancellationToken);
public static System.ArraySegment<byte> CreateClientBuffer(int receiveBufferSize, int sendBufferSize) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public static System.Net.WebSockets.WebSocket CreateClientWebSocket(System.IO.Stream innerStream, string? subProtocol, int receiveBufferSize, int sendBufferSize, System.TimeSpan keepAliveInterval, bool useZeroMaskingKey, System.ArraySegment<byte> internalBuffer) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static System.Net.WebSockets.WebSocket CreateFromStream(System.IO.Stream stream, bool isServer, string? subProtocol, System.TimeSpan keepAliveInterval) { throw null; }
public static System.ArraySegment<byte> CreateServerBuffer(int receiveBufferSize) { throw null; }
public abstract void Dispose();
using System.ComponentModel;
using System.IO;
using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
/// <param name="subProtocol">The agreed upon sub-protocol that was used when creating the connection.</param>
/// <param name="keepAliveInterval">The keep-alive interval to use, or <see cref="Timeout.InfiniteTimeSpan"/> to disable keep-alives.</param>
/// <returns>The created <see cref="WebSocket"/>.</returns>
+ [UnsupportedOSPlatform("browser")]
public static WebSocket CreateFromStream(Stream stream, bool isServer, string? subProtocol, TimeSpan keepAliveInterval)
{
if (stream == null)
throw new PlatformNotSupportedException();
}
+ [UnsupportedOSPlatform("browser")]
[EditorBrowsable(EditorBrowsableState.Never)]
public static WebSocket CreateClientWebSocket(Stream innerStream,
string? subProtocol, int receiveBufferSize, int sendBufferSize,
using System.Diagnostics;
#endif
using System.Collections.Generic;
+using System.Runtime.Versioning;
using System.Threading;
#if ES_BUILD_STANDALONE
namespace System.Diagnostics.Tracing
#endif
{
+ [UnsupportedOSPlatform("browser")]
internal class CounterGroup
{
private readonly EventSource _eventSource;
using System.Diagnostics;
#endif
using System.Collections.Generic;
+using System.Runtime.Versioning;
using System.Text;
using System.Threading;
/// DiagnosticCounter is an abstract class that serves as the parent class for various Counter* classes,
/// namely EventCounter, PollingCounter, IncrementingEventCounter, and IncrementingPollingCounter.
/// </summary>
+ [UnsupportedOSPlatform("browser")]
public abstract class DiagnosticCounter : IDisposable
{
/// <summary>
using System.Diagnostics;
#endif
using System.Diagnostics.CodeAnalysis;
+using System.Runtime.Versioning;
using System.Threading;
#if ES_BUILD_STANDALONE
/// See https://github.com/dotnet/runtime/blob/master/src/libraries/System.Diagnostics.Tracing/tests/BasicEventSourceTest/TestEventCounter.cs
/// which shows tests, which are also useful in seeing actual use.
/// </summary>
+ [UnsupportedOSPlatform("browser")]
public partial class EventCounter : DiagnosticCounter
{
/// <summary>
#if ES_BUILD_STANDALONE
namespace Microsoft.Diagnostics.Tracing
#else
+using System.Runtime.Versioning;
+
namespace System.Diagnostics.Tracing
#endif
{
/// It does not calculate statistics like mean, standard deviation, etc. because it only accumulates
/// the counter value.
/// </summary>
+#if NETCOREAPP
+ [UnsupportedOSPlatform("browser")]
+#endif
public partial class IncrementingEventCounter : DiagnosticCounter
{
/// <summary>
#if ES_BUILD_STANDALONE
namespace Microsoft.Diagnostics.Tracing
#else
+using System.Runtime.Versioning;
+
namespace System.Diagnostics.Tracing
#endif
{
/// Unlike IncrementingEventCounter, this takes in a polling callback that it can call to update
/// its own metric periodically.
/// </summary>
+#if NETCOREAPP
+ [UnsupportedOSPlatform("browser")]
+#endif
public partial class IncrementingPollingCounter : DiagnosticCounter
{
/// <summary>
#if ES_BUILD_STANDALONE
namespace Microsoft.Diagnostics.Tracing
#else
+using System.Runtime.Versioning;
+
namespace System.Diagnostics.Tracing
#endif
{
/// function to collect metrics on its own rather than the user having to call WriteMetric()
/// every time.
/// </summary>
+#if NETCOREAPP
+ [UnsupportedOSPlatform("browser")]
+#endif
public partial class PollingCounter : DiagnosticCounter
{
/// <summary>
using Microsoft.Win32.SafeHandles;
using System.Diagnostics;
using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
using System.Threading;
using System.Threading.Tasks;
private void FlushWriteBufferForWriteByte()
{
+#pragma warning disable CA1416 // Validate platform compatibility, issue: https://github.com/dotnet/runtime/issues/44542
_asyncState?.Wait();
+#pragma warning restore CA1416
try { FlushWriteBuffer(); }
finally { _asyncState?.Release(); }
}
/// <summary>Reads from the file handle into the buffer, overwriting anything in it.</summary>
private int FillReadBufferForReadByte()
{
+#pragma warning disable CA1416 // Validate platform compatibility, issue: https://github.com/dotnet/runtime/issues/44542
_asyncState?.Wait();
+#pragma warning restore CA1416
try { return ReadNative(_buffer); }
finally { _asyncState?.Release(); }
}
}
else
{
+#pragma warning disable CA1416 // Validate platform compatibility, issue: https://github.com/dotnet/runtime/issues/44543
semaphore.Wait();
+#pragma warning restore CA1416
}
// Create the task to asynchronously do a Read. This task serves both
}
else
{
+#pragma warning disable CA1416 // Validate platform compatibility, issue: https://github.com/dotnet/runtime/issues/44543
semaphore.Wait(); // synchronously wait here
+#pragma warning restore CA1416
}
// Create the task to asynchronously do a Write. This task serves both
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
+using System.Runtime.Versioning;
namespace System.Threading
{
/// The caller of this method blocks indefinitely until the current instance is set. The caller will
/// return immediately if the event is currently in a set state.
/// </remarks>
+ [UnsupportedOSPlatform("browser")]
public void Wait()
{
Wait(Timeout.Infinite, CancellationToken.None);
/// The caller of this method blocks indefinitely until the current instance is set. The caller will
/// return immediately if the event is currently in a set state.
/// </remarks>
+ [UnsupportedOSPlatform("browser")]
public void Wait(CancellationToken cancellationToken)
{
Wait(Timeout.Infinite, cancellationToken);
/// <exception cref="System.InvalidOperationException">
/// The maximum number of waiters has been exceeded.
/// </exception>
+ [UnsupportedOSPlatform("browser")]
public bool Wait(TimeSpan timeout)
{
long totalMilliseconds = (long)timeout.TotalMilliseconds;
/// <exception cref="System.InvalidOperationException">
/// The maximum number of waiters has been exceeded.
/// </exception>
+ [UnsupportedOSPlatform("browser")]
public bool Wait(TimeSpan timeout, CancellationToken cancellationToken)
{
long totalMilliseconds = (long)timeout.TotalMilliseconds;
/// <exception cref="System.InvalidOperationException">
/// The maximum number of waiters has been exceeded.
/// </exception>
+ [UnsupportedOSPlatform("browser")]
public bool Wait(int millisecondsTimeout)
{
return Wait(millisecondsTimeout, CancellationToken.None);
/// </exception>
/// <exception cref="System.OperationCanceledException"><paramref
/// name="cancellationToken"/> was canceled.</exception>
+ [UnsupportedOSPlatform("browser")]
public bool Wait(int millisecondsTimeout, CancellationToken cancellationToken)
{
ThrowIfDisposed();
using System.Diagnostics;
using System.Runtime.CompilerServices;
+using System.Runtime.Versioning;
using System.Threading.Tasks;
namespace System.Threading
/// </summary>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
+ [UnsupportedOSPlatform("browser")]
public void Wait()
{
// Call wait with infinite timeout
/// canceled.</exception>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
+ [UnsupportedOSPlatform("browser")]
public void Wait(CancellationToken cancellationToken)
{
// Call wait with infinite timeout
/// <exception cref="System.ArgumentOutOfRangeException"><paramref name="timeout"/> is a negative
/// number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater
/// than <see cref="int.MaxValue"/>.</exception>
+ [UnsupportedOSPlatform("browser")]
public bool Wait(TimeSpan timeout)
{
// Validate the timeout
/// number other than -1 milliseconds, which represents an infinite time-out -or- timeout is greater
/// than <see cref="int.MaxValue"/>.</exception>
/// <exception cref="System.OperationCanceledException"><paramref name="cancellationToken"/> was canceled.</exception>
+ [UnsupportedOSPlatform("browser")]
public bool Wait(TimeSpan timeout, CancellationToken cancellationToken)
{
// Validate the timeout
/// otherwise, false.</returns>
/// <exception cref="ArgumentOutOfRangeException"><paramref name="millisecondsTimeout"/> is a
/// negative number other than -1, which represents an infinite time-out.</exception>
+ [UnsupportedOSPlatform("browser")]
public bool Wait(int millisecondsTimeout)
{
return Wait(millisecondsTimeout, CancellationToken.None);
/// <exception cref="ArgumentOutOfRangeException"><paramref name="millisecondsTimeout"/> is a negative number other than -1,
/// which represents an infinite time-out.</exception>
/// <exception cref="System.OperationCanceledException"><paramref name="cancellationToken"/> was canceled.</exception>
+ [UnsupportedOSPlatform("browser")]
public bool Wait(int millisecondsTimeout, CancellationToken cancellationToken)
{
CheckDispose();
/// <param name="startTime">The start ticks to calculate the elapsed time</param>
/// <param name="cancellationToken">The CancellationToken to observe.</param>
/// <returns>true if the monitor received a signal, false if the timeout expired</returns>
+ [UnsupportedOSPlatform("browser")]
private bool WaitUntilCountOrTimeout(int millisecondsTimeout, uint startTime, CancellationToken cancellationToken)
{
int remainingWaitMilliseconds = Timeout.Infinite;
}
else
{
+#pragma warning disable CA1416 // Validate platform compatibility, issue: https://github.com/dotnet/runtime/issues/44544
ThreadPool.RegisterWaitForSingleObject(
asyncResult.AsyncWaitHandle,
delegate
null,
Timeout.Infinite,
true);
+#pragma warning restore CA1416
}
return promise;
using System.Diagnostics.Tracing;
using System.Runtime.CompilerServices;
using System.Runtime.ExceptionServices;
+using System.Runtime.Versioning;
using Internal.Runtime.CompilerServices;
namespace System.Threading.Tasks
try
{
AddCompletionAction(mres, addBeforeOthers: true);
+#pragma warning disable CA1416 // Validate platform compatibility, issue: https://github.com/dotnet/runtime/issues/44622
if (infiniteWait)
{
returnValue = mres.Wait(Timeout.Infinite, cancellationToken);
returnValue = mres.Wait((int)(millisecondsTimeout - elapsedTimeTicks), cancellationToken);
}
}
+#pragma warning restore CA1416
}
finally
{
/// At least one of the <see cref="Task"/> instances was canceled -or- an exception was thrown during
/// the execution of at least one of the <see cref="Task"/> instances.
/// </exception>
+ [UnsupportedOSPlatform("browser")]
[MethodImpl(MethodImplOptions.NoOptimization)] // this is needed for the parallel debugger
public static void WaitAll(params Task[] tasks)
{
/// infinite time-out -or- timeout is greater than
/// <see cref="int.MaxValue"/>.
/// </exception>
+ [UnsupportedOSPlatform("browser")]
[MethodImpl(MethodImplOptions.NoOptimization)] // this is needed for the parallel debugger
public static bool WaitAll(Task[] tasks, TimeSpan timeout)
{
/// <paramref name="millisecondsTimeout"/> is a negative number other than -1, which represents an
/// infinite time-out.
/// </exception>
+ [UnsupportedOSPlatform("browser")]
[MethodImpl(MethodImplOptions.NoOptimization)] // this is needed for the parallel debugger
public static bool WaitAll(Task[] tasks, int millisecondsTimeout)
{
/// <exception cref="System.OperationCanceledException">
/// The <paramref name="cancellationToken"/> was canceled.
/// </exception>
+ [UnsupportedOSPlatform("browser")]
[MethodImpl(MethodImplOptions.NoOptimization)] // this is needed for the parallel debugger
public static void WaitAll(Task[] tasks, CancellationToken cancellationToken)
{
/// <exception cref="System.OperationCanceledException">
/// The <paramref name="cancellationToken"/> was canceled.
/// </exception>
+ [UnsupportedOSPlatform("browser")]
[MethodImpl(MethodImplOptions.NoOptimization)] // this is needed for the parallel debugger
public static bool WaitAll(Task[] tasks, int millisecondsTimeout, CancellationToken cancellationToken) =>
WaitAllCore(tasks, millisecondsTimeout, cancellationToken);
// Separated out to allow it to be optimized (caller is marked NoOptimization for VS parallel debugger
// to be able to see the method on the stack and inspect arguments).
+ [UnsupportedOSPlatform("browser")]
private static bool WaitAllCore(Task[] tasks, int millisecondsTimeout, CancellationToken cancellationToken)
{
if (tasks == null)
/// <param name="millisecondsTimeout">The timeout.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>true if all of the tasks completed; otherwise, false.</returns>
+ [UnsupportedOSPlatform("browser")]
private static bool WaitAllBlockingCore(List<Task> tasks, int millisecondsTimeout, CancellationToken cancellationToken)
{
Debug.Assert(tasks != null, "Expected a non-null list of tasks");
// Run LongRunning tasks on their own dedicated thread.
Thread thread = new Thread(s_longRunningThreadWork);
thread.IsBackground = true; // Keep this thread from blocking process shutdown
+#if !TARGET_BROWSER
thread.Start(task);
+#endif
}
else
{
var handler = new HttpClientHandler();
using (var client = new HttpClient(handler))
{
+#pragma warning disable CA1416 // Validate platform compatibility, 'credentials' and 'proxy' will not be set for browser, so safe to suppress
if (credentials != null)
{
handler.Credentials = credentials;
{
handler.Proxy = proxy;
}
+#pragma warning restore CA1416
using (Stream respStream = await client.GetStreamAsync(uri).ConfigureAwait(false))
{
public XmlUrlResolver() { }
+ [UnsupportedOSPlatform("browser")]
public override ICredentials? Credentials
{
set { _credentials = value; }
}
+ [UnsupportedOSPlatform("browser")]
public IWebProxy? Proxy
{
set { _proxy = value; }
public bool Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
public void Wait(System.Threading.CancellationToken cancellationToken) { }
public bool Wait(System.TimeSpan timeout) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static void WaitAll(params System.Threading.Tasks.Task[] tasks) { }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static bool WaitAll(System.Threading.Tasks.Task[] tasks, int millisecondsTimeout) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static bool WaitAll(System.Threading.Tasks.Task[] tasks, int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static void WaitAll(System.Threading.Tasks.Task[] tasks, System.Threading.CancellationToken cancellationToken) { }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public static bool WaitAll(System.Threading.Tasks.Task[] tasks, System.TimeSpan timeout) { throw null; }
public static int WaitAny(params System.Threading.Tasks.Task[] tasks) { throw null; }
public static int WaitAny(System.Threading.Tasks.Task[] tasks, int millisecondsTimeout) { throw null; }
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<StrongNameKeyId>Open</StrongNameKeyId>
+ <IncludePlatformAttributes>true</IncludePlatformAttributes>
</PropertyGroup>
</Project>
\ No newline at end of file
public XamlLoadPermission(System.Collections.Generic.IEnumerable<System.Xaml.Permissions.XamlAccessLevel> allowedAccess) { }
public XamlLoadPermission(System.Security.Permissions.PermissionState state) { }
public XamlLoadPermission(System.Xaml.Permissions.XamlAccessLevel allowedAccess) { }
+ [System.Runtime.Versioning.SupportedOSPlatform("windows")]
public System.Collections.Generic.IList<System.Xaml.Permissions.XamlAccessLevel> AllowedAccess { get { throw null; } }
public override System.Security.IPermission Copy() { throw null; }
public override bool Equals(object obj) { throw null; }
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.InteropServices;
+using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
public override bool Equals(object obj) { return ReferenceEquals(this, obj); }
[ComVisible(false)]
public override int GetHashCode() { return base.GetHashCode(); }
+ [SupportedOSPlatform("windows")]
public IList<XamlAccessLevel> AllowedAccess { get; private set; } = new ReadOnlyCollection<XamlAccessLevel>(Array.Empty<XamlAccessLevel>());
public override IPermission Copy() { return new XamlLoadPermission(PermissionState.Unrestricted); }
public override void FromXml(SecurityElement elem) { }
// threw an exception. We let such exceptions go completely unhandled.
try
{
+#pragma warning disable CA1416 // Validate platform compatibility, issue: https://github.com/dotnet/runtime/issues/44605
Task.WaitAll(tasks);
+#pragma warning restore CA1416
}
catch (AggregateException aggExp)
{
public long CurrentPhaseNumber { get { throw null; } }
public int ParticipantCount { get { throw null; } }
public int ParticipantsRemaining { get { throw null; } }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public long AddParticipant() { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public long AddParticipants(int participantCount) { throw null; }
public void Dispose() { }
protected virtual void Dispose(bool disposing) { }
public void RemoveParticipant() { }
public void RemoveParticipants(int participantCount) { }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public void SignalAndWait() { }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool SignalAndWait(int millisecondsTimeout) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool SignalAndWait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public void SignalAndWait(System.Threading.CancellationToken cancellationToken) { }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool SignalAndWait(System.TimeSpan timeout) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool SignalAndWait(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; }
}
public partial class BarrierPostPhaseException : System.Exception
public bool Signal(int signalCount) { throw null; }
public bool TryAddCount() { throw null; }
public bool TryAddCount(int signalCount) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public void Wait() { }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool Wait(int millisecondsTimeout) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public void Wait(System.Threading.CancellationToken cancellationToken) { }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool Wait(System.TimeSpan timeout) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool Wait(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; }
}
public enum EventResetMode
protected virtual void Dispose(bool disposing) { }
public void Reset() { }
public void Set() { }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public void Wait() { }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool Wait(int millisecondsTimeout) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public void Wait(System.Threading.CancellationToken cancellationToken) { }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool Wait(System.TimeSpan timeout) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool Wait(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; }
}
public static partial class Monitor
public bool IsReaderLockHeld { get { throw null; } }
public bool IsWriterLockHeld { get { throw null; } }
public int WriterSeqNum { get { throw null; } }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public void AcquireReaderLock(int millisecondsTimeout) { }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public void AcquireReaderLock(System.TimeSpan timeout) { }
public void AcquireWriterLock(int millisecondsTimeout) { }
public void AcquireWriterLock(System.TimeSpan timeout) { }
public System.Threading.LockCookie ReleaseLock() { throw null; }
public void ReleaseReaderLock() { }
public void ReleaseWriterLock() { }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public void RestoreLock(ref System.Threading.LockCookie lockCookie) { }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public System.Threading.LockCookie UpgradeToWriterLock(int millisecondsTimeout) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public System.Threading.LockCookie UpgradeToWriterLock(System.TimeSpan timeout) { throw null; }
}
public partial class ReaderWriterLockSlim : System.IDisposable
protected virtual void Dispose(bool disposing) { }
public int Release() { throw null; }
public int Release(int releaseCount) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public void Wait() { }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool Wait(int millisecondsTimeout) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool Wait(int millisecondsTimeout, System.Threading.CancellationToken cancellationToken) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public void Wait(System.Threading.CancellationToken cancellationToken) { }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool Wait(System.TimeSpan timeout) { throw null; }
+ [System.Runtime.Versioning.UnsupportedOSPlatformAttribute("browser")]
public bool Wait(System.TimeSpan timeout, System.Threading.CancellationToken cancellationToken) { throw null; }
public System.Threading.Tasks.Task WaitAsync() { throw null; }
public System.Threading.Tasks.Task<bool> WaitAsync(int millisecondsTimeout) { throw null; }
using System.Diagnostics;
using System.Runtime.Serialization;
+using System.Runtime.Versioning;
using System.Security;
namespace System.Threading
/// </exception>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
+ [UnsupportedOSPlatform("browser")]
public long AddParticipant()
{
try
/// </exception>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
+ [UnsupportedOSPlatform("browser")]
public long AddParticipants(int participantCount)
{
// check dispose
/// </exception>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
+ [UnsupportedOSPlatform("browser")]
public void SignalAndWait()
{
SignalAndWait(CancellationToken.None);
/// canceled.</exception>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
+ [UnsupportedOSPlatform("browser")]
public void SignalAndWait(CancellationToken cancellationToken)
{
#if DEBUG
/// </exception>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
+ [UnsupportedOSPlatform("browser")]
public bool SignalAndWait(TimeSpan timeout)
{
return SignalAndWait(timeout, CancellationToken.None);
/// canceled.</exception>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
+ [UnsupportedOSPlatform("browser")]
public bool SignalAndWait(TimeSpan timeout, CancellationToken cancellationToken)
{
long totalMilliseconds = (long)timeout.TotalMilliseconds;
/// </exception>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
+ [UnsupportedOSPlatform("browser")]
public bool SignalAndWait(int millisecondsTimeout)
{
return SignalAndWait(millisecondsTimeout, CancellationToken.None);
/// canceled.</exception>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
+ [UnsupportedOSPlatform("browser")]
public bool SignalAndWait(int millisecondsTimeout, CancellationToken cancellationToken)
{
ThrowIfDisposed();
/// <param name="token">cancellation token passed to SignalAndWait</param>
/// <param name="observedPhase">The current phase number for this thread</param>
/// <returns>True if the event is set or the phase number changed, false if the timeout expired</returns>
+ [UnsupportedOSPlatform("browser")]
private bool DiscontinuousWait(ManualResetEventSlim currentPhaseEvent, int totalTimeout, CancellationToken token, long observedPhase)
{
int maxWait = 100; // 100 ms
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
using System.Diagnostics;
+using System.Runtime.Versioning;
namespace System.Threading
{
/// </remarks>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
+ [UnsupportedOSPlatform("browser")]
public void Wait()
{
Wait(Timeout.Infinite, CancellationToken.None);
/// canceled.</exception>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
+ [UnsupportedOSPlatform("browser")]
public void Wait(CancellationToken cancellationToken)
{
Wait(Timeout.Infinite, cancellationToken);
/// than <see cref="int.MaxValue"/>.</exception>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
+ [UnsupportedOSPlatform("browser")]
public bool Wait(TimeSpan timeout)
{
long totalMilliseconds = (long)timeout.TotalMilliseconds;
/// disposed.</exception>
/// <exception cref="System.OperationCanceledException"><paramref name="cancellationToken"/> has
/// been canceled.</exception>
+ [UnsupportedOSPlatform("browser")]
public bool Wait(TimeSpan timeout, CancellationToken cancellationToken)
{
long totalMilliseconds = (long)timeout.TotalMilliseconds;
/// negative number other than -1, which represents an infinite time-out.</exception>
/// <exception cref="System.ObjectDisposedException">The current instance has already been
/// disposed.</exception>
+ [UnsupportedOSPlatform("browser")]
public bool Wait(int millisecondsTimeout)
{
return Wait(millisecondsTimeout, CancellationToken.None);
/// disposed.</exception>
/// <exception cref="System.OperationCanceledException"><paramref name="cancellationToken"/> has
/// been canceled.</exception>
+ [UnsupportedOSPlatform("browser")]
public bool Wait(int millisecondsTimeout, CancellationToken cancellationToken)
{
if (millisecondsTimeout < -1)
using System.Diagnostics;
using System.Runtime.ConstrainedExecution;
using System.Runtime.Serialization;
+using System.Runtime.Versioning;
namespace System.Threading
{
return (uint)_writerSeqNum > (uint)seqNum;
}
+ [UnsupportedOSPlatform("browser")]
public void AcquireReaderLock(int millisecondsTimeout)
{
if (millisecondsTimeout < -1)
++threadLocalLockEntry._readerLevel;
}
+ [UnsupportedOSPlatform("browser")]
public void AcquireReaderLock(TimeSpan timeout) => AcquireReaderLock(ToTimeoutMilliseconds(timeout));
public void AcquireWriterLock(int millisecondsTimeout)
}
}
+ [UnsupportedOSPlatform("browser")]
public LockCookie UpgradeToWriterLock(int millisecondsTimeout)
{
if (millisecondsTimeout < -1)
}
}
+ [UnsupportedOSPlatform("browser")]
public LockCookie UpgradeToWriterLock(TimeSpan timeout) => UpgradeToWriterLock(ToTimeoutMilliseconds(timeout));
public void DowngradeFromWriterLock(ref LockCookie lockCookie)
return lockCookie;
}
+ [UnsupportedOSPlatform("browser")]
public void RestoreLock(ref LockCookie lockCookie)
{
// Validate cookie
/// <summary>
/// Helper function that restores the lock to the original state indicated by parameters
/// </summary>
+ [UnsupportedOSPlatform("browser")]
private void RecoverLock(ref LockCookie lockCookie, LockCookieFlags flags)
{
// Contrary to the legacy code, this method does not use a finite timeout for recovering the previous lock state, as
namespace System.Transactions
{
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public sealed partial class CommittableTransaction : System.Transactions.Transaction, System.IAsyncResult
{
public CommittableTransaction() { }
public TransactionPromotionException(string? message) { }
public TransactionPromotionException(string? message, System.Exception? innerException) { }
}
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public sealed partial class TransactionScope : System.IDisposable
{
public TransactionScope() { }
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
+using System.Runtime.Versioning;
using System.Threading;
namespace System.Transactions
{
+ [UnsupportedOSPlatform("browser")]
public sealed class CommittableTransaction : Transaction, IAsyncResult
{
// Create a transaction with defaults
{
if (currentScope != null)
{
+#pragma warning disable CA1416 // Validate platform compatibility, the property is not platform-specific, safe to suppress
return currentScope.InteropMode;
+#pragma warning restore CA1416
}
return EnterpriseServicesInteropOption.None;
if (currentScope != null)
{
+#pragma warning disable CA1416 // Validate platform compatibility, the property is not platform-specific, safe to suppress
if (currentScope.ScopeComplete)
+#pragma warning restore CA1416
{
throw new InvalidOperationException(SR.TransactionScopeComplete);
}
// The .NET Foundation licenses this file to you under the MIT license.
using System.Diagnostics;
+using System.Runtime.Versioning;
using System.Threading;
namespace System.Transactions
Full = 2
}
+ [UnsupportedOSPlatform("browser")]
public sealed class TransactionScope : IDisposable
{
public TransactionScope() : this(TransactionScopeOption.Required)
{
public XmlUrlResolver() { }
public System.Net.Cache.RequestCachePolicy CachePolicy { set { } }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public override System.Net.ICredentials? Credentials { set { } }
+ [System.Runtime.Versioning.UnsupportedOSPlatform("browser")]
public System.Net.IWebProxy? Proxy { set { } }
public override object? GetEntity(System.Uri absoluteUri, string? role, System.Type? ofObjectToReturn) { throw null; }
public override System.Threading.Tasks.Task<object> GetEntityAsync(System.Uri absoluteUri, string? role, System.Type? ofObjectToReturn) { throw null; }
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
<!-- Generate Mono corelib version file -->
<Import Project="GenerateMonoCoreLibVersionFile.targets" />
<Compile Include="$(BclSourcesRoot)\System\TypeSpec.cs" />
</ItemGroup>
+ <!-- Enable unsupported browser warnings -->
+ <ItemGroup Condition="'$(TargetsBrowser)' == 'true' or '$(TargetsAnyOS)' == 'true'">
+ <SupportedPlatform Include="browser"/>
+ </ItemGroup>
+
<Import Project="$(LibrariesProjectRoot)\System.Private.CoreLib\src\System.Private.CoreLib.Shared.projitems" Label="Shared" />
<Target Name="CopyCoreLibToBinDir" AfterTargets="Build">