Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
01d208d
[release/8.0] Don't use File.OpenWrite when trying to overwrite a fil…
akoeplinger Oct 25, 2023
4e7c8ab
Update library-servicing doc to mention 8.0 (#94002)
github-actions[bot] Oct 26, 2023
0f65b75
Try pinning the installer version to a 8.01xx sdk
lewing Oct 27, 2023
b261d02
[release/8.0][wasm] WBT Stop taking latest sdk in release/8.0 (#94097)
lewing Oct 27, 2023
b8263b8
Target net8.0 in SatelliteAssemblyFromProjectRef
lewing Oct 27, 2023
72b787f
[automated] Merge branch 'release/8.0' => 'release/8.0-staging' (#93874)
dotnet-maestro-bot Oct 28, 2023
78af864
Revert "[automated] Merge branch 'release/8.0' => 'release/8.0-stagin…
carlossanlop Oct 30, 2023
f78d53f
Merge pull request #94182 from lewing/merge/release/8.0-to-release/8.…
carlossanlop Oct 30, 2023
b62c8ff
[release/8.0-staging] Support IValidatableObject for nested model typ…
github-actions[bot] Oct 30, 2023
85d1fce
Update dependencies from https://github.com/dotnet/hotreload-utils bu…
dotnet-maestro[bot] Oct 30, 2023
f5f1aaf
Update dependencies from https://github.com/dotnet/icu build 20231023…
dotnet-maestro[bot] Oct 30, 2023
bc0b9fb
[release/8.0-staging] Update dependencies from dotnet/roslyn-analyzer…
dotnet-maestro[bot] Oct 30, 2023
4ae54f2
[release/8.0-staging] Use fully qualified names when referencing user…
eiriktsarpalis Nov 7, 2023
141b386
[release/8.0-staging] [mono] [imt] Don't increment vt_slot for non-vi…
github-actions[bot] Nov 8, 2023
ef625e4
[release/8.0-staging] Update dependencies from dotnet/hotreload-utils…
dotnet-maestro[bot] Nov 8, 2023
213f1a2
[release/8.0-staging] Fix literal formatting in source generators (#9…
github-actions[bot] Nov 8, 2023
87fbb38
[release/8.0-staging] Socket Tests Disable (#94243)
liveans Nov 9, 2023
34119e2
[release/8.0-staging] Update dependencies from dotnet/emsdk (#94197)
dotnet-maestro[bot] Nov 9, 2023
7ebc464
Update dependencies from https://github.com/dotnet/runtime-assets bui…
dotnet-maestro[bot] Nov 9, 2023
87d0f45
[release/8.0-staging] Remove [EditorBrowsable(Never)] from [InlineArr…
github-actions[bot] Nov 10, 2023
ba7bf78
Correctly set sendTrustList flag when saving credentials to cache (#9…
github-actions[bot] Nov 10, 2023
6b9220b
[release/8.0-staging] [Android] Fix SslStream on Android API 21-23 (#…
github-actions[bot] Nov 10, 2023
27685cf
[release/8.0-staging] Avoid generating code for unsupported types in …
tarekgh Nov 10, 2023
d0804a9
[release/8.0-staging] Update alpine arm32 in release 8.0 CI (#94609)
CarnaViire Nov 11, 2023
0087f0b
[release/8.0-staging] [mono] catch the case of updated methods in mon…
github-actions[bot] Nov 13, 2023
84427da
Update dependencies from https://github.com/dotnet/emsdk build 202311…
dotnet-maestro[bot] Nov 13, 2023
18c80f5
Update dependencies from https://github.com/dotnet/hotreload-utils bu…
dotnet-maestro[bot] Nov 13, 2023
4811680
Update dependencies from https://github.com/dotnet/source-build-refer…
dotnet-maestro[bot] Nov 13, 2023
dc944d5
[release/8.0-staging] [mono] Fix deadlock in static constructor initi…
github-actions[bot] Nov 14, 2023
4c6ce46
[release/8.0-staging] Handle null signature destinations for ECDsa / …
github-actions[bot] Nov 14, 2023
e585246
Disable optimization which sometimes results in incorrect case sensit…
eiriktsarpalis Nov 14, 2023
64bff1a
[release/8.0-staging] Update APICompat baseline version to 8.0.0 (#94…
ViktorHofer Nov 15, 2023
8f5de40
[release/8.0-staging] #ifdef out code that requires FEATURE_EVENT_TRA…
github-actions[bot] Nov 15, 2023
5acd05e
[release/8.0] Calculate PackageVersionNet7 (#94614)
steveisok Nov 15, 2023
467099f
[release/8.0-staging] [main] Fixed DateTimeOffset.Now calls on Androi…
github-actions[bot] Nov 15, 2023
a787c34
Pin to 8.0.100 (#94815)
lewing Nov 15, 2023
5c87f4d
Merge branch 'release/8.0' into release/8.0-staging
carlossanlop Nov 16, 2023
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
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@
<NetFrameworkCurrent Condition="'$(DotNetBuildFromSource)' == 'true'" />

<!-- Important: Set this to the GA version (or a close approximation) during servicing and adjust the TFM property below. -->
<ApiCompatNetCoreAppBaselineVersion>7.0.0</ApiCompatNetCoreAppBaselineVersion>
<ApiCompatNetCoreAppBaselineTFM>net7.0</ApiCompatNetCoreAppBaselineTFM>
<ApiCompatNetCoreAppBaselineVersion>8.0.0</ApiCompatNetCoreAppBaselineVersion>
<ApiCompatNetCoreAppBaselineTFM>net8.0</ApiCompatNetCoreAppBaselineTFM>

<TargetFrameworkForNETFrameworkTasks>$(NetFrameworkToolCurrent)</TargetFrameworkForNETFrameworkTasks>
<!-- Don't build for NETFramework during source-build. -->
Expand Down
6 changes: 4 additions & 2 deletions docs/project/library-servicing.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ This document provides the steps that need to be followed after modifying a libr

Servicing branches represent shipped versions of .NET, and their name is in the format `release/X.0-staging`. Examples:

- `release/8.0-staging`
- `release/7.0-staging`
- `release/6.0-staging`

Expand Down Expand Up @@ -32,11 +33,12 @@ All the servicing change must go through an approval process. You have two ways

- By manually creating your PR using [this template](https://raw.githubusercontent.com/dotnet/runtime/main/.github/PULL_REQUEST_TEMPLATE/servicing_pull_request_template.md).
- Or by asking the bot to automatically create the servicing PR for you using a merged `main` PR as source. This method requires typing an AzDO backport command as a comment of your merged PR using the format `/backport to release/X.0-staging`. Examples:
-

- `/backport to release/8.0-staging`
- `/backport to release/7.0-staging`
- `/backport to release/6.0-staging`

For both cases, you must:
For all cases, you must:

- Fill out the template of the PR description.
- Bring it to the attention of the [engineering lead responsible for the area](~/docs/area-owners.md).
Expand Down
16 changes: 10 additions & 6 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@
<Sha>0af50f733332e8c148f7f2debef2cb90504840d5</Sha>
<SourceBuild RepoName="emsdk" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="8.0.0-alpha.1.23516.4">
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="8.0.0-alpha.1.23556.3">
<Uri>https://github.com/dotnet/source-build-reference-packages</Uri>
<Sha>b4fa7f2e1e65ef49881be2ab2df27624280a8c55</Sha>
<Sha>fa4c0e8f53ef2541a23e519af4dfb86cb88e1bae</Sha>
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-externals" Version="8.0.0-alpha.1.23518.1">
Expand Down Expand Up @@ -354,9 +354,9 @@
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-optimization</Uri>
<Sha>c68e08c656a1e9b058fe22cc0546dbbd245c85fb</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.HotReload.Utils.Generator.BuildTool" Version="8.0.0-alpha.0.23523.2">
<Dependency Name="Microsoft.DotNet.HotReload.Utils.Generator.BuildTool" Version="8.0.0-alpha.0.23563.1">
<Uri>https://github.com/dotnet/hotreload-utils</Uri>
<Sha>8e108a21d0c7d8fa2050a1bdd4d4ba50d2b8df13</Sha>
<Sha>12d02e5c2310be6460f896bc3aeb0ddf1e8926bc</Sha>
</Dependency>
<Dependency Name="System.Runtime.Numerics.TestData" Version="8.0.0-beta.23558.5">
<Uri>https://github.com/dotnet/runtime-assets</Uri>
Expand All @@ -383,9 +383,13 @@
<Uri>https://github.com/dotnet/roslyn-analyzers</Uri>
<Sha>b4d9a1334d5189172977ba8fddd00bda70161e4a</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.ApiCompat.Task" Version="8.0.100-rtm.23520.8">
<Dependency Name="Microsoft.DotNet.ApiCompat.Task" Version="8.0.100">
<Uri>https://github.com/dotnet/sdk</Uri>
<Sha>7e33fd449381b337c290a801057fdcd68c4b7220</Sha>
<Sha>e9d13cbe7e8c1d52ce276a8655f52a87e1017c46</Sha>
</Dependency>
<Dependency Name="Microsoft.SourceBuild.Intermediate.sdk" Version="8.0.100-rtm.23551.6">
<Uri>https://github.com/dotnet/sdk</Uri>
<Sha>e9d13cbe7e8c1d52ce276a8655f52a87e1017c46</Sha>
<SourceBuild RepoName="sdk" ManagedOnly="true" />
</Dependency>
<Dependency Name="optimization.windows_nt-arm64.MIBC.Runtime" Version="1.0.0-prerelease.23561.3">
Expand Down
12 changes: 6 additions & 6 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<MinorVersion>0</MinorVersion>
<PatchVersion>1</PatchVersion>
<SdkBandVersion>8.0.100</SdkBandVersion>
<PackageVersionNet7>7.0.14</PackageVersionNet7>
<PackageVersionNet7>7.0.$([MSBuild]::Add($(PatchVersion),14))</PackageVersionNet7>
<PackageVersionNet6>6.0.$([MSBuild]::Add($([System.Version]::Parse('$(PackageVersionNet7)').Build),11))</PackageVersionNet6>
<PreReleaseVersionLabel>servicing</PreReleaseVersionLabel>
<PreReleaseVersionIteration>
Expand Down Expand Up @@ -85,7 +85,7 @@
<PropertyGroup>
<StaticCsVersion>0.2.0</StaticCsVersion>
<!-- SDK dependencies -->
<MicrosoftDotNetApiCompatTaskVersion>8.0.100-rtm.23520.8</MicrosoftDotNetApiCompatTaskVersion>
<MicrosoftDotNetApiCompatTaskVersion>8.0.100</MicrosoftDotNetApiCompatTaskVersion>
<!-- Arcade dependencies -->
<MicrosoftDotNetBuildTasksFeedVersion>8.0.0-beta.23556.5</MicrosoftDotNetBuildTasksFeedVersion>
<MicrosoftDotNetCodeAnalysisVersion>8.0.0-beta.23556.5</MicrosoftDotNetCodeAnalysisVersion>
Expand Down Expand Up @@ -127,7 +127,7 @@
<SystemCollectionsImmutableVersion>7.0.0</SystemCollectionsImmutableVersion>
<SystemComponentModelAnnotationsVersion>5.0.0</SystemComponentModelAnnotationsVersion>
<SystemDataSqlClientVersion>4.8.5</SystemDataSqlClientVersion>
<SystemDrawingCommonVersion>7.0.0</SystemDrawingCommonVersion>
<SystemDrawingCommonVersion>8.0.0</SystemDrawingCommonVersion>
<SystemIOFileSystemAccessControlVersion>5.0.0</SystemIOFileSystemAccessControlVersion>
<SystemMemoryVersion>4.5.5</SystemMemoryVersion>
<SystemReflectionMetadataVersion>7.0.0</SystemReflectionMetadataVersion>
Expand Down Expand Up @@ -186,7 +186,7 @@
<MicrosoftDotNetXHarnessTestRunnersCommonVersion>8.0.0-prerelease.23407.2</MicrosoftDotNetXHarnessTestRunnersCommonVersion>
<MicrosoftDotNetXHarnessTestRunnersXunitVersion>8.0.0-prerelease.23407.2</MicrosoftDotNetXHarnessTestRunnersXunitVersion>
<MicrosoftDotNetXHarnessCLIVersion>8.0.0-prerelease.23407.2</MicrosoftDotNetXHarnessCLIVersion>
<MicrosoftDotNetHotReloadUtilsGeneratorBuildToolVersion>8.0.0-alpha.0.23523.2</MicrosoftDotNetHotReloadUtilsGeneratorBuildToolVersion>
<MicrosoftDotNetHotReloadUtilsGeneratorBuildToolVersion>8.0.0-alpha.0.23563.1</MicrosoftDotNetHotReloadUtilsGeneratorBuildToolVersion>
<XUnitVersion>2.4.2</XUnitVersion>
<XUnitAnalyzersVersion>1.0.0</XUnitAnalyzersVersion>
<XUnitRunnerVisualStudioVersion>2.4.5</XUnitRunnerVisualStudioVersion>
Expand Down Expand Up @@ -258,7 +258,7 @@
<MicrosoftExtensionsLoggingVersion>3.1.7</MicrosoftExtensionsLoggingVersion>
<MicrosoftSymbolStoreVersion>1.0.406601</MicrosoftSymbolStoreVersion>
<!-- installer version, for testing workloads -->
<MicrosoftDotnetSdkInternalVersion>8.0.100-rtm.23506.1</MicrosoftDotnetSdkInternalVersion>
<!-- <SdkVersionForWorkloadTesting>$(MicrosoftDotnetSdkInternalVersion)</SdkVersionForWorkloadTesting> -->
<MicrosoftDotnetSdkInternalVersion>8.0.100</MicrosoftDotnetSdkInternalVersion>
<SdkVersionForWorkloadTesting>$(MicrosoftDotnetSdkInternalVersion)</SdkVersionForWorkloadTesting>
</PropertyGroup>
</Project>
8 changes: 8 additions & 0 deletions eng/packaging.targets
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
'$(SuppressFinalPackageVersion)' == 'true' or
'$(DotNetBuildFromSource)' == 'true'">true</DisablePackageBaselineValidation>
<PackageValidationBaselineVersion Condition="'$(PackageValidationBaselineVersion)' == ''">$(ApiCompatNetCoreAppBaselineVersion)</PackageValidationBaselineVersion>

<BeforePack>$(BeforePack);IncludeAnalyzersInPackage;AddNETStandardCompatErrorFileForPackaging</BeforePack>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);AddRuntimeSpecificFilesToPackage;IncludeProjectReferencesWithPackAttributeInPackage</TargetsForTfmSpecificContentInPackage>
<!-- Don't include target platform specific dependencies, since we use the target platform to represent RIDs instead -->
Expand All @@ -37,6 +38,13 @@
<BuildProjectReferences Condition="'$(NoBuild)' == 'true'">false</BuildProjectReferences>
</PropertyGroup>

<PropertyGroup Condition="'$(PreReleaseVersionLabel)' == 'servicing'">
<!-- In servicing, the live package is compared against the GA version in strict mode. -->
<EnableStrictModeForBaselineValidation>true</EnableStrictModeForBaselineValidation>
<!-- In servicing, disable the APICompat rule that validates that the assembly versions must match. -->
<NoWarn>$(NoWarn);CP0003</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="'$(PreReleaseVersionLabel)' == 'servicing' and
'$(PackageUseIncrementalServicingVersion)' == 'true'">
<!-- If no servicing version is set we need to default to 0 in order for dependency versions to
Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/coreclr/templates/helix-queues-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ jobs:
# Linux musl arm32
- ${{ if eq(parameters.platform, 'linux_musl_arm') }}:
- ${{ if eq(variables['System.TeamProject'], 'public') }}:
- (Alpine.315.Arm32.Open)[email protected]/dotnet-buildtools/prereqs:alpine-3.15-helix-arm32v7
- (Alpine.315.Arm32.Open)[email protected]/dotnet-buildtools/prereqs:alpine-3.15-helix-arm32v7-20230807201723-7ea784e
- ${{ if eq(variables['System.TeamProject'], 'internal') }}:
- (Alpine.315.Arm32)[email protected]/dotnet-buildtools/prereqs:alpine-3.15-helix-arm32v7
- (Alpine.315.Arm32)[email protected]/dotnet-buildtools/prereqs:alpine-3.15-helix-arm32v7-20230807201723-7ea784e

# Linux musl arm64
- ${{ if eq(parameters.platform, 'linux_musl_arm64') }}:
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/gc/gc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10069,7 +10069,6 @@ void gc_heap::update_ro_segment (heap_segment* seg, uint8_t* allocated, uint8_t*
{
enter_spin_lock (&gc_heap::gc_lock);

assert (use_frozen_segments_p);
assert (heap_segment_read_only_p (seg));
assert (allocated <= committed);
assert (committed <= heap_segment_reserved (seg));
Expand Down
2 changes: 2 additions & 0 deletions src/coreclr/nativeaot/Runtime/gcrhenv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -749,10 +749,12 @@ void GCToEEInterface::DiagGCEnd(size_t index, int gen, int reason, bool fConcurr
UNREFERENCED_PARAMETER(gen);
UNREFERENCED_PARAMETER(reason);

#ifdef FEATURE_EVENT_TRACE
if (!fConcurrent)
{
ETW::GCLog::WalkHeap();
}
#endif // FEATURE_EVENT_TRACE
}

// Note on last parameter: when calling this for bgc, only ETW
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

using System;
using System.Runtime.InteropServices;
using Internal.Cryptography;

using Microsoft.Win32.SafeHandles;

Expand Down Expand Up @@ -30,7 +31,7 @@ internal static unsafe NTSTATUS BCryptSignHashPkcs1(
{
fixed (char* pHashAlgorithmName = hashAlgorithmName)
fixed (byte* pHash = &MemoryMarshal.GetReference(hash))
fixed (byte* pDest = &MemoryMarshal.GetReference(destination))
fixed (byte* pDest = &Helpers.GetNonNullPinnableReference(destination))
{
BCRYPT_PKCS1_PADDING_INFO paddingInfo = default;
paddingInfo.pszAlgId = (IntPtr)pHashAlgorithmName;
Expand All @@ -56,7 +57,7 @@ internal static unsafe NTSTATUS BCryptSignHashPss(
{
fixed (char* pHashAlgorithmName = hashAlgorithmName)
fixed (byte* pHash = &MemoryMarshal.GetReference(hash))
fixed (byte* pDest = &MemoryMarshal.GetReference(destination))
fixed (byte* pDest = &Helpers.GetNonNullPinnableReference(destination))
{
BCRYPT_PSS_PADDING_INFO paddingInfo = default;
paddingInfo.pszAlgId = (IntPtr)pHashAlgorithmName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,24 @@

using System;
using System.Runtime.InteropServices;
using Internal.Cryptography;
using Microsoft.Win32.SafeHandles;

internal static partial class Interop
{
internal static partial class NCrypt
{
[LibraryImport(Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)]
internal static unsafe partial ErrorCode NCryptSignHash(SafeNCryptKeyHandle hKey, void* pPaddingInfo, ReadOnlySpan<byte> pbHashValue, int cbHashValue, Span<byte> pbSignature, int cbSignature, out int pcbResult, AsymmetricPaddingMode dwFlags);
private static unsafe partial ErrorCode NCryptSignHash(SafeNCryptKeyHandle hKey, void* pPaddingInfo, byte* pbHashValue, int cbHashValue, byte* pbSignature, int cbSignature, out int pcbResult, AsymmetricPaddingMode dwFlags);

internal static unsafe ErrorCode NCryptSignHash(SafeNCryptKeyHandle hKey, void* pPaddingInfo, ReadOnlySpan<byte> pbHashValue, Span<byte> pbSignature, out int pcbResult, AsymmetricPaddingMode dwFlags)
{
fixed (byte* pHash = &MemoryMarshal.GetReference(pbHashValue))
fixed (byte* pSignature = &Helpers.GetNonNullPinnableReference(pbSignature))
{
return NCryptSignHash(hKey, pPaddingInfo, pHash, pbHashValue.Length, pSignature, pbSignature.Length, out pcbResult, dwFlags);
}
}

[LibraryImport(Libraries.NCrypt, StringMarshalling = StringMarshalling.Utf16)]
internal static unsafe partial ErrorCode NCryptVerifySignature(SafeNCryptKeyHandle hKey, void* pPaddingInfo, ReadOnlySpan<byte> pbHashValue, int cbHashValue, ReadOnlySpan<byte> pbSignature, int cbSignature, AsymmetricPaddingMode dwFlags);
Expand Down
59 changes: 59 additions & 0 deletions src/libraries/Common/src/SourceGenerators/CSharpSyntaxUtilities.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Globalization;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;

namespace SourceGenerators;

internal static class CSharpSyntaxUtilities
{
// Standard format for double and single on non-inbox frameworks to ensure value is round-trippable.
public const string DoubleFormatString = "G17";
public const string SingleFormatString = "G9";

// Format a literal in C# format -- works around https://github.com/dotnet/roslyn/issues/58705
public static string FormatLiteral(object? value, TypeRef type)
{
if (value == null)
{
return $"default({type.FullyQualifiedName})";
}

switch (value)
{
case string @string:
return SymbolDisplay.FormatLiteral(@string, quote: true); ;
case char @char:
return SymbolDisplay.FormatLiteral(@char, quote: true);
case double.NegativeInfinity:
return "double.NegativeInfinity";
case double.PositiveInfinity:
return "double.PositiveInfinity";
case double.NaN:
return "double.NaN";
case double @double:
return $"{@double.ToString(DoubleFormatString, CultureInfo.InvariantCulture)}D";
case float.NegativeInfinity:
return "float.NegativeInfinity";
case float.PositiveInfinity:
return "float.PositiveInfinity";
case float.NaN:
return "float.NaN";
case float @float:
return $"{@float.ToString(SingleFormatString, CultureInfo.InvariantCulture)}F";
case decimal @decimal:
// we do not need to specify a format string for decimal as it's default is round-trippable on all frameworks.
return $"{@decimal.ToString(CultureInfo.InvariantCulture)}M";
case bool @bool:
return @bool ? "true" : "false";
default:
// Assume this is a number.
return FormatNumber();
}

string FormatNumber() => $"({type.FullyQualifiedName})({Convert.ToString(value, CultureInfo.InvariantCulture)})";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,25 @@ public void Verify2048WithSha1()
}
}

[Fact]
public void SignData_NullSignature_Fails()
{
using (DSA dsa = DSAFactory.Create())
{
dsa.ImportParameters(DSATestData.GetDSA1024Params());

bool result = dsa.TrySignData(
"hello"u8,
(Span<byte>)null,
HashAlgorithmName.SHA1,
DSASignatureFormat.IeeeP1363FixedFieldConcatenation,
out int bytesWritten);

Assert.False(result);
Assert.Equal(0, bytesWritten);
}
}

private void SignAndVerify(byte[] data, string hashAlgorithmName, DSAParameters dsaParameters, int expectedSignatureLength)
{
using (DSA dsa = DSAFactory.Create())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,32 @@ public void VerifyHash_InvalidArguments_Throws(ECDsa ecdsa)
AssertExtensions.Throws<ArgumentNullException>("hash", () => ecdsa.VerifyHash(null, null));
AssertExtensions.Throws<ArgumentNullException>("signature", () => ecdsa.VerifyHash(new byte[0], null));
}

[Theory]
[MemberData(nameof(RealImplementations))]
public void SignHash_NullSignature_Fails(ECDsa ecdsa)
{
byte[] hash = RandomNumberGenerator.GetBytes(SHA256.HashSizeInBytes);

AssertExtensions.Throws<ArgumentException>("destination", () =>
ecdsa.SignHash(hash, (Span<byte>)null, DSASignatureFormat.IeeeP1363FixedFieldConcatenation));

bool result = ecdsa.TrySignHash(hash, (Span<byte>)null, DSASignatureFormat.IeeeP1363FixedFieldConcatenation, out int bytesWritten);
Assert.False(result);
Assert.Equal(0, bytesWritten);
}

[Theory]
[MemberData(nameof(RealImplementations))]
public void SignData_NullSignature_Fails(ECDsa ecdsa)
{
AssertExtensions.Throws<ArgumentException>("destination", () =>
ecdsa.SignData("hello"u8, (Span<byte>)null, HashAlgorithmName.SHA256, DSASignatureFormat.IeeeP1363FixedFieldConcatenation));

bool result = ecdsa.TrySignData("hello"u8, (Span<byte>)null, HashAlgorithmName.SHA256, DSASignatureFormat.IeeeP1363FixedFieldConcatenation, out int bytesWritten);
Assert.False(result);
Assert.Equal(0, bytesWritten);
}
}

[SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")]
Expand Down
Loading