Skip to content

Commit

Permalink
Update SDK projects to target .NET 8.
Browse files Browse the repository at this point in the history
Signed-off-by: Phillip Hoff <[email protected]>
  • Loading branch information
philliphoff committed Nov 14, 2023
1 parent 6a0a905 commit 207fe44
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ private static IEndpointConventionBuilder MapActorMethodEndpoint(this IEndpointR
if (header != string.Empty)
{
// exception case
context.Response.Headers.Add(Constants.ErrorResponseHeaderName, header); // add error header
context.Response.Headers[Constants.ErrorResponseHeaderName] = header; // add error header
}

await context.Response.Body.WriteAsync(body, 0, body.Length); // add response message body
Expand All @@ -118,7 +118,7 @@ private static IEndpointConventionBuilder MapActorMethodEndpoint(this IEndpointR
{
var (header, body) = CreateExceptionResponseMessage(ex);

context.Response.Headers.Add(Constants.ErrorResponseHeaderName, header);
context.Response.Headers[Constants.ErrorResponseHeaderName] = header;
await context.Response.Body.WriteAsync(body, 0, body.Length);
}
finally
Expand Down
3 changes: 0 additions & 3 deletions src/Dapr.Actors.AspNetCore/Dapr.Actors.AspNetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6</TargetFramework>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<!--
Expand Down
4 changes: 0 additions & 4 deletions src/Dapr.Actors/Dapr.Actors.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6</TargetFramework>
</PropertyGroup>

<!-- Additional Nuget package properties. -->
<PropertyGroup>
<Description>This package contains the reference assemblies for developing Actor services using Dapr.</Description>
Expand Down
4 changes: 0 additions & 4 deletions src/Dapr.AspNetCore/Dapr.AspNetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6</TargetFramework>
</PropertyGroup>

<!-- Additional Nuget package properties. -->
<PropertyGroup>
<Description>This package contains the reference assemblies for developing services using Dapr and AspNetCore.</Description>
Expand Down
9 changes: 9 additions & 0 deletions src/Dapr.AspNetCore/DaprAuthenticationHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,22 @@ internal class DaprAuthenticationHandler : AuthenticationHandler<DaprAuthenticat
{
const string DaprApiToken = "Dapr-Api-Token";

#if NET8_0_OR_GREATER
public DaprAuthenticationHandler(
IOptionsMonitor<DaprAuthenticationOptions> options,
ILoggerFactory logger,
UrlEncoder encoder) : base(options, logger, encoder)
{
}
#else
public DaprAuthenticationHandler(
IOptionsMonitor<DaprAuthenticationOptions> options,
ILoggerFactory logger,
UrlEncoder encoder,
ISystemClock clock) : base(options, logger, encoder, clock)
{
}
#endif

protected override Task<AuthenticateResult> HandleAuthenticateAsync()
{
Expand Down
4 changes: 0 additions & 4 deletions src/Dapr.Client/Dapr.Client.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6</TargetFramework>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\Shared\ArgumentVerifier.cs" />
<Compile Include="..\Shared\DaprDefaults.cs" />
Expand Down
6 changes: 6 additions & 0 deletions src/Dapr.Client/DaprApiException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ public DaprApiException(string message, Exception inner, string errorCode, bool
/// </summary>
/// <param name="info">The <see cref="System.Runtime.Serialization.SerializationInfo" /> object that contains serialized object data of the exception being thrown.</param>
/// <param name="context">The <see cref="System.Runtime.Serialization.StreamingContext" /> object that contains contextual information about the source or destination. The context parameter is reserved for future use and can be null.</param>
#if NET8_0_OR_GREATER
[Obsolete(DiagnosticId = "SYSLIB0051")] // add this attribute to the serialization ctor
#endif
protected DaprApiException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
Expand All @@ -115,6 +118,9 @@ protected DaprApiException(SerializationInfo info, StreamingContext context)
public bool IsTransient { get; } = false;

/// <inheritdoc />
#if NET8_0_OR_GREATER
[Obsolete(DiagnosticId = "SYSLIB0051")] // add this attribute to GetObjectData
#endif
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
Expand Down
3 changes: 3 additions & 0 deletions src/Dapr.Client/DaprException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ public DaprException(string message, Exception innerException)
/// </summary>
/// <param name="info">The <see cref="SerializationInfo" /> object that contains serialized object data of the exception being thrown.</param>
/// <param name="context">The <see cref="StreamingContext" /> object that contains contextual information about the source or destination. The context parameter is reserved for future use and can be null.</param>
#if NET8_0_OR_GREATER
[Obsolete(DiagnosticId = "SYSLIB0051")] // add this attribute to GetObjectData
#endif
protected DaprException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>

Expand Down
3 changes: 2 additions & 1 deletion src/Dapr.Workflow/Dapr.Workflow.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

<!-- NuGet configuration -->
<PropertyGroup>
<TargetFrameworks>net6;net7</TargetFrameworks>
<!-- NOTE: Workflows targeted .NET 7 (whereas other packages did not, so we must continue until .NET 7 EOL). -->
<TargetFrameworks>net6;net7;net8</TargetFrameworks>
<Nullable>enable</Nullable>
<PackageId>Dapr.Workflow</PackageId>
<Title>Dapr Workflow Authoring SDK</Title>
Expand Down
1 change: 1 addition & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<Import Project="$(MSBuildThisFileDirectory)..\properties\dapr_nuget.props" />

<PropertyGroup>
<TargetFrameworks>net6;net8</TargetFrameworks>
<OutputPath>$(RepoRoot)bin\$(Configuration)\prod\$(MSBuildProjectName)\</OutputPath>

<DocumentationFile>$(OutputPath)$(MSBuildProjectName).xml</DocumentationFile>
Expand Down

0 comments on commit 207fe44

Please sign in to comment.