Skip to content
Merged
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
1 change: 1 addition & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Import Project="$(MSBuildThisFileDirectory)\eng\MSBuild\Shared.targets" />
<Import Project="$(MSBuildThisFileDirectory)\eng\MSBuild\Generators.targets" />
<Import Project="$(MSBuildThisFileDirectory)\eng\MSBuild\ProjectStaging.targets" />
<Import Project="$(MSBuildThisFileDirectory)\eng\MSBuild\StrongName.targets" />

<PropertyGroup>
<!-- Workaround https://github.com/dotnet/sdk/issues/51265 - can be removed when updating to .NET 10.0.100 (GA) SDK -->
Expand Down
4 changes: 4 additions & 0 deletions eng/MSBuild/LegacySupport.props
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
<Compile Include="$(MSBuildThisFileDirectory)\..\..\src\LegacySupport\NullabilityInfoContext\*.cs" LinkBase="LegacySupport\NullabilityInfoContext" />
</ItemGroup>

<ItemGroup Condition="'$(InjectUnreachableExceptionOnLegacy)' == 'true' AND ('$(TargetFramework)' == 'net462' or '$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1' or '$(TargetFramework)' == 'netcoreapp3.1' or '$(TargetFramework)' == 'net6.0')">
<Compile Include="$(MSBuildThisFileDirectory)\..\..\src\LegacySupport\UnreachableException\*.cs" LinkBase="LegacySupport\UnreachableException" />
Comment thread
adamsitnik marked this conversation as resolved.
</ItemGroup>

<!-- FilePolyfills: Adds C# 14 extension members for File methods not available on legacy frameworks -->
<ItemGroup Condition="'$(InjectFilePolyfillsOnLegacy)' == 'true'">
<Compile Include="$(MSBuildThisFileDirectory)\..\..\src\LegacySupport\FilePolyfills\*.cs" LinkBase="LegacySupport\FilePolyfills" />
Expand Down
2 changes: 2 additions & 0 deletions eng/MSBuild/Packaging.targets
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
<!-- https://learn.microsoft.com/dotnet/fundamentals/package-validation/overview -->
<EnablePackageValidation>true</EnablePackageValidation>

<!-- Temporarily use a different version for MEVD, delete after it's on the same train -->
Comment thread
adamsitnik marked this conversation as resolved.
<PackageValidationBaselineVersion Condition="'$(Stage)' == 'normal' and '$(MSBuildProjectName)' == 'Microsoft.Extensions.VectorData.Abstractions' and '$(PackageValidationBaselineVersion)' == ''">10.1.0</PackageValidationBaselineVersion>
<PackageValidationBaselineVersion Condition="'$(Stage)' == 'normal' and '$(PackageValidationBaselineVersion)' == ''">10.4.0</PackageValidationBaselineVersion>
</PropertyGroup>

Expand Down
15 changes: 15 additions & 0 deletions eng/MSBuild/StrongName.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project>
<PropertyGroup>
<MicrosoftSharedLibPublicKey>002400000c80000014010000060200000024000052534131000800000100010085aad0bef0688d1b994a0d78e1fd29fc24ac34ed3d3ac3fb9b3d0c48386ba834aa880035060a8848b2d8adf58e670ed20914be3681a891c9c8c01eef2ab22872547c39be00af0e6c72485d7cfd1a51df8947d36ceba9989106b58abe79e6a3e71a01ed6bdc867012883e0b1a4d35b1b5eeed6df21e401bb0c22f2246ccb69979dc9e61eef262832ed0f2064853725a75485fa8a3efb7e027319c86dec03dc3b1bca2b5081bab52a627b9917450dfad534799e1c7af58683bdfa135f1518ff1ea60e90d7b993a6c87fd3dd93408e35d1296f9a7f9a97c5db56c0f3cc25ad11e9777f94d138b3cea53b9a8331c2e6dcb8d2ea94e18bf1163ff112a22dbd92d429a</MicrosoftSharedLibPublicKey>
Comment thread
adamsitnik marked this conversation as resolved.
</PropertyGroup>

<!-- We choose the name MicrosoftSharedLib to represent this key, but that's just our name for it.
The key is named "​2048 - Microsoft Shared Libraries (.NET 4.5)(SHA2)".
It's actually the same key used for most of our libraries, but they all use an older key for identity
and AssemblySignatureKeyAttribute to sign with this key. -->
<PropertyGroup Condition="'$(StrongNameKeyId)' == 'MicrosoftSharedLib'">
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)../snk/MSSharedLibSHA2.snk</AssemblyOriginatorKeyFile>
<PublicKey>$(MicrosoftSharedLibPublicKey)</PublicKey>
<PublicKeyToken>f300afd708cefcd3</PublicKeyToken>
</PropertyGroup>
</Project>
10 changes: 6 additions & 4 deletions eng/Signing.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<!-- This file gets automatically imported by Arcade infrastructure when calling the build scripts -->
<Project>
<ItemGroup>
<FileExtensionSignInfo Update=".js" CertificateName="MicrosoftDotNet500" />
<ItemsToSign Include="$(ArtifactsDir)VSIX\*.vsix" />
</ItemGroup>
<ItemGroup>
<!-- Specify that files with the PKT f300afd708cefcd3 should be signed with the MSSharedLibSHA2 strong-name certificate and the Microsoft400 authenticode certificate -->
<StrongNameSignInfo Include="MSSharedLibSHA2" PublicKeyToken="f300afd708cefcd3" CertificateName="Microsoft400" />
<FileExtensionSignInfo Update=".js" CertificateName="MicrosoftDotNet500" />
<ItemsToSign Include="$(ArtifactsDir)VSIX\*.vsix" />
</ItemGroup>
</Project>
1 change: 1 addition & 0 deletions eng/packages/General-LTS.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="$(MicrosoftBclAsyncInterfacesLTSVersion)" />
<PackageVersion Include="Microsoft.Bcl.Memory" Version="$(MicrosoftBclMemoryVersion)" /> <!-- Note there is no 8.0 version of Microsoft.Bcl.Memory -->
<PackageVersion Include="Microsoft.Bcl.TimeProvider" Version="$(MicrosoftBclTimeProviderLTSVersion)" />
<PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="$(MicrosoftExtensionsAIAbstractionsLTSVersion)" />
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="$(MicrosoftExtensionsCachingAbstractionsLTSVersion)" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="$(MicrosoftExtensionsCachingMemoryLTSVersion)" />
<PackageVersion Include="Microsoft.Extensions.Caching.SqlServer" Version="$(MicrosoftExtensionsCachingSqlServerLTSVersion)" />
Expand Down
1 change: 1 addition & 0 deletions eng/packages/General-net10.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="$(MicrosoftBclAsyncInterfacesNet10Version)" />
<PackageVersion Include="Microsoft.Bcl.Memory" Version="$(MicrosoftBclMemoryNet10Version)" />
<PackageVersion Include="Microsoft.Bcl.TimeProvider" Version="$(MicrosoftBclTimeProviderNet10Version)" />
<PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="$(MicrosoftExtensionsAIAbstractionsNet10Version)" />
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="$(MicrosoftExtensionsCachingAbstractionsNet10Version)" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="$(MicrosoftExtensionsCachingMemoryNet10Version)" />
<PackageVersion Include="Microsoft.Extensions.Caching.SqlServer" Version="$(MicrosoftExtensionsCachingSqlServerNet10Version)" />
Expand Down
1 change: 1 addition & 0 deletions eng/packages/General-net9.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="$(MicrosoftBclAsyncInterfacesVersion)" />
<PackageVersion Include="Microsoft.Bcl.Memory" Version="$(MicrosoftBclMemoryVersion)" />
<PackageVersion Include="Microsoft.Bcl.TimeProvider" Version="$(MicrosoftBclTimeProviderVersion)" />
<PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="$(MicrosoftExtensionsAIAbstractionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.Caching.Abstractions" Version="$(MicrosoftExtensionsCachingAbstractionsVersion)" />
<PackageVersion Include="Microsoft.Extensions.Caching.Memory" Version="$(MicrosoftExtensionsCachingMemoryVersion)" />
<PackageVersion Include="Microsoft.Extensions.Caching.SqlServer" Version="$(MicrosoftExtensionsCachingSqlServerVersion)" />
Expand Down
1 change: 1 addition & 0 deletions eng/packages/Tests.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
<PackageVersion Include="System.Configuration.ConfigurationManager" Version="$(SystemConfigurationConfigurationManagerVersion)" />
<PackageVersion Include="Verify.Xunit" Version="28.15.0" />
<PackageVersion Include="Xunit.Combinatorial" Version="1.6.24" />
<PackageVersion Include="xunit" Version="$(XUnitVersion)" />
<PackageVersion Include="xunit.extensibility.execution" Version="$(XUnitVersion)" />
<PackageVersion Include="Xunit.SkippableFact" Version="1.4.13" />
</ItemGroup>
Expand Down
Binary file added eng/snk/MSSharedLibSHA2.snk
Binary file not shown.
1 change: 1 addition & 0 deletions scripts/MakeEditorConfigs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Write-Output "Creating .editorconfig files"
& $Command $Diags editorconfig save --exclude xunit.analyzers bench/.editorconfig general,performance
& $Command $Diags editorconfig save --exclude xunit.analyzers eng/Tools/.editorconfig general
& $Command $Diags editorconfig save test/.editorconfig general,test
& $Command $Diags editorconfig save src/Libraries/Microsoft.Extensions.VectorData.ConformanceTests/.editorconfig general,test

# The files we publish with the M.E.StaticAnalysis package

Expand Down
27 changes: 20 additions & 7 deletions src/Analyzers/Microsoft.Analyzers.Local/ApiLifecycle/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

using System;
using System.Collections.Generic;
using System.Linq;

namespace Microsoft.Extensions.LocalAnalyzers.ApiLifecycle;

internal static class Utils
{
private static readonly char[] _colon = { ':' };
private static readonly char[] _comma = { ',' };
private static readonly string[] _whereSeparator = { " where " };

public static string[] GetConstraints(string typeSignature)
{
Expand All @@ -21,13 +21,26 @@ public static string[] GetConstraints(string typeSignature)
return Array.Empty<string>();
}

var substrings = typeSignature.Split(_colon);
// Extract everything from the first "where" onwards, then split into
// individual "where T : ..." clauses and collect the constraint values.
var constraintsPart = typeSignature.Substring(whereClauseIndex);
var clauses = constraintsPart.Split(_whereSeparator, StringSplitOptions.RemoveEmptyEntries);
var result = new List<string>();

foreach (var clause in clauses)
{
var colonIndex = clause.IndexOf(':');
if (colonIndex >= 0)
{
var constraintValues = clause.Substring(colonIndex + 1);
foreach (var c in constraintValues.Split(_comma))
{
result.Add(c.Trim());
}
}
}

#pragma warning disable S109 // Magic numbers should not be used
return substrings.Length == 2
? substrings[1].Split(_comma).Select(x => x.Trim()).ToArray()
: substrings[2].Split(_comma).Select(x => x.Trim()).ToArray();
#pragma warning restore S109 // Magic numbers should not be used
return result.ToArray();
}

public static string StripBaseAndConstraints(string typeSignature)
Expand Down
48 changes: 48 additions & 0 deletions src/LegacySupport/UnreachableException/UnreachableException.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// 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.CodeAnalysis;

#pragma warning disable CA1064 // Exceptions should be public
#pragma warning disable CA1812 // Internal class that is (sometimes) never instantiated.

namespace System.Diagnostics;

/// <summary>
/// Exception thrown when the program executes an instruction that was thought to be unreachable.
/// </summary>
[ExcludeFromCodeCoverage]
internal sealed class UnreachableException : Exception
Comment thread
roji marked this conversation as resolved.
{
private const string MessageText = "The program executed an instruction that was thought to be unreachable.";

/// <summary>
/// Initializes a new instance of the <see cref="UnreachableException"/> class with the default error message.
/// </summary>
public UnreachableException()
: base(MessageText)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="UnreachableException"/>
/// class with a specified error message.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
public UnreachableException(string? message)
: base(message ?? MessageText)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="UnreachableException"/>
/// class with a specified error message and a reference to the inner exception that is the cause of
/// this exception.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="innerException">The exception that is the cause of the current exception.</param>
public UnreachableException(string? message, Exception? innerException)
: base(message ?? MessageText, innerException)
{
}
}
Loading
Loading