Skip to content
Merged
19 changes: 19 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,25 @@
<BuildDependsOn>$(BuildDependsOn);_CopySymbolsToArtifacts</BuildDependsOn>
</PropertyGroup>

<!-- Enable runtime async for net11.0+ source projects that ship only in the Shared Framework -->
<PropertyGroup Condition="'$(IsAspNetCoreApp)' == 'true' AND
'$(IsPackable)' != 'true' AND
$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net11.0')) AND
'$(UseRuntimeAsync)' != 'false' AND
'$(TargetOS)' != 'browser' AND
!$(RuntimeIdentifier.StartsWith('browser-'))">
<Features>$(Features);runtime-async=on</Features>
</PropertyGroup>

<!-- Also enable runtime async for compatible test projects -->
<PropertyGroup Condition="'$(IsTestProject)' == 'true' AND
$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net11.0')) AND
'$(UseRuntimeAsync)' != 'false' AND
'$(TargetOS)' != 'browser' AND
!$(RuntimeIdentifier.StartsWith('browser-'))">
<Features>$(Features);runtime-async=on</Features>
</PropertyGroup>

<!-- Properties for Package Validation -->
<PropertyGroup Condition="'$(ExcludeFromSourceOnlyBuild)' != 'true'">
<EnablePackageValidation Condition="'$(EnablePackageValidation)' == ''">true</EnablePackageValidation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@
<argument>ILLink</argument>
<argument>IL2026</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonInputFormatter.&lt;ReadRequestBodyAsync&gt;d__9.MoveNext</property>
<property name="Target">M:Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonInputFormatter.ReadRequestBodyAsync(Microsoft.AspNetCore.Mvc.Formatters.InputFormatterContext,System.Text.Encoding)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2026</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonOutputFormatter.&lt;WriteResponseBodyAsync&gt;d__5.MoveNext</property>
<property name="Target">M:Microsoft.AspNetCore.Mvc.Formatters.SystemTextJsonOutputFormatter.WriteResponseBodyAsync(Microsoft.AspNetCore.Mvc.Formatters.OutputFormatterWriteContext,System.Text.Encoding)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
Expand All @@ -101,7 +101,7 @@
<argument>ILLink</argument>
<argument>IL2026</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.AspNetCore.Mvc.Infrastructure.SystemTextJsonResultExecutor.&lt;ExecuteAsync&gt;d__4.MoveNext</property>
<property name="Target">M:Microsoft.AspNetCore.Mvc.Infrastructure.SystemTextJsonResultExecutor.ExecuteAsync(Microsoft.AspNetCore.Mvc.ActionContext,Microsoft.AspNetCore.Mvc.JsonResult)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
Expand All @@ -113,13 +113,13 @@
<argument>ILLink</argument>
<argument>IL2026</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.AspNetCore.Mvc.ModelBinding.Binders.CollectionModelBinder`1.&lt;BindComplexCollectionFromIndexes&gt;d__22.MoveNext</property>
<property name="Target">M:Microsoft.AspNetCore.Mvc.ModelBinding.Binders.CollectionModelBinder`1.BindComplexCollectionFromIndexes(Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext,System.Collections.Generic.IEnumerable{System.String})</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
<argument>IL2026</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ComplexObjectModelBinder.&lt;BindPropertyAsync&gt;d__15.MoveNext</property>
<property name="Target">M:Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ComplexObjectModelBinder.BindPropertyAsync(Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext,Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata,Microsoft.AspNetCore.Mvc.ModelBinding.IModelBinder,System.String,System.String)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
Expand All @@ -131,7 +131,7 @@
<argument>ILLink</argument>
<argument>IL2026</argument>
<property name="Scope">member</property>
<property name="Target">M:Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ComplexTypeModelBinder.&lt;BindProperty&gt;d__11.MoveNext</property>
<property name="Target">M:Microsoft.AspNetCore.Mvc.ModelBinding.Binders.ComplexTypeModelBinder.BindProperty(Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingContext,Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata,System.String,System.String)</property>
</attribute>
<attribute fullname="System.Diagnostics.CodeAnalysis.UnconditionalSuppressMessageAttribute">
<argument>ILLink</argument>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class HttpConnectionManagerTests : LoggedTest
#if !DEBUG
[ConditionalFact]
[NoDebuggerCondition]
[QuarantinedTest("https://github.com/dotnet/runtime/issues/126735")]
public async Task CriticalErrorLoggedIfApplicationDoesntComplete()
{
////////////////////////////////////////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Linq;
using System.Reactive.Linq;
using System.Threading.Channels;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Authorization;
Expand Down Expand Up @@ -150,11 +151,13 @@ public class DynamicTestHub : DynamicHub

public ChannelReader<string> StreamBroken() => TestHubMethodsImpl.StreamBroken();

[RuntimeAsyncMethodGeneration(false)]
public async Task CallEcho(string message)
{
await Clients.Client(Context.ConnectionId).Echo(message);
}

[RuntimeAsyncMethodGeneration(false)]
public async Task CallHandlerThatDoesntExist()
{
await Clients.Client(Context.ConnectionId).NoClientHandler();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

// Polyfill: RuntimeAsyncMethodGenerationAttribute is not yet public API
namespace System.Runtime.CompilerServices;

[AttributeUsage(AttributeTargets.Method)]
internal sealed class RuntimeAsyncMethodGenerationAttribute(bool runtimeAsync) : Attribute
{
public bool RuntimeAsync { get; } = runtimeAsync;
}
Loading