Skip to content

[release/6.0-preview5] Remove System.Security.Cryptography.Cng from ASP.NET transport package #54456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.NETCore.Runtime.ICU.Transport" Version="6.0.0-preview.5.21267.1">
<Dependency Name="Microsoft.NETCore.Runtime.ICU.Transport" Version="6.0.0-preview.5.21268.2">
<Uri>https://github.com/dotnet/icu</Uri>
<Sha>39013b42331e508a2fd4752a3336285ba35cb82f</Sha>
</Dependency>
Expand Down Expand Up @@ -174,9 +174,9 @@
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>f64f12aa83d9f2253eab10551b716d2ba09371d2</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="6.0.100-preview.5.21267.3">
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="6.0.100-preview.5.21278.1">
<Uri>https://github.com/mono/linker</Uri>
<Sha>a621b9a630950026f5508c8089a59c0e825bd6e0</Sha>
<Sha>dd761f75c38eca0bae79597436320510ffc80702</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XHarness.TestRunners.Xunit" Version="1.0.0-prerelease.21268.1">
<Uri>https://github.com/dotnet/xharness</Uri>
Expand Down Expand Up @@ -206,9 +206,9 @@
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-optimization</Uri>
<Sha>d14db66c7ab1c74a36af752a0eab96ad0c34e978</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Runtime.Emscripten.2.0.12.Node.win-x64" Version="6.0.0-preview.5.21267.1">
<Dependency Name="Microsoft.NET.Runtime.Emscripten.2.0.12.Node.win-x64" Version="6.0.0-preview.5.21281.1">
<Uri>https://github.com/dotnet/emsdk</Uri>
<Sha>64eb11deae8391570a7b74f672e8f2ccdee0e7bd</Sha>
<Sha>09a65a984075859db72f5fbad61c7f3a08bfa54b</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.HotReload.Utils.Generator.BuildTool" Version="1.0.1-alpha.0.21267.1">
<Uri>https://github.com/dotnet/hotreload-utils</Uri>
Expand Down
6 changes: 3 additions & 3 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
<UsingToolMicrosoftNetILLinkTasks>true</UsingToolMicrosoftNetILLinkTasks>
<UsingToolIbcOptimization>false</UsingToolIbcOptimization>
<UsingToolXliff>false</UsingToolXliff>
<MicrosoftNETRuntimeEmscripten2012Nodewinx64Version>6.0.0-preview.5.21267.1</MicrosoftNETRuntimeEmscripten2012Nodewinx64Version>
<MicrosoftNETRuntimeEmscripten2012Nodewinx64Version>6.0.0-preview.5.21281.1</MicrosoftNETRuntimeEmscripten2012Nodewinx64Version>
<MicrosoftNETRuntimeEmscriptenVersion>$(MicrosoftNETRuntimeEmscripten2012Nodewinx64Version)</MicrosoftNETRuntimeEmscriptenVersion>
</PropertyGroup>
<!--
Expand Down Expand Up @@ -161,9 +161,9 @@
<!-- Docs -->
<MicrosoftPrivateIntellisenseVersion>5.0.0-preview-20201009.2</MicrosoftPrivateIntellisenseVersion>
<!-- ILLink -->
<MicrosoftNETILLinkTasksVersion>6.0.100-preview.5.21267.3</MicrosoftNETILLinkTasksVersion>
<MicrosoftNETILLinkTasksVersion>6.0.100-preview.5.21278.1</MicrosoftNETILLinkTasksVersion>
<!-- ICU -->
<MicrosoftNETCoreRuntimeICUTransportVersion>6.0.0-preview.5.21267.1</MicrosoftNETCoreRuntimeICUTransportVersion>
<MicrosoftNETCoreRuntimeICUTransportVersion>6.0.0-preview.5.21268.2</MicrosoftNETCoreRuntimeICUTransportVersion>
<!-- Mono LLVM -->
<runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>9.0.1-alpha.1.21267.1</runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMSdkVersion>
<runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>9.0.1-alpha.1.21267.1</runtimelinuxarm64MicrosoftNETCoreRuntimeMonoLLVMToolsVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ JNI_OnLoad(JavaVM *vm, void *reserved)
g_SSLEngine = GetClassGRef(env, "javax/net/ssl/SSLEngine");
g_SSLEngineBeginHandshake = GetMethod(env, false, g_SSLEngine, "beginHandshake", "()V");
g_SSLEngineCloseOutbound = GetMethod(env, false, g_SSLEngine, "closeOutbound", "()V");
g_SSLEngineGetApplicationProtocol = GetMethod(env, false, g_SSLEngine, "getApplicationProtocol", "()Ljava/lang/String;");
g_SSLEngineGetApplicationProtocol = GetOptionalMethod(env, false, g_SSLEngine, "getApplicationProtocol", "()Ljava/lang/String;");
g_SSLEngineGetHandshakeStatus = GetMethod(env, false, g_SSLEngine, "getHandshakeStatus", "()Ljavax/net/ssl/SSLEngineResult$HandshakeStatus;");
g_SSLEngineGetSession = GetMethod(env, false, g_SSLEngine, "getSession", "()Ljavax/net/ssl/SSLSession;");
g_SSLEngineGetSSLParameters = GetMethod(env, false, g_SSLEngine, "getSSLParameters", "()Ljavax/net/ssl/SSLParameters;");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,12 @@ void AndroidCryptoNative_SSLStreamRelease(SSLStream* sslStream)

int32_t AndroidCryptoNative_SSLStreamGetApplicationProtocol(SSLStream* sslStream, uint8_t* out, int32_t* outLen)
{
if (g_SSLEngineGetApplicationProtocol == NULL)
{
// SSLEngine.getApplicationProtocol() is only supported from API level 29 and above
return FAIL;
}

abort_if_invalid_pointer_argument (sslStream);
abort_if_invalid_pointer_argument (outLen);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1058,13 +1058,6 @@ internal static Activity Create(ActivitySource source, string name, ActivityKind
}
}

activity.IsAllDataRequested = request == ActivitySamplingResult.AllData || request == ActivitySamplingResult.AllDataAndRecorded;

if (request == ActivitySamplingResult.AllDataAndRecorded)
{
activity.ActivityTraceFlags |= ActivityTraceFlags.Recorded;
}

if (parentId != null)
{
activity._parentId = parentId;
Expand All @@ -1083,6 +1076,13 @@ internal static Activity Create(ActivitySource source, string name, ActivityKind
activity._traceState = parentContext.TraceState;
}

activity.IsAllDataRequested = request == ActivitySamplingResult.AllData || request == ActivitySamplingResult.AllDataAndRecorded;

if (request == ActivitySamplingResult.AllDataAndRecorded)
{
activity.ActivityTraceFlags |= ActivityTraceFlags.Recorded;
}

if (startTime != default)
{
activity.StartTimeUtc = startTime.UtcDateTime;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,35 +196,35 @@ internal static void NotifyForPublishedInstrument(Instrument instrument)
}

[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal void NotifyMeasurement<T>(Instrument instrument, T measurement, ReadOnlySpan<KeyValuePair<string, object?>> tags, object? state)
internal void NotifyMeasurement<T>(Instrument instrument, T measurement, ReadOnlySpan<KeyValuePair<string, object?>> tags, object? state) where T : struct
{
if (measurement is byte byteMeasurement)
if (typeof(T) == typeof(byte))
{
_byteMeasurementCallback(instrument, byteMeasurement, tags, state);
_byteMeasurementCallback(instrument, (byte)(object)measurement, tags, state);
}
else if (measurement is short shortMeasurement)
if (typeof(T) == typeof(short))
{
_shortMeasurementCallback(instrument, shortMeasurement, tags, state);
_shortMeasurementCallback(instrument, (short)(object)measurement, tags, state);
}
else if (measurement is int intMeasurement)
if (typeof(T) == typeof(int))
{
_intMeasurementCallback(instrument, intMeasurement, tags, state);
_intMeasurementCallback(instrument, (int)(object)measurement, tags, state);
}
else if (measurement is long longMeasurement)
if (typeof(T) == typeof(long))
{
_longMeasurementCallback(instrument, longMeasurement, tags, state);
_longMeasurementCallback(instrument, (long)(object)measurement, tags, state);
}
else if (measurement is float floatMeasurement)
if (typeof(T) == typeof(float))
{
_floatMeasurementCallback(instrument, floatMeasurement, tags, state);
_floatMeasurementCallback(instrument, (float)(object)measurement, tags, state);
}
else if (measurement is double doubleMeasurement)
if (typeof(T) == typeof(double))
{
_doubleMeasurementCallback(instrument, doubleMeasurement, tags, state);
_doubleMeasurementCallback(instrument, (double)(object)measurement, tags, state);
}
else if (measurement is decimal decimalMeasurement)
if (typeof(T) == typeof(decimal))
{
_decimalMeasurementCallback(instrument, decimalMeasurement, tags, state);
_decimalMeasurementCallback(instrument, (decimal)(object)measurement, tags, state);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,37 @@ public void TestListeningToConstructedActivityEvents()
}).Dispose();
}

[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void EnsureRecordingTest()
{
RemoteExecutor.Invoke(() => {
Activity.ForceDefaultIdFormat = true;
Activity.DefaultIdFormat = ActivityIdFormat.W3C;

ActivitySource aSource = new ActivitySource("EnsureRecordingTest");

ActivityListener listener = new ActivityListener
{
ShouldListenTo = (activitySource) => true,
Sample = (ref ActivityCreationOptions<ActivityContext> activityOptions) =>
{
// Access activityOptions.TraceId to ensure generating the non-default value.
ActivityTraceId traceId = activityOptions.TraceId;
Assert.NotEqual(default(ActivityTraceId), traceId);
return ActivitySamplingResult.AllDataAndRecorded;
}
};

ActivitySource.AddActivityListener(listener);

Activity a = aSource.StartActivity("RecordedActivity");
Assert.NotNull(a);

Assert.True(a.Recorded);
Assert.True((a.Context.TraceFlags & ActivityTraceFlags.Recorded) != 0);
}).Dispose();
}

[ConditionalFact(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
public void TestExpectedListenersReturnValues()
{
Expand Down Expand Up @@ -947,7 +978,7 @@ public void TestActivityCreate()
Assert.Null(a3.Parent);
Assert.Equal("ParentId", a3.ParentId);

ActivityContext parentContext = new ActivityContext(ActivityTraceId.CreateRandom(), ActivitySpanId.CreateRandom(), ActivityTraceFlags.None);
ActivityContext parentContext = new ActivityContext(ActivityTraceId.CreateRandom(), ActivitySpanId.CreateRandom(), ActivityTraceFlags.Recorded);
using (Activity a4 = aSource.CreateActivity("a4", ActivityKind.Internal, parentContext, tags, links))
{
Assert.NotNull(a4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ internal partial class JsonContext : JsonSerializerContext
private static JsonContext s_default;
public static JsonContext Default => s_default ??= new JsonContext(new JsonSerializerOptions());

public JsonContext() : base(null)
public JsonContext() : base(null, null)
{
}

public JsonContext(JsonSerializerOptions options) : base(options)
public JsonContext(JsonSerializerOptions options) : base(options, null)
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,14 @@ public JsonTypeInfo<Person> Person
}
else
{
JsonTypeInfo<Person> objectInfo = JsonMetadataServices.CreateObjectInfo<Person>();
_Person = objectInfo;

JsonMetadataServices.InitializeObjectInfo(
objectInfo,
JsonTypeInfo<Person> objectInfo = JsonMetadataServices.CreateObjectInfo<Person>(
Options,
createObjectFunc: static () => new Person(),
PersonPropInitFunc,
default);
default,
serializeFunc: null);

_Person = objectInfo;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<StrongNameKeyId>Microsoft</StrongNameKeyId>
<IsAspNetCoreApp>true</IsAspNetCoreApp>
<SupportedOSPlatforms>windows</SupportedOSPlatforms>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@ namespace System.Text.Json.Serialization
/// <summary>
/// The base class of serialization attributes.
/// </summary>
public abstract class JsonAttribute : Attribute { }
#if BUILDING_SOURCE_GENERATOR
internal
#else
public
#endif
abstract class JsonAttribute : Attribute { }
}
26 changes: 26 additions & 0 deletions src/libraries/System.Text.Json/Common/JsonKnownNamingPolicy.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace System.Text.Json.Serialization
{
/// <summary>
/// The <see cref="Json.JsonNamingPolicy"/> to be used at run-time.
/// </summary>
#if BUILDING_SOURCE_GENERATOR
internal
#else
public
#endif
enum JsonKnownNamingPolicy
{
/// <summary>
/// Specifies that JSON property names should not be converted.
/// </summary>
Unspecified = 0,

/// <summary>
/// Specifies that the built-in <see cref="Json.JsonNamingPolicy.CamelCase"/> be used to convert JSON property names.
/// </summary>
BuiltInCamelCase = 1
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@ namespace System.Text.Json
/// <summary>
/// Determines the naming policy used to convert a string-based name to another format, such as a camel-casing format.
/// </summary>
public abstract class JsonNamingPolicy
#if BUILDING_SOURCE_GENERATOR
internal
#else
public
#endif
abstract class JsonNamingPolicy
{
/// <summary>
/// Initializes a new instance of <see cref="JsonNamingPolicy"/>.
Expand All @@ -18,8 +23,6 @@ protected JsonNamingPolicy() { }
/// </summary>
public static JsonNamingPolicy CamelCase { get; } = new JsonCamelCaseNamingPolicy();

internal static JsonNamingPolicy Default { get; } = new JsonDefaultNamingPolicy();

/// <summary>
/// When overridden in a derived class, converts the specified name according to the policy.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace System.Text.Json.Serialization
{
/// <summary>
/// Instructs the System.Text.Json source generator to assume the specified
/// options will be used at run-time via <see cref="JsonSerializerOptions"/>.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)]
#if BUILDING_SOURCE_GENERATOR
internal
#else
public
#endif
class JsonSerializerOptionsAttribute : JsonAttribute
{
/// <summary>
/// Specifies the default ignore condition.
/// </summary>
public JsonIgnoreCondition DefaultIgnoreCondition { get; set; }

/// <summary>
/// Specifies whether to ignore read-only fields.
/// </summary>
public bool IgnoreReadOnlyFields { get; set; }

/// <summary>
/// Specifies whether to ignore read-only properties.
/// </summary>
public bool IgnoreReadOnlyProperties { get; set; }

/// <summary>
/// Specifies whether to ignore custom converters provided at run-time.
/// </summary>
public bool IgnoreRuntimeCustomConverters { get; set; }

/// <summary>
/// Specifies whether to include fields for serialization and deserialization.
/// </summary>
public bool IncludeFields { get; set; }

/// <summary>
/// Specifies a built-in naming polices to convert JSON property names with.
/// </summary>
public JsonKnownNamingPolicy NamingPolicy { get; set; }

/// <summary>
/// Specifies whether JSON output should be pretty-printed.
/// </summary>
public bool WriteIndented { get; set; }
}
}
Loading