Skip to content

Commit ac10f7d

Browse files
committed
Add SkipLocalsInit
1 parent 9b1ba0f commit ac10f7d

18 files changed

+45
-1
lines changed

src/Hosting/Abstractions/src/Microsoft.AspNetCore.Hosting.Abstractions.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<Description>ASP.NET Core hosting and startup abstractions for web applications.</Description>
55
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
66
<IsAspNetCoreApp>true</IsAspNetCoreApp>
7+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
78
<GenerateDocumentationFile>true</GenerateDocumentationFile>
89
<PackageTags>aspnetcore;hosting</PackageTags>
910
<IsPackable>false</IsPackable>
@@ -14,6 +15,8 @@
1415
<Reference Include="Microsoft.AspNetCore.Hosting.Server.Abstractions" />
1516
<Reference Include="Microsoft.AspNetCore.Http.Abstractions" />
1617
<Reference Include="Microsoft.Extensions.Hosting.Abstractions" />
18+
19+
<Compile Include="$(SharedSourceRoot)SkipLocalsInit.cs" LinkBase="Shared\SkipLocalsInit.cs" />
1720
</ItemGroup>
1821

1922
</Project>

src/Hosting/Hosting/src/Microsoft.AspNetCore.Hosting.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<Description>ASP.NET Core hosting infrastructure and startup logic for web applications.</Description>
55
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
66
<IsAspNetCoreApp>true</IsAspNetCoreApp>
7+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
78
<GenerateDocumentationFile>true</GenerateDocumentationFile>
89
<PackageTags>aspnetcore;hosting</PackageTags>
910
<IsPackable>false</IsPackable>
@@ -31,6 +32,7 @@
3132
<Reference Include="Microsoft.Extensions.Options" />
3233

3334
<Compile Include="$(SharedSourceRoot)TypeNameHelper\*.cs" />
35+
<Compile Include="$(SharedSourceRoot)SkipLocalsInit.cs" LinkBase="Shared\SkipLocalsInit.cs" />
3436
</ItemGroup>
3537

3638
</Project>

src/Hosting/Server.Abstractions/src/Microsoft.AspNetCore.Hosting.Server.Abstractions.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<Description>ASP.NET Core hosting server abstractions for web applications.</Description>
55
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
66
<IsAspNetCoreApp>true</IsAspNetCoreApp>
7+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
78
<GenerateDocumentationFile>true</GenerateDocumentationFile>
89
<PackageTags>aspnetcore;hosting</PackageTags>
910
<IsPackable>false</IsPackable>
@@ -13,6 +14,8 @@
1314
<ItemGroup>
1415
<Reference Include="Microsoft.AspNetCore.Http.Features" />
1516
<Reference Include="Microsoft.Extensions.Configuration.Abstractions" />
17+
18+
<Compile Include="$(SharedSourceRoot)SkipLocalsInit.cs" LinkBase="Shared\SkipLocalsInit.cs" />
1619
</ItemGroup>
1720

1821
</Project>

src/Http/Headers/src/Microsoft.Net.Http.Headers.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,8 @@
1616
<Reference Include="Microsoft.Extensions.Primitives" />
1717
</ItemGroup>
1818

19+
<ItemGroup>
20+
<Compile Include="$(SharedSourceRoot)SkipLocalsInit.cs" LinkBase="Shared\SkipLocalsInit.cs" />
21+
</ItemGroup>
22+
1923
</Project>

src/Http/Http.Abstractions/src/Microsoft.AspNetCore.Http.Abstractions.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Microsoft.AspNetCore.Http.HttpResponse</Description>
1212
<IsAspNetCoreApp>true</IsAspNetCoreApp>
1313
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1414
<PackageTags>aspnetcore</PackageTags>
15+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1516
<IsPackable>false</IsPackable>
1617
<Nullable>enable</Nullable>
1718
</PropertyGroup>
@@ -23,6 +24,7 @@ Microsoft.AspNetCore.Http.HttpResponse</Description>
2324
<Compile Include="$(SharedSourceRoot)ActivatorUtilities\*.cs" />
2425
<Compile Include="$(SharedSourceRoot)ParameterDefaultValue\*.cs" />
2526
<Compile Include="$(SharedSourceRoot)PropertyHelper\**\*.cs" />
27+
<Compile Include="$(SharedSourceRoot)SkipLocalsInit.cs" LinkBase="Shared\SkipLocalsInit.cs" />
2628
</ItemGroup>
2729

2830
<ItemGroup>

src/Http/Http.Extensions/src/Microsoft.AspNetCore.Http.Extensions.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<TargetFramework>$(DefaultNetCoreTargetFramework)</TargetFramework>
66
<IsAspNetCoreApp>true</IsAspNetCoreApp>
77
<NoWarn>$(NoWarn);CS1591</NoWarn>
8+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
89
<GenerateDocumentationFile>true</GenerateDocumentationFile>
910
<PackageTags>aspnetcore</PackageTags>
1011
<IsPackable>false</IsPackable>
@@ -13,6 +14,7 @@
1314

1415
<ItemGroup>
1516
<Compile Include="..\..\Shared\StreamCopyOperationInternal.cs" Link="StreamCopyOperationInternal.cs" />
17+
<Compile Include="$(SharedSourceRoot)SkipLocalsInit.cs" LinkBase="Shared\SkipLocalsInit.cs" />
1618
</ItemGroup>
1719

1820
<ItemGroup>

src/Http/Http.Features/src/Microsoft.AspNetCore.Http.Features.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<TargetFrameworks Condition="'$(DotNetBuildFromSource)' == 'true'">$(DefaultNetCoreTargetFramework)</TargetFrameworks>
77
<IsAspNetCoreApp>true</IsAspNetCoreApp>
88
<NoWarn>$(NoWarn);CS1591</NoWarn>
9+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
910
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1011
<PackageTags>aspnetcore</PackageTags>
1112
<Nullable>enable</Nullable>
@@ -15,6 +16,8 @@
1516
<ItemGroup>
1617
<Reference Include="Microsoft.Extensions.Primitives" />
1718
<Reference Include="System.IO.Pipelines" />
19+
20+
<Compile Include="$(SharedSourceRoot)SkipLocalsInit.cs" LinkBase="Shared\SkipLocalsInit.cs" />
1821
</ItemGroup>
1922

2023
</Project>

src/Http/Http/src/Microsoft.AspNetCore.Http.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<Compile Include="$(SharedSourceRoot)ValueTaskExtensions\**\*.cs" />
1818
<Compile Include="..\..\Shared\StreamCopyOperationInternal.cs" Link="Internal\StreamCopyOperationInternal.cs" />
1919
<Compile Include="..\..\WebUtilities\src\AspNetCoreTempDirectory.cs" LinkBase="Internal" />
20+
<Compile Include="$(SharedSourceRoot)SkipLocalsInit.cs" LinkBase="Shared\SkipLocalsInit.cs" />
2021
</ItemGroup>
2122

2223
<ItemGroup>

src/Http/Routing.Abstractions/src/Microsoft.AspNetCore.Routing.Abstractions.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ Microsoft.AspNetCore.Routing.RouteData</Description>
99
<IsAspNetCoreApp>true</IsAspNetCoreApp>
1010
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1111
<PackageTags>aspnetcore;routing</PackageTags>
12+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1213
<IsPackable>false</IsPackable>
1314
<Nullable>annotations</Nullable>
1415
</PropertyGroup>
1516

1617
<ItemGroup>
1718
<Compile Include="$(SharedSourceRoot)PropertyHelper\*.cs" />
19+
<Compile Include="$(SharedSourceRoot)SkipLocalsInit.cs" LinkBase="Shared\SkipLocalsInit.cs" />
1820
</ItemGroup>
1921

2022
<ItemGroup>

src/Http/Routing/src/Microsoft.AspNetCore.Routing.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Microsoft.AspNetCore.Routing.RouteCollection</Description>
2424

2525
<ItemGroup>
2626
<Compile Include="$(SharedSourceRoot)PropertyHelper\*.cs" />
27+
<Compile Include="$(SharedSourceRoot)SkipLocalsInit.cs" LinkBase="Shared\SkipLocalsInit.cs" />
2728
</ItemGroup>
2829

2930
<ItemGroup>

src/Http/WebUtilities/src/Microsoft.AspNetCore.WebUtilities.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<IsAspNetCoreApp>true</IsAspNetCoreApp>
77
<DefineConstants>$(DefineConstants);WebEncoders_In_WebUtilities</DefineConstants>
88
<NoWarn>$(NoWarn);CS1591</NoWarn>
9+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
910
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1011
<PackageTags>aspnetcore</PackageTags>
1112
<IsPackable>false</IsPackable>
@@ -15,6 +16,7 @@
1516
<ItemGroup>
1617
<Compile Include="$(SharedSourceRoot)WebEncoders\**\*.cs" />
1718
<Compile Include="$(SharedSourceRoot)UrlDecoder\**\*.cs" />
19+
<Compile Include="$(SharedSourceRoot)SkipLocalsInit.cs" LinkBase="Shared\SkipLocalsInit.cs" />
1820
</ItemGroup>
1921

2022
<ItemGroup>

src/Servers/Connections.Abstractions/src/Microsoft.AspNetCore.Connections.Abstractions.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<GenerateDocumentationFile>true</GenerateDocumentationFile>
99
<PackageTags>aspnetcore</PackageTags>
1010
<NoWarn>CS1591;$(NoWarn)</NoWarn>
11+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1112
<Nullable>enable</Nullable>
1213
</PropertyGroup>
1314

@@ -17,6 +18,7 @@
1718
<Compile Include="$(SharedSourceRoot)ActivatorUtilities\*.cs" />
1819
<Compile Include="$(SharedSourceRoot)ParameterDefaultValue\*.cs" />
1920
<Compile Include="$(SharedSourceRoot)CodeAnalysis\*.cs" />
21+
<Compile Include="$(SharedSourceRoot)SkipLocalsInit.cs" LinkBase="Shared\SkipLocalsInit.cs" />
2022
</ItemGroup>
2123

2224
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == '$(DefaultNetFxTargetFramework)'">

src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
<Compile Include="$(SharedSourceRoot)Hpack\**\*.cs" Link="Shared\Hpack\%(Filename)%(Extension)" />
2424
<Compile Include="$(SharedSourceRoot)ServerInfrastructure\**\*.cs" />
2525
<Compile Include="$(RepoRoot)src\Shared\TaskToApm.cs" Link="Internal\TaskToApm.cs" />
26+
<Compile Include="$(SharedSourceRoot)SkipLocalsInit.cs" LinkBase="Shared\SkipLocalsInit.cs" />
27+
2628
</ItemGroup>
2729

2830
<ItemGroup>

src/Servers/Kestrel/Kestrel/src/Microsoft.AspNetCore.Server.Kestrel.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<IsAspNetCoreApp>true</IsAspNetCoreApp>
77
<GenerateDocumentationFile>true</GenerateDocumentationFile>
88
<PackageTags>aspnetcore;kestrel</PackageTags>
9+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
910
<IsPackable>false</IsPackable>
1011
<Nullable>enable</Nullable>
1112
</PropertyGroup>
@@ -14,6 +15,8 @@
1415
<Reference Include="Microsoft.AspNetCore.Hosting" />
1516
<Reference Include="Microsoft.AspNetCore.Server.Kestrel.Core" />
1617
<Reference Include="Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets" />
18+
19+
<Compile Include="$(SharedSourceRoot)SkipLocalsInit.cs" LinkBase="Shared\SkipLocalsInit.cs" />
1720
</ItemGroup>
1821

1922
</Project>

src/Servers/Kestrel/Transport.Libuv/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<Compile Include="$(KestrelSharedSourceRoot)\TransportConnection.cs" Link="Internal\TransportConnection.cs" />
1818
<Compile Include="$(KestrelSharedSourceRoot)\TransportConnection.Generated.cs" Link="Internal\TransportConnection.Generated.cs" />
1919
<Compile Include="$(KestrelSharedSourceRoot)\TransportConnection.FeatureCollection.cs" Link="Internal\TransportConnection.FeatureCollection.cs" />
20+
<Compile Include="$(SharedSourceRoot)SkipLocalsInit.cs" LinkBase="Shared\SkipLocalsInit.cs" />
2021
</ItemGroup>
2122

2223
<ItemGroup>

src/Servers/Kestrel/Transport.Quic/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Experimental.Quic.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<Compile Include="$(KestrelSharedSourceRoot)\TransportMultiplexedConnection.Generated.cs" Link="Internal\TransportMultiplexedConnection.Generated.cs" />
2121
<Compile Include="$(KestrelSharedSourceRoot)\TransportMultiplexedConnection.FeatureCollection.cs" Link="Internal\TransportMultiplexedConnection.FeatureCollection.cs" />
2222
<Compile Include="$(RepoRoot)src\Shared\TaskToApm.cs" Link="Internal\TaskToApm.cs" />
23+
<Compile Include="$(SharedSourceRoot)SkipLocalsInit.cs" LinkBase="Shared\SkipLocalsInit.cs" />
2324
</ItemGroup>
2425

2526
<ItemGroup>

src/Servers/Kestrel/Transport.Sockets/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
44
<Description>Managed socket transport for the ASP.NET Core Kestrel cross-platform web server.</Description>
@@ -18,6 +18,7 @@
1818
<Compile Include="$(KestrelSharedSourceRoot)\TransportConnection.cs" Link="Internal\TransportConnection.cs" />
1919
<Compile Include="$(KestrelSharedSourceRoot)\TransportConnection.Generated.cs" Link="Internal\TransportConnection.Generated.cs" />
2020
<Compile Include="$(KestrelSharedSourceRoot)\TransportConnection.FeatureCollection.cs" Link="Internal\TransportConnection.FeatureCollection.cs" />
21+
<Compile Include="$(SharedSourceRoot)SkipLocalsInit.cs" LinkBase="Shared\SkipLocalsInit.cs" />
2122
</ItemGroup>
2223

2324
<ItemGroup>

src/Shared/SkipLocalsInit.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
// Used to indicate to the compiler that the .locals init flag should not be set in method headers.
5+
#if NET6_0
6+
[module: System.Runtime.CompilerServices.SkipLocalsInit]
7+
#else
8+
#error Target frameworks need to be updated.
9+
#endif

0 commit comments

Comments
 (0)